Skip to content
Commits on Source (8)
# gitlab-ci-tools
This project includes reuseable GitLab-CI jobs for the GitLab Dedicated Project
This project includes reuseable GitLab-CI jobs for the GitLab Dedicated Project.
Setting up a new project? Use the [project template](#project-template).
## Developer Setup
......@@ -40,3 +42,9 @@ Alternatively to using the templates above, you can include the following indivi
| [`terraform-format.yml`](./terraform-format.md)| Runs [`terraform fmt`](https://www.terraform.io/cli/commands/fmt) to ensure that all Terraform files are correctly formatted. |
| [`terraform-validate.yml`](./terraform-validate.md) | Runs [`terraform validate`](https://www.terraform.io/cli/commands/validate) to ensure that all Terraform files are valid. |
| [`tflint.yml`](./tflint.md) | Runs [`tflint`](https://github.com/terraform-linters/tflint) across all directories that contain `*.tf` files. |
## Project Template
`common-ci-tasks` favours convention-over-configuration, and expects configuration files and some directories to be configured in a certain way. The quickest way to get going on a new project is to use the `common-template-copier` project template to generate a new project based on the conventions expected by these CI tasks.
Instruction on usage at: <https://gitlab.com/gitlab-com/gl-infra/common-template-copier>.
......@@ -24,6 +24,6 @@ include:
# and that ASDF is generally working
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/asdf-tool-versions.md
- project: 'gitlab-com/gl-infra/common-ci-tasks'
ref: v1.34.1 # renovate:managed
ref: v1.34.2 # renovate:managed
file: asdf-tool-versions.yml
```
validate_asdf_tool_versions:
stage: validate
image:
name: registry.gitlab.com/gitlab-com/gl-infra/common-ci-tasks/renovate:v1.34.1
name: registry.gitlab.com/gitlab-com/gl-infra/common-ci-tasks/renovate:v1.34.2
entrypoint: [""]
needs: []
variables:
......@@ -23,6 +23,12 @@ validate_asdf_tool_versions:
- ./scripts/install-asdf-plugins.sh
- ./scripts/update-asdf-version-variables.sh
- git diff --exit-code
after_script: |
cat <<-EOD
----------------------------------------------------------
Need help? Documentation on the validate_asdf_tool_versions CI job can be found at:
https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/asdf-tool-versions.md
EOD
rules:
# This script can be quite slow (mostly due to the ruby install)
# so we only run it when there have been changes
......
......@@ -25,6 +25,6 @@ include:
# Runs checkov on all terraform module directories
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/checkov.md
- project: 'gitlab-com/gl-infra/common-ci-tasks'
ref: v1.34.1 # renovate:managed
ref: v1.34.2 # renovate:managed
file: checkov.yml
```
......@@ -22,6 +22,12 @@ checkov:
echo "--------------------------------------------------------"
exit 1
}
after_script: |
cat <<-EOD
----------------------------------------------------------
Need help? Documentation on the checkov CI job can be found at:
https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/checkov.md
EOD
artifacts:
when: always
reports:
......
......@@ -13,7 +13,7 @@ include:
# validate .editorconfig
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/editorconfig-check.md
- project: "gitlab-com/gl-infra/common-ci-tasks"
ref: v1.34.1 # renovate:managed
ref: v1.34.2 # renovate:managed
file: "editorconfig-check.yml"
```
......
......@@ -12,7 +12,7 @@ editorconfig_check:
after_script: |
cat <<-EOD
----------------------------------------------------------
Need help? Documentation on this CI job can be found at:
Need help? Documentation on the editorconfig_check CI job can be found at:
https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/editorconfig-check.md
EOD
rules:
......
......@@ -11,6 +11,6 @@ stages:
include:
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/gitlab-scanners.md
- project: 'gitlab-com/gl-infra/common-ci-tasks'
ref: v1.34.1 # renovate:managed
ref: v1.34.2 # renovate:managed
file: 'gitlab-scanners.yml'
```
......@@ -19,7 +19,7 @@ include:
# Perform `go mod tidy` and ensure that go.mod and go.sum are tidy.
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/go-mod-tidy.md
- project: 'gitlab-com/gl-infra/common-ci-tasks'
ref: v1.34.1 # renovate:managed
ref: v1.34.2 # renovate:managed
file: go-mod-tidy.yml
```
## A note on compatibility
......
......@@ -10,6 +10,12 @@ go_mod_tidy:
echo "For more information, visit https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/blob/main/go-mod-tidy.md"
exit 1;
}
after_script: |
cat <<-EOD
----------------------------------------------------------
Need help? Documentation on the go_mod_tidy CI job can be found at:
https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/go-mod-tidy.md
EOD
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
......
......@@ -20,7 +20,7 @@ include:
# Runs Go unit tests
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/go-unittests.md
- project: 'gitlab-com/gl-infra/common-ci-tasks'
ref: v1.34.1 # renovate:managed
ref: v1.34.2 # renovate:managed
file: go-unittests.yml
```
......
......@@ -10,6 +10,12 @@ go_unittests:
else
echo "all packages excluded, skipping tests...";
fi
after_script: |
cat <<-EOD
----------------------------------------------------------
Need help? Documentation on the go_unittests CI job can be found at:
https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/go-unittests.md
EOD
artifacts:
when: always
reports:
......
......@@ -13,6 +13,6 @@ include:
# Runs golangci-lint on the project.
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/golangci-lint.md
- project: 'gitlab-com/gl-infra/common-ci-tasks'
ref: v1.34.1 # renovate:managed
ref: v1.34.2 # renovate:managed
file: 'golangci-lint.yml'
```
......@@ -20,6 +20,12 @@ golangci_lint:
golangci-lint run --timeout 5m --out-format code-climate |
tee "gl-code-quality-report.json" |
jq -r '.[] | "\(.location.path):\(.location.lines.begin) \(.description)"'
after_script: |
cat <<-EOD
----------------------------------------------------------
Need help? Documentation on the golangci_lint CI job can be found at:
https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/golangci-lint.md
EOD
artifacts:
reports:
codequality: gl-code-quality-report.json
......
......@@ -78,6 +78,6 @@ include:
# build binary release artifacts with goreleaser
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/goreleaser.md
- project: 'gitlab-com/gl-infra/common-ci-tasks'
ref: v1.34.1 # renovate:managed
ref: v1.34.2 # renovate:managed
file: goreleaser.yml
```
......@@ -8,6 +8,12 @@ goreleaser_validate:
name: goreleaser/goreleaser:v${GL_ASDF_GORELEASER_VERSION}
entrypoint: [""]
script: goreleaser check
after_script: |
cat <<-EOD
----------------------------------------------------------
Need help? Documentation on the goreleaser_validate CI job can be found at:
https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/goreleaser.md
EOD
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
exists:
......@@ -44,7 +50,12 @@ goreleaser:
-e GITLAB_TOKEN -e CI_REGISTRY_IMAGE \
-e CI_SERVER_URL \
goreleaser/goreleaser:v${GL_ASDF_GORELEASER_VERSION} release --rm-dist
after_script: |
cat <<-EOD
----------------------------------------------------------
Need help? Documentation on the goreleaser CI job can be found at:
https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/goreleaser.md
EOD
# Automatically retry on any system blips
retry:
max: 2
......
......@@ -8,7 +8,7 @@ include:
# Includes a base template for running kaniko easily
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/kaniko.md
- project: 'gitlab-com/gl-infra/common-ci-tasks'
ref: v1.34.1 # renovate:managed
ref: v1.34.2 # renovate:managed
file: 'kaniko.yml'
.container_builds:
......
......@@ -17,6 +17,12 @@
--destination $KANIKO_DESTINATION
$KANIKO_EXTRA_ARGS
--cache
after_script: |
cat <<-EOD
----------------------------------------------------------
Need help? Documentation on the kaniko_base CI job can be found at:
https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/kaniko.md
EOD
cache:
key: ${CI_JOB_NAME}
paths:
......
......@@ -25,7 +25,7 @@ include:
# Upgrades dependencies on a schedule
# see https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/renovate-bot.md
- project: "gitlab-com/gl-infra/common-ci-tasks"
ref: v1.34.1 # renovate:managed
ref: v1.34.2 # renovate:managed
file: renovate-bot.yml
```
......
.base_renovate_bot:
image:
name: registry.gitlab.com/gitlab-com/gl-infra/common-ci-tasks/renovate:v1.34.1
name: registry.gitlab.com/gitlab-com/gl-infra/common-ci-tasks/renovate:v1.34.2
entrypoint: [""]
stage: renovate_bot
variables:
......@@ -23,6 +23,12 @@
ssh-keyscan gitlab.com >> ~/.ssh/known_hosts;
fi
- if [[ -n "${GL_ASDF_LEGACY_VERSIONS_FILE}" ]]; then echo "legacy_version_file = yes" >> ~/.asdfrc; fi
after_script: |
cat <<-EOD
----------------------------------------------------------
Need help? Documentation on this CI job can be found at:
https://gitlab.com/gitlab-com/gl-infra/common-ci-tasks/-/blob/main/renovate-bot.md
EOD
# Automatically retry on any system blips
retry:
max: 2
......