forked from F5Networks/f5-declarative-onboarding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
188 lines (177 loc) · 5.76 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
image: node:8
stages:
- test
- build
- functional test
- post build
- publish
test:
stage: test
tags:
- docker-executor
script:
- npm install
- npm run lint
- npm test
build rpm:
image: node:8-alpine
stage: build
except:
- tags
tags:
- docker-executor
script:
- apk add rpm bash
- build/buildRpm.sh
artifacts:
name: ${CI_PROJECT_NAME}-${CI_JOB_NAME}-${CI_PIPELINE_IID}
paths:
- build/rpmbuild/RPMS/noarch/
expire_in: 1 week
functional test:
image: centos
stage: functional test
tags:
- docker-executor
only:
- schedules
dependencies:
- build rpm
script:
- export RPM_PACKAGE=$(ls build/rpmbuild/RPMS/noarch/*.rpm)
- 'curl -H "Authorization: Bearer ${ARTIFACTORY_AUTO_VIO_TOKEN}" -X GET "${ARTIFACTORY_BASE_URL}/cloudsolutions/auto-vio/${AUTO_VIO_RPM}" -o "${AUTO_VIO_RPM}"'
- curl -sL https://rpm.nodesource.com/setup_8.x | bash -
- yum install -y nodejs
- yum install -y "${AUTO_VIO_RPM}"
- npm install
- npm run functional
build asg:
image: docker:latest
stage: post build
except:
- tags
- schedules
tags:
- docker-executor
dependencies:
- build rpm
script:
- IMAGE_NAME=f5-do-container
- ORGANIZATION_NAME=f5devcentral
- TARGET=$(ls build/rpmbuild/RPMS/noarch/*.rpm)
# TAG is VERSION-RELEASE. Use awk to remove everything else
- IMAGE_TAG=$(echo $(basename $TARGET) | awk -F- -v PROJECT_NAME=${CI_PROJECT_NAME}- '{sub(PROJECT_NAME, ""); sub(".noarch.rpm", ""); print}')
- if [[ ${CI_COMMIT_REF_NAME} == 'master' ]]; then
- IMAGE_TAG=$(echo $IMAGE_TAG | grep -o "^[^-]\+")
- elif [[ ${CI_COMMIT_REF_NAME} != 'develop' ]]; then
- IMAGE_TAG=$CI_COMMIT_REF_NAME
- fi
- docker build -f build/Dockerfile.asg -t ${ORGANIZATION_NAME}/${IMAGE_NAME}:${IMAGE_TAG} --build-arg TARGET=$TARGET .
- docker save ${ORGANIZATION_NAME}/${IMAGE_NAME}:${IMAGE_TAG} | gzip -c > dist/${ORGANIZATION_NAME}-${IMAGE_NAME}-${IMAGE_TAG}.tar.gz
artifacts:
name: ${CI_PROJECT_NAME}-${CI_JOB_NAME}-${CI_PIPELINE_IID}
paths:
- dist/*.tar.gz
expire_in: 1 week
create postman collection:
stage: post build
except:
- tags
- schedules
tags:
- docker-executor
script:
- node build/generatePostmanCollection.js
artifacts:
name: ${CI_PROJECT_NAME}-${CI_JOB_NAME}-${CI_PIPELINE_IID}
paths:
- dist/do.examples.collection.json
expire_in: 1 week
publish to artifactory:
stage: publish
only:
- tags
tags:
- docker-executor
script:
- RPM_FILE=$(ls dist/*.rpm)
- RPM_NAME=$(basename $RPM_FILE)
- >-
UPLOAD_RESULT=$(curl -H "Authorization: Bearer ${ARTIFACTORY_BEARER_TOKEN}" -X PUT --data-binary @${RPM_NAME}
${ARTIFACTORY_BASE_URL}/f5-declarative-onboarding-rpm/${RPM_NAME})
- echo $UPLOAD_RESULT
- if [[ "$UPLOAD_RESULT" == *errors* ]]; then echo error during upload; exit 1; fi
create docs:
image: ${CONTAINTHEDOCS_IMAGE}
stage: post build
except:
- tags
- schedules
script:
- make html
- echo "Checking grammar and style"
# Runs the grammar check on everything except the /docs/drafts directory
- vale --glob='*.rst' .
- echo "Checking links"
- make linkcheck
tags:
- cm-official-docker-executor
artifacts:
expire_in: 1 week
name: sphinx-docs_$CI_COMMIT_SHA
paths:
- docs/_build/html
# Deploy docs to Pages for review
# Docs are staged on this projects pages site
pages:
stage: publish
environment:
name: review
url: https://${CI_PROJECT_NAMESPACE}.${PAGES_DOMAIN}/${CI_PROJECT_NAME}/
tags:
- cm-official-docker-executor
dependencies:
- create docs
script:
- mkdir -p ./public
- cp -R docs/_build/html/* ./public
artifacts:
paths:
- public
only:
- branches
publish docs to staging:
image: ${CONTAINTHEDOCS_IMAGE}
stage: publish
environment:
name: staging
url: https://clouddocs.f5networks.net/products/extensions/f5-declarative-onboarding/latest
tags:
- cm-official-docker-executor
only:
- doc-staging@cloudsolutions/f5-declarative-onboarding
dependencies:
- create docs
script:
- aws s3 sync docs/_build/html s3://clouddocs.f5networks.net/products/extensions/f5-declarative-onboarding/latest
# create invalidation to clear cloudfront cache
- aws cloudfront create-invalidation --distribution-id $AWS_DIST --paths /products/extensions/f5-declarative-onboarding/latest/
publish docs to production:
image: ${CONTAINTHEDOCS_IMAGE}
stage: publish
environment:
name: production
url: https://clouddocs.f5.com/products/extensions/f5-declarative-onboarding/latest
only:
# Currently will only deploy to clouddocs.f5.com on commits to doc-publish
# fill in desired release branch name and uncomment to add deployment from a branch
- doc-publish@cloudsolutions/f5-declarative-onboarding
tags:
- cm-official-docker-executor
dependencies:
- create docs
script:
# Publish docs to clouddocs.f5.com (live site).
- publish-product-docs-to-prod extensions/f5-declarative-onboarding/latest
# create invalidation to clear cloudfront cache
- aws cloudfront create-invalidation --distribution-id $AWS_DIST --paths /products/extensions/f5-declarative-onboarding