Skip to main content

Wraps Docker to run with GitLab build variables

Project description

Build Status codecov.io PyPI version

Docker With GitLab Secrets

Wraps Docker to run with GitLab build variables.

Installation

Prerequisites: - Python >= 3.6 - docker

Stable releases can be installed via PyPI:

$ pip3 install dockerwithgitlabsecrets

Bleeding edge versions can be installed directly from GitHub:

$ pip3 install git+https://github.com/wtsi-hgi/docker-with-gitlab-secrets.git@commit_id_or_branch_or_tag#egg=dockerwithgitlabsecrets

Usage

Wrap your prefixed Docker command with:

usage: docker-with-gitlab-secrets [-h] [--dwgs-config DWGS_CONFIG]
                                  [--dwgs-project DWGS_PROJECT]
                                  [--env-file ENV_FILE]

Docker With GitLab Secrets

optional arguments:
  -h, --help            show this help message and exit
  --dwgs-config DWGS_CONFIG
                        location of the configuration file (will default to
                        /root/.dwgs-config.yml)
  --dwgs-project DWGS_PROJECT
                        GitLab project (if not namespaced in the form
                        "namespace/project", the default namespace defined in
                        the configuration file will be used). If not defined,
                        the default project in the configuration file will be
                        used
  --env-file ENV_FILE   Docker argument in which this program wants to know
                        about - see: https://docs.docker.com/engine/reference/
                        commandline/run/#set-environment-variables--e---env---
                        env-file

Examples

Run a new container with secrets from a GitLab project:

docker-with-gitlab-secrets --dwgs-config my-config.yml --dwgs-project my-project \
    run --rm alpine printenv GITLAB_SECRET

Wrapping unrelated Docker commands will still work:

docker-with-gitlab-secrets --dwgs-config my-config.yml \
    version

Configuration

Example:

gitlab:
  url: https://gitlab.example.com
  token: my-token
  project: hgi-systems  # Optional default project, which will be overriden by if `dwgs-project` is specified
  namespace: hgi        # Optional default namespace

Known Issues

  • Interactive ``run`` commands are not yet supported. You can work around this for the time being by running a container with the wrapper non-interactively and then connecting to it without the wrapper using docker exec.

  • Docker cannot pass newlines in variables via `–env-file`` <https://github.com/moby/moby/issues/12997>`__. Therefore multiline GitLab variables with have their line-breaks escaped to \n.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dockerwithgitlabsecrets-0.1.2.tar.gz (7.7 kB view details)

Uploaded Source

File details

Details for the file dockerwithgitlabsecrets-0.1.2.tar.gz.

File metadata

File hashes

Hashes for dockerwithgitlabsecrets-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b202f437305e5c11ad0b7ef8d89e5e671dfd745f8ebe1114d64764eb29876ae8
MD5 90a9377fdb33e4c18576e74e3f175567
BLAKE2b-256 fe8da6febf35e592b245501064d1da1331cae70f3a5e21fbbfd14552f4df765a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page