Add a Git token to Velocity

Git tokens, which are often stored in the developer's local environment, then need to be included as a build argument by referencing the relevant variable. For example, the following Dockerfile demonstrates the required GH_TOKEN and GH_USERNAME build arguments that are included:

FROM base_image:example

# Set environment variables for Git token and username
# Pass the token in a Git Clone operation
RUN git clone https://${GH_USERNAME}:${GH_TOKEN} /app

Build arguments values for Velocity can be input as the value itself or as an environment variable and then resolved at runtime (e.g $MY_GH_TOKEN)

Your Git token is never passed to Velocity, as it remains only in your local machine, and in your Kubernetes cluster during a Velocity build.

To do this, pass the GH_TOKEN and GH_USERNAMEsimilar to the following:

See Add or override environment variablesfor more information.

Last updated