Skip to content

Instantly share code, notes, and snippets.

@AndrewFarley
Created January 4, 2023 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewFarley/694701ce1399e44e5b6f3e3bbf385d1b to your computer and use it in GitHub Desktop.
Save AndrewFarley/694701ce1399e44e5b6f3e3bbf385d1b to your computer and use it in GitHub Desktop.
Gitlab CI Template example
# Include our pre-engineered Gitlab-CI Templates
include:
# This is our global base and templates, always should be included together
- project: 'devops/gitlab-ci-templates'
ref: master
file: '/base.yml'
- project: 'devops/gitlab-ci-templates'
ref: master
file: '/global-templates.yml'
- project: 'devops/gitlab-ci-templates'
ref: master
file: '/add-other-templates-if-you-need-but-their-order-matters.yml'
# This builds our Docker image from a template
build-docker:
extends: .build-and-publish-via-docker # <-- You create this hidden job in your templates repo
variables:
DOCKER_ARGS: --build-arg BUILD_FOR_ENVIRONMENT=production
# This deploys via a template to Kubernetes
deploy:
extends: .deploy-to-dev # <-- You create this hidden job in your templates repo
@tmeijn
Copy link

tmeijn commented Jan 5, 2023

Nice! FYI include.file also supports an array of files so you only could reference the project once.

@AndrewFarley
Copy link
Author

@tmeijn Neat, I didn't know that, will save us some space! Must be a newer addition or something I overlooked when I first started doing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment