-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
137 lines (122 loc) · 4.17 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
137 lines (122 loc) · 4.17 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
image: node:16-bullseye
stages:
- test
- release
variables: &default-vars
GIT_STRATEGY: fetch
DOCKER_USER_NAMESPACE: woss
STAGE: prod
ARCH: 'x86_64'
DOCKER_TLS_CERTDIR: '/certs'
OCI_REGISTRY: 'docker.io'
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- common/temp/
- GIT_REMOTE_CID
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
.install-pnpm: &install-pnpm
before_script:
- |
curl https://ipfs.anagolay.network/ipfs/QmeCUX9cK4YKdTbNVq3jg5cJPvz8uQiQmb4AKKd7niy4kY > /usr/local/bin/pnpm
chmod +x /usr/local/bin/pnpm
node --version
pnpm --version
git --version
.install-ipfs-and-setup-extra-stuff: &install-ipfs-and-setup-extra-stuff
variables:
IPFS_PATH: .ipfs
before_script:
- echo "Downloading the go-ipfs binary v0.12.0 from our IPFS node"
- curl https://ipfs.anagolay.network/ipfs/bafybeih63m5xkkskklntu3ufd6kyjgkvqot4bcre3evquindven7i6yxse > /usr/local/bin/ipfs
- chmod +x /usr/local/bin/ipfs
- mkdir $IPFS_PATH
- echo "/ip4/${ANAGOLAY_MAIN_IPFS_IP}/tcp/${ANAGOLAY_MAIN_IPFS_PORT}" > $IPFS_PATH/api
- ipfs --version
.build-push-oci-image: &build-push-oci-image
image: quay.io/buildah/stable
variables: &oci-build-vars
<<: *default-vars
DOCKERFILE: ./devops/$STAGE/$PRODUCT.Dockerfile
IMAGE_NAME: $OCI_REGISTRY/$DOCKER_USER_NAMESPACE/$PRODUCT
script:
- set -e
- test "$DOCKER_HUB_USER" -a "$DOCKER_HUB_PASS" ||
( echo "no docker credentials provided"; exit 1 )
- buildah bud
--format=docker
--build-arg GIT_LATEST_REVISION="${CI_COMMIT_SHA}"
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--tag "$IMAGE_NAME:$VERSION"
--file "$DOCKERFILE" .
- echo "$DOCKER_HUB_PASS" |
buildah login --username "$DOCKER_HUB_USER" --password-stdin $OCI_REGISTRY
- buildah info
- buildah push --format=v2s2 "$IMAGE_NAME:$VERSION"
after_script:
- buildah logout --all
.build-push-oci-image-with-latest: &build-push-oci-image-with-latest
<<: *build-push-oci-image
script:
- set -e
- test "$DOCKER_HUB_USER" -a "$DOCKER_HUB_PASS" ||
( echo "no docker credentials provided"; exit 1 )
- buildah bud
--format=docker
--build-arg GIT_LATEST_REVISION="${CI_COMMIT_SHA}"
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--tag "$IMAGE_NAME:$VERSION"
--file "$DOCKERFILE" .
- echo "$DOCKER_HUB_PASS" |
buildah login --username "$DOCKER_HUB_USER" --password-stdin $OCI_REGISTRY
- buildah info
- buildah tag "$IMAGE_NAME:$VERSION" "$IMAGE_NAME:latest"
- buildah push --format=v2s2 "$IMAGE_NAME:$VERSION"
- buildah push --format=v2s2 "$IMAGE_NAME:latest"
test-and-build:
stage: test
<<: *install-pnpm
script:
- set -e
- echo 'Installing rush...'
- node common/scripts/install-run-rush.js install
- echo 'Building and testing all packages...'
- node common/scripts/install-run-rush.js rebuild --verbose
upload-to-ipfs:
needs: ['test-and-build']
stage: release
<<: *install-ipfs-and-setup-extra-stuff
script:
- set -e
- echo 'Installing rush...'
- node common/scripts/install-run-rush.js install
- echo 'Building and testing all packages...'
- node common/scripts/install-run-rush.js rebuild --verbose
- echo "Uploading to IPFS ..."
- ipfs add --cid-version=1 --pin=$IPFS_PIN --recursive --quieter ./signer/cli/dist/remote_signer.js > GIT_REMOTE_CID
- echo "The remote-signer is published with the CID $(cat GIT_REMOTE_CID)"
- echo "https://ipfs.anagolay.network/ipfs/$(cat GIT_REMOTE_CID)"
rules:
- if: $CI_COMMIT_MESSAGE =~ /^.*\[build all\].*$/s
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# make a production grade image
remote-signer-server-release:
<<: *build-push-oci-image-with-latest
cache: {}
needs: ['test-and-build']
stage: release
variables:
<<: *oci-build-vars
PRODUCT: remote-signer-server
STAGE: prod
VERSION: $CI_COMMIT_SHORT_SHA
DOCKER_USER_NAMESPACE: woss
services:
- docker:dind
rules:
- if: $CI_COMMIT_MESSAGE =~ /^.*\[build all\].*$/s
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH