コード例 #1
0
def decryptCertificates():
    message = "decrypt certificates"
    try:
        BasicFunctions.run(
            'openssl', 'aes-256-cbc', '-K',
            BasicFunctions.environmentVariable('encrypted_d23b8f89b93f_key'),
            '-iv',
            BasicFunctions.environmentVariable('encrypted_d23b8f89b93f_iv'),
            '-in', 'Certificates/snapCredentials.tar.enc', '-out',
            'Certificates/snapCredentials.tar', '-d')
    except Exception as exception:
        BasicFunctions.printFailMessage(message, exception)
        sys.exit()
    else:
        BasicFunctions.printSuccessMessage(message)
コード例 #2
0
def osDependentDeploy():
    config = Project.Config()
    os_name = config['os']['name']
    project_dir_path = config['project']['dir_path']
    branch = BasicFunctions.environmentVariable('TRAVIS_BRANCH')
    if os_name == 'linux':
        if branch == 'develop' or branch == 'examples':
            snapcraft_dir_name = '.snapcraft'
            docker_image = 'cibuilds/snapcraft:core18'
            downloaded_image_path = '.soft/snap.tar.gz'
            createSnapcraftDir(snapcraft_dir_name)
            decryptCertificates()
            extractCertificates()
            moveCertificates(snapcraft_dir_name)
            saveDockerImage(docker_image, downloaded_image_path)
            loadDockerImage(downloaded_image_path)
            runDockerImage(docker_image, project_dir_path, branch)
        else:
            message = "* No deployment for branch '{}' is implemented".format(
                branch)
            print(message)
    else:
        message = "* No deployment for '{}' App Store is implemented".format(
            os_name)
        print(message)
コード例 #3
0
            "tag_name": self._tag_name,
            "target_commitish": self._target_commitish,
            "name": self._name,
            "body": self._body,
            "draft": self._draft,
            "prerelease": self._prerelease
        }


# MAIN

if __name__ == "__main__":
    BasicFunctions.printTitle('Deploy to GitHub releases')

    # Exit if pull request
    pull_request = BasicFunctions.environmentVariable('TRAVIS_PULL_REQUEST')
    if pull_request != 'false':
        print("* Deployment not needed. It's a pull request No. '{}'".format(
            pull_request))
        exit()

    # Load config
    config = Project.Config()

    # Init github communication
    owner = config.getVal('github', 'owner')
    repo = config.getVal('github', 'repo')
    token = BasicFunctions.environmentVariable('GITHUB_TOKEN')
    #token = BasicFunctions.environmentVariable('GITHUB_TOKEN', default='...')
    github = GithubAgent(owner=owner, repo=repo, token=token)
コード例 #4
0
            decryptCertificates()
            extractCertificates()
            moveCertificates(snapcraft_dir_name)
            saveDockerImage(docker_image, downloaded_image_path)
            loadDockerImage(downloaded_image_path)
            runDockerImage(docker_image, project_dir_path, branch)
        else:
            message = "* No deployment for branch '{}' is implemented".format(
                branch)
            print(message)
    else:
        message = "* No deployment for '{}' App Store is implemented".format(
            os_name)
        print(message)


# MAIN

if __name__ == "__main__":
    BasicFunctions.printTitle('Deploy to App Store')

    # Exit if pull request
    pull_request = BasicFunctions.environmentVariable('TRAVIS_PULL_REQUEST')
    if pull_request != 'false':
        print("* Deployment not needed. It's a pull request No. '{}'".format(
            pull_request))
        exit()

    # Deploy
    osDependentDeploy()
コード例 #5
0
            if file_ext == '.py':
                file_path = os.path.join(dir_path, file_name)
                relative_path = os.path.relpath(file_path, parent_dir_path)
                file_paths.append(relative_path)
    return file_paths

if __name__ == "__main__":
    BasicFunctions.printTitle('Report Complexity')

    config = Project.Config()
    project_dir_path = config['project']['dir_path']
    app_dir_path = config['project']['subdirs']['app']['path']
    file_paths = pyFilePaths(app_dir_path)

    # if Travis
    if BasicFunctions.environmentVariable('TRAVIS_BRANCH'):
        print('Not implemented yet')

    # if local machine
    else:
        BasicFunctions.runAsIs(
            'wily',
            'build',                                                            # By default, it will assume the directory is a git repository and will scan back through 50 revisions
            app_dir_path,                                                       # directory to be scanned
            '--max-revisions', '1',                                             # -n, --max-revisions <max_revisions>: The maximum number of historical commits to archive
            )
        BasicFunctions.runAsIs(
            'wily',
            'diff',                                                             # compare the last cached revision of the code with the current metrics (for the current environment).
            *file_paths,                                                        # to see the changes in metrics for a list of files
            '--changes-only',                                                   # --all, --changes-only: Show all files, instead of changes only