-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
46 lines (39 loc) · 1.58 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
include:
- project: 'crusoeenergy/tools'
file: '/templates/go.gitlab-ci.yml'
default:
tags:
- gitlab-runner-gcp
variables:
CI_IMAGE: registry.gitlab.com/crusoeenergy/tools/go-ci-1.23
test_and_lint:
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "release"'
changes: !reference [.code-changes, changes]
- if: '$CI_MERGE_REQUEST_ID'
changes: !reference [.code-changes, changes]
# don't run CI for semver tags, do run it for custom tags
- if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG !~ /^(.+\/)?v[0-9]+\.[0-9]+\.[0-9]+$/'
build_and_push:
script:
- |-
if [ "${BUILD_IN_SUBPATH:-true}" == "true" ]; then
cd ${SUBPROJECT_REL_PATH}
fi
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
# Build an image based on the commit ref, this will be available
# internally for testing feature branches and testing pre-release versions
- docker build --no-cache --pull -f "${DOCKERFILE:-./Dockerfile}" --build-arg CI_SERVER_HOST="$CI_SERVER_HOST" --build-arg CI_JOB_TOKEN="$CI_JOB_TOKEN" --build-arg CRUSOE_CSI_DRIVER_NAME="$CRUSOE_CSI_DRIVER_NAME" --build-arg CRUSOE_CSI_DRIVER_VERSION="$CI_COMMIT_REF_NAME" -t $RELEASE_IMAGE:"${CI_COMMIT_REF_NAME##*/}" .
- docker push $RELEASE_IMAGE:"${CI_COMMIT_REF_NAME##*/}"
# Remove the tag_semver and pages jobs from merges into main.
# The tag_semver job will be run using a GitHub action instead
# and new versions will be pushed then.
tag_semver:
rules:
- when: never
code_intelligence:
rules:
- when: never
pages:
rules:
- when: never