CI variables

Stored securely in the GitLab server

Injected into jobs at runtime

Available in project-, group- and instance-level

Hands-On

  1. Go to Settings > CI/CD and unfold Variables
  2. Create unprotected variable AUTHOR and set to a value of your choice
  3. Update build command:

     go build \
         -ldflags "-X main.Version=${CI_COMMIT_REF_NAME} -X 'main.Author=${AUTHOR}'" \
         -o hello \
         .