Skip to content

Latest commit

 

History

History
72 lines (51 loc) · 3.34 KB

configuring_artifact_repositories.md

File metadata and controls

72 lines (51 loc) · 3.34 KB

Configuring (private) artifact repositories

Before publishing your package, don't forget to increase its version! Use one of the following commands to do so:

task bump-version-major  # Increases the X in x.y.z
task bump-version-minor  # Increases the Y in x.y.z
task bump-version-patch  # Increases the Z in x.y.z

Publishing packages to Pypi

In order to publish to Pypi.org, either:

You can then use the command below to publish your package to Pypi:

task publish-package-pypi

Google Artifact Registry

A robust method of authenticating with Google Artifact Registry, is to download a Service Account's key. To obtain such a key, follow the instructions at this google documentation page.

If you are using this method, then the value of GCP_ARTIFACT_USER will be _json_key_base64 and the valye of GCP_ARTIFACT_PASSWORD will be a long-ass string. These values should be used in the commands below and/or set in the /{{cookiecutter.project_repository_name}}.env file.

Installing from Google Artifact Registry

If you're using a private Google Artifact Registry, be sure to add the following snippet to pyproject.toml, e.g. directly after the dependency specifications. Be sure to replace <GCP_ARTIFACT_URL> with the correct URL.

[[tool.poetry.source]]
name = "google_artifact"
url = "<GCP_ARTIFACT_URL>"

You will also need to execute the commands below, where the variables should either be loaded (sourced) into your shell or replaced with their corresponding values before executing the commands:

poetry config repositories.google_artifact $GCP_ARTIFACT_URL
poetry config http-basic.google_artifact $GCP_ARTIFACT_USER $GCP_ARTIFACT_PASSWORD

You should then be able to install your private package using poetry add <package_name> like you would install any public packages.

Publishing packages to Google Artifacts

In order to publish to Google Artifacts, either:

You can then use the command below to publish your package to Google Artifacts:

task publish-package-google-artifacts

Installing packages from Google Artifacts in Docker

If you're building a Docker image that needs access to Google Artifact Registry, you need to:

  • Ensure authentication to Google Artifact is setup by either:

  • Uncomment the relevant commented parts in the Dockerfiles in /docker

  • Change the build tasks located in /taskfiles/docker_tasks.yml, and the various versions of this file, to use the relevant commented lines instead of the default line.

After doing this, you can execute one of the tasks to build a docker image, e.g.

task docker:build