コード例 #1
0
def helm(helm_repo, ver, dry_run):
    """Publish the Dagster Helm chart

    See: https://medium.com/containerum/how-to-make-and-share-your-own-helm-package-50ae40f6c221
    for more info on this process
    """

    helm_path = os.path.join(git_repo_root(), "python_modules", "libraries", "dagster-k8s", "helm")

    check.invariant(
        get_git_repo_branch(helm_repo) == "gh-pages", "helm repo must be on gh-pages branch"
    )

    cmd = [
        "helm",
        "package",
        "dagster",
        "-d",
        helm_repo,
        "--app-version",
        ver,
        "--version",
        ver,
    ]
    click.echo(click.style("Running command: " + " ".join(cmd) + "\n", fg="green"))
    click.echo(subprocess.check_output(cmd, cwd=helm_path))

    cmd = ["helm", "repo", "index", ".", "--url", "https://dagster-io.github.io/helm/"]
    click.echo(click.style("Running command: " + " ".join(cmd) + "\n", fg="green"))
    click.echo(subprocess.check_output(cmd, cwd=helm_repo))

    # Commit and push Helm updates for this Dagster release
    msg = "Helm release for Dagster release {}".format(ver)
    git_commit_updates(helm_repo, msg)
    git_push(cwd=helm_repo, dry_run=dry_run)
コード例 #2
0
ファイル: cli.py プロジェクト: taljaards/dagster
def helm(chart_path, helm_repo, ver, dry_run):
    """Publish the Dagster Helm chart

    See: https://medium.com/containerum/how-to-make-and-share-your-own-helm-package-50ae40f6c221
    for more info on this process
    """

    helm_path = os.path.join(git_repo_root(), "helm")

    check.invariant(
        get_git_repo_branch(helm_repo) == "gh-pages", "helm repo must be on gh-pages branch"
    )

    cmd = [
        "helm",
        "package",
        chart_path,
        "--dependency-update",
        "--destination",
        helm_repo,
        "--app-version",
        ver,
        "--version",
        ver,
    ]
    click.echo(click.style("Running command: " + " ".join(cmd) + "\n", fg="green"))
    click.echo(subprocess.check_output(cmd, cwd=helm_path))

    cmd = [
        "helm",
        "repo",
        "index",
        ".",
        "--merge",
        "index.yaml",
        "--url",
        "https://dagster-io.github.io/helm/",
    ]
    click.echo(click.style("Running command: " + " ".join(cmd) + "\n", fg="green"))
    click.echo(subprocess.check_output(cmd, cwd=helm_repo))

    # Commit and push Helm updates for this Dagster release
    chart_name = os.path.basename(os.path.normpath(chart_path))
    msg = f"Helm release for {chart_name} release {ver}"
    git_commit_updates(helm_repo, msg)
    git_push(cwd=helm_repo, dry_run=dry_run)
コード例 #3
0
ファイル: cli.py プロジェクト: wingyplus/dagster
def helm(helm_repo, ver, dry_run):
    '''Publish the Dagster Helm chart

    See: https://medium.com/containerum/how-to-make-and-share-your-own-helm-package-50ae40f6c221
    for more info on this process
    '''

    helm_path = os.path.join(git_repo_root(), 'python_modules', 'libraries',
                             'dagster-k8s', 'helm')

    check.invariant(
        get_git_repo_branch(helm_repo) == 'gh-pages',
        'helm repo must be on gh-pages branch')

    cmd = [
        'helm',
        'package',
        'dagster',
        '-d',
        helm_repo,
        '--app-version',
        ver,
        '--version',
        ver,
    ]
    click.echo(
        click.style('Running command: ' + ' '.join(cmd) + '\n', fg='green'))
    click.echo(subprocess.check_output(cmd, cwd=helm_path))

    cmd = [
        'helm', 'repo', 'index', '.', '--url',
        'https://dagster-io.github.io/helm/'
    ]
    click.echo(
        click.style('Running command: ' + ' '.join(cmd) + '\n', fg='green'))
    click.echo(subprocess.check_output(cmd, cwd=helm_repo))

    # Commit and push Helm updates for this Dagster release
    msg = 'Helm release for Dagster release {}'.format(ver)
    git_commit_updates(helm_repo, msg)
    git_push(cwd=helm_repo, dry_run=dry_run)
コード例 #4
0
ファイル: cli.py プロジェクト: danieldiamond/dagster
def publish(nightly, autoclean, dry_run):
    '''Publishes (uploads) all submodules to PyPI.

    Appropriate credentials must be available to twine, e.g. in a ~/.pypirc file, and users must
    be permissioned as maintainers on the PyPI projects. Publishing will fail if versions (git
    tags and Python versions) are not in lockstep, if the current commit is not tagged, or if
    there are untracked changes.
    '''
    assert os.getenv('SLACK_RELEASE_BOT_TOKEN'
                     ), 'No SLACK_RELEASE_BOT_TOKEN env variable found.'

    try:
        RCParser.from_file()
    except ConfigFileError:
        raise ConfigFileError(PYPIRC_EXCEPTION_MESSAGE)

    assert '\nwheel' in subprocess.check_output([
        'pip', 'list'
    ]).decode('utf-8'), (
        'You must have wheel installed in order to build packages for release -- run '
        '`pip install wheel`.')

    assert which_('twine'), (
        'You must have twine installed in order to upload packages to PyPI -- run '
        '`pip install twine`.')

    assert which_('yarn'), (
        'You must have yarn installed in order to build dagit for release -- see '
        'https://yarnpkg.com/lang/en/docs/install/')
    dmp = DagsterModulePublisher()

    checked_version = dmp.check_versions(nightly=nightly)
    if not nightly:
        click.echo('... and match git tag on most recent commit...')
        git_check_status()
    click.echo('... and that there is no cruft present...')
    dmp.check_for_cruft(autoclean)
    click.echo('... and that the directories look like we expect')
    dmp.check_directory_structure()

    click.echo('Publishing packages to PyPI...')

    if nightly:
        new_nightly_version = dmp.set_version_info(
            dry_run=dry_run)['__nightly__']
        dmp.commit_new_version(
            'nightly: {nightly}'.format(nightly=new_nightly_version),
            dry_run=dry_run)
        tag = set_git_tag('nightly-{ver}'.format(ver=new_nightly_version),
                          dry_run=dry_run)
        git_push(dry_run=dry_run)
        git_push(tag, dry_run=dry_run)

    dmp.publish_all(nightly, dry_run=dry_run)

    if not nightly:
        parsed_version = packaging.version.parse(
            checked_version['__version__'])
        if not parsed_version.is_prerelease and not dry_run:
            slack_client = slackclient.SlackClient(
                os.environ['SLACK_RELEASE_BOT_TOKEN'])
            slack_client.api_call(
                'chat.postMessage',
                channel='#general',
                text=('{git_user} just published a new version: {version}.'
                      ).format(git_user=git_user(),
                               version=checked_version['__version__']),
            )