-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
79 lines (70 loc) · 1.95 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
---
default:
interruptible: true
stages:
- 'Test'
- 'Build'
- 'Deploy'
'Validate':
image: '${CI_REGISTRY}/nest/tools/pdk'
stage: 'Test'
script:
- 'pdk validate'
'Unit Test':
image: '${CI_REGISTRY}/nest/tools/pdk'
stage: 'Test'
script:
- 'pdk test unit --parallel --verbose'
.template:
stage: 'Build'
variables:
SSH_PRIVATE_KEY: "$NEST_CI_DEPLOY_KEY"
script:
- 'mkdir empty'
- 'podman login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY" <<< $CI_REGISTRY_PASSWORD'
- 'podman build
--build-arg=BRANCH="$CI_COMMIT_BRANCH"
--build-arg=REPOSITORY="$CI_REPOSITORY_URL"
--build-arg=SSH_PRIVATE_KEY
--file=Containerfile
--squash
--tag="${CI_REGISTRY_IMAGE}/${CI_COMMIT_BRANCH}:${CPU}"
empty'
- 'podman push "${CI_REGISTRY_IMAGE}/${CI_COMMIT_BRANCH}:${CPU}"'
rules:
- if: '$BUILD == $CPU'
- if: '$BUILD'
when: never
- when: always
'Build haswell':
extends: .template
tags: ['amd64']
variables:
CPU: 'haswell'
'Build cortex-a53':
extends: .template
tags: ['arm64']
variables:
CPU: 'cortex-a53'
'Build sifive-u74':
extends: .template
tags: ['riscv64']
variables:
CPU: 'sifive-u74'
'Deploy environment':
stage: 'Deploy'
tags: ['r10k']
script:
- 'r10k deploy environment "$CI_COMMIT_BRANCH" --modules --verbose'
'Deploy image':
stage: 'Deploy'
variables:
IMAGE: "${CI_PROJECT_PATH}/${CI_COMMIT_BRANCH}"
script:
- 'podman login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY" <<< $CI_REGISTRY_PASSWORD'
- 'podman manifest exists "$IMAGE" && podman manifest rm "$IMAGE"'
- 'podman manifest create "$IMAGE"'
- 'podman manifest add "$IMAGE" "${CI_REGISTRY}/${IMAGE}:haswell"'
- 'podman manifest add "$IMAGE" "${CI_REGISTRY}/${IMAGE}:cortex-a53"'
- 'podman manifest add "$IMAGE" "${CI_REGISTRY}/${IMAGE}:sifive-u74"'
- 'podman manifest push --all "$IMAGE" "${CI_REGISTRY}/${IMAGE}"'