Promote artifact version to dest.

        Args:
            promote_stage (string): Stage that is being promoted
775627
def promote_artifacts(self, promote_stage='latest'):
        
        if promote_stage.lower() == 'alpha':
            self._sync_to_uri(self.s3_canary_uri)
        elif promote_stage.lower() == 'canary':
            self._sync_to_uri(self.s3_latest_uri)
        else:
            self._sync_to_uri(self.s3_latest_uri)
226363
function updateManifest() {
  const {stdout: branch} = exec(`git rev-parse --abbrev-ref HEAD`)

  if (!branch.includes("release")) {
    return;
  }

  console.log("[copy-assets] update assets manifest");

  const last = lastRelease();
  exec(`git cat-file -p ${last}:assets/module-manifest.json > assets/module-manifest.json`);
}
533947
def publish(ctx, test=False, force=False, draft=False):
    

    previous_version = get_previous_version(ctx)
    current_version = parver.Version.parse(metadata["version"])

    if current_version <= previous_version and not force:
        error_message = (
            f"current version ({current_version!s}) is <= to previous version "
            f"({previous_version!s}), use 'package.version' to update current version"
        )
        report.error(ctx, "publish", error_message)
        raise ValueError(error_message)

    report.info(ctx, "publish", f"publishing project {ctx.metadata['name']!r}")
    report.warning(
        ctx,
        "publish",
        f"drafting publish for project {ctx.metadata['name']!r} (has no effect)",
    )

    commit_message = f"Release {current_version!s}"
    report.info(ctx, "publish", f"git commiting release {commit_message!r}")
    git_commit_command = f"git commit -asm {commit_message!r}"
    if not draft:
        ctx.run(git_commit_command)

    tag_content = get_tag_content(ctx).replace('"', '\\"')
    git_tag_command = (
        f'git tag -a "v{current_version!s}" -m '
        f'"Version {current_version!s}\n\n{tag_content}"'
    )
    report.info(
        ctx, "publish", f"git tagging commit as release for version {current_version!s}"
    )
    if not draft:
        ctx.run(git_tag_command)

    artifact_paths = [f"{_.as_posix()!r}" for _ in get_artifact_paths(ctx)]
    for artifact_path in artifact_paths:
        report.debug(ctx, "publish", f"publishing artifact {artifact_path}")
    publish_command = f"twine upload {' '.join(artifact_paths)}"
    if test:
        publish_command += " --repository 'https://test.pypi.org/legacy/'"

    # get user to confirm publish
    try:
        input(
            report._get_text(
                ctx,
                "success",
                "publish",
                "about to publish, [Enter] to continue, [Ctrl-C] to abort: ",
            )
        )

        while True:
            (username, password) = get_username_password(
                ctx, "PyPi Username: ", "PyPi Password: "
            )
            # TODO: check if username and password are valid before tyring to post
            report.info(ctx, "publish", f"publishing project {ctx.metadata['name']!s}")
            if not draft:
                publish_command += f" -u {username!r} -p {password!r}"
                publish_result = ctx.run(publish_command, warn=True)
                if publish_result.exited:
                    report.error(
                        ctx,
                        "publish",
                        f"failed to publish {ctx.metadata['name']!s} (retrying)",
                    )
                    continue
            break

        git_push_command = "git push --tags"
        report.info(ctx, "publish", f"pushing git tags")
        if not draft:
            ctx.run(git_push_command)
    except KeyboardInterrupt:
        print()
        report.error(ctx, "publish", "aborting publish!")
        git_remove_tag_command = f"git tag -d {current_version!s}"
        report.warn(ctx, "publish", "removing git tags")
        if not draft:
            ctx.run(git_remove_tag_command)
        git_reset_command = f"git reset --soft HEAD^"
        report.warn(ctx, "publish", "softly reseting commit")
        if not draft:
            ctx.run(git_reset_command)
1245731
def update_metadata(ctx, archive_name):
    '''
    
    '''

    _generate_api(ctx)
    args, kwargs = _parse_args_and_kwargs(ctx.args)
    assert len(args) == 0, 'Unrecognized arguments: "{}"'.format(args)

    var = ctx.obj.api.get_archive(archive_name)

    var.update_metadata(metadata=kwargs)
