-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
122 lines (115 loc) · 2.93 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
stages:
- lint-angular
- build-angular
- lint-golang
- test
- build-golang
- deploy
lint-angular:
image: library/node:latest
stage: lint-angular
variables:
ANGULAR_DIR: $CI_PROJECT_DIR/angular
script:
- cd $ANGULAR_DIR
- npm install -f
- npm run lint
build-angular:
image: library/node:latest
stage: build-angular
variables:
ANGULAR_DIR: $CI_PROJECT_DIR/angular
script:
- cd $ANGULAR_DIR
- npm install -f
- npm run build
artifacts:
paths:
- $ANGULAR_DIR/dist
lint:
image: library/golang:1.23-alpine
stage: lint-golang
script:
- go vet .
build:
image: library/golang:1.23-alpine
stage: build-golang
script:
- go build -o $CI_PROJECT_DIR/$ARCH/jinya-releases
artifacts:
paths:
- $CI_PROJECT_DIR/$ARCH/jinya-releases
parallel:
matrix:
- ARCH: amd64
- ARCH: arm64
tags:
- runner-${ARCH}
docker-build-test:
stage: deploy
image:
name: gcr.io/kaniko-project/executor:debug
pull_policy: always
entrypoint: [""]
before_script:
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"https://index.docker.io/v1/\":{\"auth\":\"$DOCKER_TOKEN\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor
--context "${CI_PROJECT_DIR}/$ARCH"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--no-push
rules:
- if: $CI_COMMIT_BRANCH
parallel:
matrix:
- ARCH: amd64
- ARCH: arm64
tags:
- runner-${ARCH}
docker-build:
stage: deploy
image:
name: gcr.io/kaniko-project/executor:debug
pull_policy: always
entrypoint: [""]
before_script:
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"https://index.docker.io/v1/\":{\"auth\":\"$DOCKER_TOKEN\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor
--context "${CI_PROJECT_DIR}/$ARCH"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}/${ARCH}:${CI_COMMIT_TAG}"
--destination "${CI_REGISTRY_IMAGE}/${ARCH}:latest"
--destination "jinyacms/jinya-releases:${CI_COMMIT_TAG}"
--destination "jinyacms/jinya-releases:latest"
rules:
- if: $CI_COMMIT_TAG
parallel:
matrix:
- ARCH: amd64
- ARCH: arm64
tags:
- runner-${ARCH}
merge-manifests:
stage: deploy
needs:
- job: docker-build
artifacts: false
image:
name: mplatform/manifest-tool:alpine
entrypoint: [""]
script:
- >-
manifest-tool
--username=${CI_REGISTRY_USER}
--password=${CI_REGISTRY_PASSWORD}
push from-args
--platforms linux/amd64,linux/arm64
--template ${CI_REGISTRY_IMAGE}/ARCH:${TAG}
--target ${CI_REGISTRY_IMAGE}:${TAG}
parallel:
matrix:
- TAG: latest
- TAG: $CI_COMMIT_TAG
rules:
- if: $CI_COMMIT_TAG