This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
/
.gitlab-ci.yml
83 lines (78 loc) · 2.01 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
# protect vault token
before_script:
- unset VAULT_TOKEN VAULT_ADDR
# run test on golang code
test::tarmak::golang:
stage: test
tags:
- docker
image: golang:1.11.11
script:
- rm -rf /go/src/github.com/jetstack
- mkdir -p /go/src/github.com/jetstack
- mv ${CI_PROJECT_DIR} /go/src/github.com/jetstack
- cd /go/src/github.com/jetstack/tarmak
- make all
- mv /go/src/github.com/jetstack/tarmak ${CI_PROJECT_DIR}
# generate sphinx documentation
generate::docs:
stage: test
tags:
- docker
image: python:3
script:
- apt-get update
- apt-get install -y python-enchant wbritish
- pip install virtualenv
- make -C docs spelling
- make -C docs linkcheck
- make -C docs html
artifacts:
paths:
- docs/_build/html
expire_in: 4 weeks
release::tarmak::aws_ami_image_centos:
stage: release
variables:
AWS_DEFAULT_REGION: eu-west-1
image: hashicorp/packer:1.3.3
before_script:
- apk --update add jq curl
# connect to vault and get a time limited token
- |
eval $(
curl \
--fail \
--header "X-Vault-Token: $VAULT_TOKEN" \
--request POST \
--data '{"ttl": "1h"}' \
"${VAULT_ADDR}/v1/jetstack/aws/jetstack/sts/tarmak-images-packer-build" \
| jq -r ' .data | "export AWS_ACCESS_KEY_ID=\(.access_key) && export AWS_SECRET_ACCESS_KEY=\(.secret_key) && export AWS_SESSION_TOKEN=\(.security_token)"')
- unset VAULT_TOKEN VAULT_ADDR
tags:
- docker
only:
- tags
script:
- hack/release-tarmak-packer-image.sh
release::tarmak::golang:
stage: release
tags:
- docker
image: golang:1.11.11
only:
- tags
script:
- umask 0077
- mkdir -p /root/.gnupg
- echo "${GPG_PRIVATE_KEY}" | base64 -d > /root/.gnupg/secring.gpg
- rm -rf /go/src/github.com/jetstack
- mkdir -p /go/src/github.com/jetstack
- mv ${CI_PROJECT_DIR} /go/src/github.com/jetstack
- cd /go/src/github.com/jetstack/tarmak
- make release
- mv /go/src/github.com/jetstack/tarmak ${CI_PROJECT_DIR}
stages:
- test
- acceptance
- release