1156511
def update(
        ctx,
        archive_name,
        bumpversion='patch',
        prerelease=None,
        dependency=None,
        message=None,
        string=False,
        file=None):
    '''
    
    '''

    _generate_api(ctx)

    args, kwargs = _parse_args_and_kwargs(ctx.args)
    assert len(args) == 0, 'Unrecognized arguments: "{}"'.format(args)

    dependencies_dict = _parse_dependencies(dependency)

    var = ctx.obj.api.get_archive(archive_name)
    latest_version = var.get_latest_version()

    if string:

        with var.open(
                'w+',
                bumpversion=bumpversion,
                prerelease=prerelease,
                dependencies=dependencies_dict,
                metadata=kwargs,
                message=message) as f:

            if file is None:
                for line in sys.stdin:
                    f.write(u(line))
            else:
                f.write(u(file))

    else:
        if file is None:
            file = click.prompt('enter filepath')

        var.update(
            file,
            bumpversion=bumpversion,
            prerelease=prerelease,
            dependencies=dependencies_dict,
            metadata=kwargs,
            message=message)

    new_version = var.get_latest_version()

    if latest_version is None and new_version is not None:
        bumpmsg = ' new version {} created.'.format(
            new_version)

    elif new_version != latest_version:
        bumpmsg = ' version bumped {} --> {}.'.format(
            latest_version, new_version)

    elif var.versioned:
        bumpmsg = ' version remains {}.'.format(latest_version)
    else:
        bumpmsg = ''

    click.echo('uploaded data to {}.{}'.format(var, bumpmsg))
