def publish_to_pypi(self):
     """Uses `twine` to upload to PyPi"""
     if get_tag():
         credentials = ArtifactStore(
             vault_name=self.vault_name,
             vault_client=self.vault_client).store_settings(self.config)
         upload(upload_settings=credentials, dists=["dist/*"])
     else:
         logging.info(
             "Not on a release tag, not publishing artifact on PyPi.")
Exemple #2
0
def deploy_env_logic(config: dict) -> ApplicationVersion:
    branch = BranchName(config).get()
    tag = get_tag()

    if tag:
        return ApplicationVersion("PRD", str(tag), branch)
    elif branch == "master":
        return ApplicationVersion("ACP", "SNAPSHOT", branch)
    else:
        logger.info("Not deploying feature branches")
        exit(0)
Exemple #3
0
def deploy_env_logic(config: dict) -> ApplicationVersion:
    """Returns the version of this application based on provided Takeoff config.

    Args:
        config: Schiphol takeoff configuration

    Returns:
        Information about the version of the application and to which environment it should be deployed
    """
    branch = BranchName(config=config).get()
    tag = get_tag()
    git_hash = get_short_hash()

    if tag:
        return ApplicationVersion("PRD", str(tag), branch)
    elif branch == "master":
        return ApplicationVersion("ACP", "SNAPSHOT", branch)
    else:
        return ApplicationVersion("DEV", git_hash, branch)
    def publish_to_ivy(self):
        """Uses `sbt` to upload to Ivy.

        The jar will be build as a result of calling `sbt publish`. This means a prebuilt
        artifact is NOT required to publish to Ivy. This will be a lean jar, containing
        only project code, no dependencies.

        This uses bash to run commands directly.

        Raises:
           ChildProcessError is the bash command was not successful
        """
        version = self.env.artifact_tag
        postfix = "-SNAPSHOT" if not get_tag() else ""
        cmd = ["sbt", f'set version := "{version}{postfix}"', "publish"]
        return_code, _ = run_shell_command(cmd)

        if return_code != 0:
            raise ChildProcessError(
                "Could not publish the package for some reason!")
 def on_release_tag(self):
     tag = get_tag()
     return tag is not None