forked from MickMake/GoSungrow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
52 lines (48 loc) · 2.14 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
47
48
49
50
51
52
stages:
- build
- release
- cleanup
variables:
CONTAINER_TEST_IMAGE: mickmake.io/docker/gosungro/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHORT_SHA
CONTAINER_RELEASE_IMAGE: mickmake.io/docker/gosungro:latest
GO_REPO_TOKEN: $GO_REPO_TOKEN
SUNGRO_HOST: $SUNGRO_HOST
SUNGRO_USER: $SUNGRO_USER
SUNGRO_PASSWORD: $SUNGRO_PASSWORD
SUNGRO_ID: $SUNGRO_ID
SUNGRO_SECRET: $SUNGRO_SECRET
SUNGRO_GIT_REPO: $SUNGRO_GIT_REPO
SUNGRO_GIT_DIR: $SUNGRO_GIT_DIR
SUNGRO_GIT_TOKEN: $SUNGRO_GIT_TOKEN
SUNGRO_DIFF_CMD: $SUNGRO_DIFF_CMD
TZ: $TZ
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
# This relies on GOOGLE_APPLICATION_CREDENTIALS being set and pointing to the Google Service Account JSON file
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CONTAINER_TEST_IMAGE --cache=true --build-arg "GO_REPO_TOKEN=${GO_REPO_TOKEN}" --build-arg "GO_REPO_TOKEN=${GO_REPO_TOKEN}" --build-arg "SUNGRO_HOST=${SUNGRO_HOST}" --build-arg "SUNGRO_USER=${SUNGRO_USER}" --build-arg "SUNGRO_PASSWORD=${SUNGRO_PASSWORD}" --build-arg "SUNGRO_ID=${SUNGRO_ID}" --build-arg "SUNGRO_SECRET=${SUNGRO_SECRET}" --build-arg "SUNGRO_GIT_REPO=${SUNGRO_GIT_REPO}" --build-arg "SUNGRO_GIT_DIR=${SUNGRO_GIT_DIR}" --build-arg "SUNGRO_GIT_TOKEN=${SUNGRO_GIT_TOKEN}" --build-arg "SUNGRO_DIFF_CMD=${SUNGRO_DIFF_CMD}" --build-arg "TZ=${TZ}"
release-image-master:
stage: release
needs:
- build
image:
name: gcr.io/go-containerregistry/gcrane:debug
entrypoint: [""]
# This relies on GOOGLE_APPLICATION_CREDENTIALS being set and pointing to the Google Service Account JSON file
script:
- gcrane cp $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
only:
- master
variables:
GIT_STRATEGY: none
#cleanup_temp_tag:
# stage: cleanup
# image: google/cloud-sdk
# when: always
# script:
# # This relies on GOOGLE_APPLICATION_CREDENTIALS being set and pointing to the Google Service Account JSON file
# # Untag the test image we created (but don't delete, as it's likely to be tagged with a latest tag too)
# - gcloud container images untag $CONTAINER_TEST_IMAGE