394420
def workflow_update_stage_executable(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/updateStageExecutable' % object_id, input_params, always_retry=always_retry, **kwargs)
759232
def artifact(name, version)
      unless artifact?(name, version)
        artifact = Artifact.new(self, name, version)
        @artifacts["#{name}-#{version}"] = artifact
        @artifacts_by_name[name] << artifact
      end

      @artifacts["#{name}-#{version}"]
    end
726280
def workflow_add_stage(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/addStage' % object_id, input_params, always_retry=always_retry, **kwargs)
830007
def set_version(self, version):
        
        self.parser.add_argument(
            "--version",
            action="version",
            version="%(prog)s {} (core {})".format(
                version, devpipeline_core.version.STRING
            ),
        )
697690
def _progress_set_description(self, stage, description):
        
        self.__check_stage_registered(stage)
        self._prog_rep_descriptions[stage] = description
        if self._prog_rep_progressbars[stage]:
            self._prog_rep_progressbars[stage].set_description(description, refresh=False)
783087
def update_stage_config(    self,
                                project_name,
                                stage_name,
                                cloudwatch_log_level,
                                cloudwatch_data_trace,
                                cloudwatch_metrics_enabled
                            ):
        
        if cloudwatch_log_level not in self.cloudwatch_log_levels:
            cloudwatch_log_level = 'OFF'

        for api in self.get_rest_apis(project_name):
            self.apigateway_client.update_stage(
                restApiId=api['id'],
                stageName=stage_name,
                patchOperations=[
                    self.get_patch_op('logging/loglevel', cloudwatch_log_level),
                    self.get_patch_op('logging/dataTrace', cloudwatch_data_trace),
                    self.get_patch_op('metrics/enabled', cloudwatch_metrics_enabled),
                ]
            )
781919
public function stagesDiffer()
    {
        if (func_num_args() > 0) {
            Deprecation::notice('5.0', 'Versioned only has two stages and stagesDiffer no longer requires parameters');
        }
        $id = $this->owner->ID ?: $this->owner->OldID;
        if (!$id || !$this->hasStages()) {
            return false;
        }

        $draftVersion = static::get_versionnumber_by_stage($this->owner, Versioned::DRAFT, $id);
        $liveVersion = static::get_versionnumber_by_stage($this->owner, Versioned::LIVE, $id);
        return $draftVersion !== $liveVersion;
    }
205987
def promote(self, cart_name):
        
        cart = juicer.common.Cart.Cart(cart_name=cart_name, autoload=True, autosync=True)
        old_env = cart.current_env
        cart.current_env = juicer.utils.get_next_environment(cart.current_env)

        # figure out what needs to be done to promote packages. If
        # packages are going between environments that are on the same
        # host and we don't need to sign them just associate with both
        # repos.
        if juicer.utils.env_same_host(old_env, cart.current_env) and (self.connectors[old_env].requires_signature == self.connectors[cart.current_env].requires_signature):
            juicer.utils.Log.log_info("Envs %s and %s exist on the same host, calling remote associate action" % (old_env, cart.current_env))
            juicer.utils.Log.log_info("Promoting %s from %s to %s" %
                    (cart_name, old_env, cart.current_env))
            # iterate through packages and associate to new repo
            for repo, items in cart.iterrepos():
                query = '/repositories/%s-%s/actions/associate/' % (repo, cart.current_env)
                for item in items:
                    source_repo_id = '%s-%s' % (repo, old_env)
                    data = {
                        'source_repo_id': str(source_repo_id),
                        'criteria': {
                            'type_ids': ['rpm'],
                            'filters': {
                                'unit': {
                                    'filename': str(item.path.split('/')[-1])
                                    }
                                }
                            }
                        }
                    _r = self.connectors[cart.current_env].post(query, data)
                    if _r.status_code != Constants.PULP_POST_ACCEPTED:
                        raise JuicerPulpError("Package association call was not accepted. Terminating!")
                    else:
                        # association was accepted so publish destination repo
                        con = self.connectors[cart.current_env]
                        con.post('/repositories/%s-%s/actions/publish/' % (repo, cart.current_env), {'id': 'yum_distributor'})
                        # also update the item's remote path
                        filename = item.path.split('/')[-1]
                        item.update('%s/%s' % (juicer.utils.pulp_repo_path(con, '%s-%s' % (repo, cart.current_env)), filename))
            # we didn't bomb out yet so let the user know what's up
            juicer.utils.Log.log_info("Package association calls were accepted. Trusting that your packages existed in %s" % old_env)
            # we can save and publish here because upload does this too...
            cart.save()
            self.publish(cart)
        else:
            juicer.utils.Log.log_debug("Syncing down rpms...")
            cart.sync_remotes()
            self.sign_cart_for_env_maybe(cart, cart.current_env)

            juicer.utils.Log.log_info("Promoting %s from %s to %s" %
                    (cart_name, old_env, cart.current_env))

            for repo in cart.repos():
                juicer.utils.Log.log_debug("Promoting %s to %s in %s" %
                                           (cart[repo], repo, cart.current_env))
            # reiterating that upload will save and publish the cart
            self.upload(cart.current_env, cart)
895607
def bump_version(ctx, new_version, version_part=None, dry_run=False):
    """"""
    version_part = version_part or "minor"
    if dry_run:
        ctx = DryRunContext(ctx)
    ctx.run("bumpversion --new-version={} {}".format(new_version,
                                                      version_part))
1279721
def bump_version(v: version.Version, level: str) -> str:
    """"""
    release: List[int] = list(v.release)
    stage: Optional[str]
    pre: Optional[int]
    stage, pre = v.pre if v.pre else (None, None)
    dev: Optional[int] = v.dev
    post: Optional[int] = v.post

    if level in ("major", "minor", "patch"):
        segments = 0
        if level == "major":
            # if the version code is in format of x.0.0, and pre/dev is not empty
            # do not increase the version number
            segments = 1
        elif level == "minor":
            # if the version code is in format of x.x.0, and pre/dev is not empty
            # do not increase the version number
            segments = 2
        elif level == "patch":
            # if the version code is in format of x.x.x, and pre/dev is not empty
            # do not increase the version number
            segments = 3
        if not any(release[segments:]) and (stage is not None or dev is not None):
            pass
        else:
            release[segments - 1] += 1
        release[segments:] = [0] * max(len(release) - segments, 0)
        stage = pre = post = dev = None
    elif level == "alpha":
        if stage is None:
            if dev is None:
                release[-1] += 1
            stage, pre = "a", 1
        elif stage > "a":
            release[-1] += 1
            stage, pre = "a", 1
        elif stage == "a":
            pre += 1
        post = dev = None
    elif level == "beta":
        if stage is None:
            if dev is None:
                release[-1] += 1
            stage, pre = "b", 1
        elif stage > "b":
            release[-1] += 1
            stage, pre = "b", 1
        elif stage == "b":
            pre += 1
        elif stage < "b":
            pre = 1
            stage = "b"
        post = dev = None
    elif level == "post":
        if post is not None:
            post += 1
        else:
            post = 1
        dev = None
    elif level == "dev":
        if dev is not None:
            dev += 1
        else:
            if stage:
                pre += 1
            else:
                release[-1] += 1
            dev = 1

    ver = ".".join(str(i) for i in release)
    if stage is not None:
        ver += f"{stage}{pre}"
    if post is not None:
        ver += f".post{post}"
    if dev is not None:
        ver += f".dev{dev}"

    return ver
202074
def _promote(self, name, instantiate=True):
		
		
		metaclass = type(self.__class__)
		contents = self.__dict__.copy()
		cls = metaclass(str(name), (self.__class__, ), contents)
		
		if instantiate:
			return cls()
		
		return cls
121140
public static boolean promoteAndCheckResponse(Promotion promotion, ArtifactoryBuildInfoClient client, TaskListener listener,
                                                  String buildName, String buildNumber) throws IOException {
        // If failFast is true, perform dry run first
        if (promotion.isFailFast()) {
            promotion.setDryRun(true);
            listener.getLogger().println("Performing dry run promotion (no changes are made during dry run) ...");
            HttpResponse dryResponse = client.stageBuild(buildName, buildNumber, promotion);
            try {
                validatePromotionSuccessful(dryResponse, true, promotion.isFailFast(), listener);
            } catch (IOException e) {
                listener.error(e.getMessage());
                return false;
            }
            listener.getLogger().println("Dry run finished successfully.\nPerforming promotion ...");
        }

        // Perform promotion
        promotion.setDryRun(false);
        HttpResponse response = client.stageBuild(buildName, buildNumber, promotion);
        try {
            validatePromotionSuccessful(response, false, promotion.isFailFast(), listener);
        } catch (IOException e) {
            listener.error(e.getMessage());
            return false;
        }
        listener.getLogger().println("Promotion completed successfully!");

        return true;
    }