forked from Alfresco/alfresco-ansible-deployment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
378 lines (372 loc) · 30.1 KB
/
.travis.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
---
os: linux
dist: xenial
language: python
python:
- "3.9.0"
services:
- docker
branches:
only:
- master
- /feature.*/
- /fix.*/
- /OPSEXP-.*/
before_install:
- pip install ansible==${ANSIBLE_VERSION}
env:
- MOLECULE_NO_LOG=false
stages:
- name: Linters
- name: Verification
- name: Release Stage
if: branch = master AND commit_message =~ /\[release\]/
jobs:
include:
- stage: Linters
name: "ansible-lint"
script:
- ansible-lint -v playbooks/acs.yml
- name: "pylint"
script:
- find . -name "*.py" ! -name __init__.py | xargs pylint
- name: "yamllint"
script:
- yamllint .
- name: Check components version table
scripts:
- python3 scripts/generate-comp-ver-table.py
- git_status_out=$(git status)
- if [[ "$git_status_out" == *"docs/README.md"* ]]; then echo "Error- Components version was not changed. Download pre-commit tool";exit 1; fi
- stage: Verification
name: Search Role Verification
script:
- molecule --version
- cd roles/search/
- molecule converge
- sleep 1m
- molecule verify
- molecule destroy
- stage: Verification
name: Common Role Verification
script:
- cd roles/common/ && molecule test
- stage: Verification
name: Java Role Verification
script:
- cd roles/java/ && molecule test
- stage: Verification
name: Tomcat Role Verification
script:
- cd roles/tomcat/ && molecule test
- stage: Verification
name: ActiveMQ Role Verification
script:
- cd roles/activemq/ && molecule test
- stage: Verification
name: Repository Role Verification
script:
- cd roles/repository/
- molecule converge
- sleep 5m
- travis_wait 30 molecule verify
- molecule destroy
- stage: Verification
name: ADW Role Verification
script:
- cd roles/adw/ && molecule test
- stage: Verification
name: Nginx Role Verification
script:
- cd roles/nginx/ && molecule test
- stage: Verification
name: SFS Role Verification
script:
- cd roles/sfs/ && molecule test
- stage: Verification
name: Trouter Role Verification
script:
- cd roles/trouter
- molecule converge
- sleep 1m
- molecule verify
- molecule destroy
- stage: Verification
name: Transform AIO Verification tests
script:
- cd roles/transformers
- molecule converge
- sleep 1m
- molecule verify
- molecule destroy
- stage: Verification
name: Sync Service Verification tests
script:
- cd roles/sync
- molecule converge
- sleep 1m
- molecule verify
- molecule destroy
- stage: Verification
name: Localhost integration checks (ACS 6.2.2 on CentOS 7)
before_install:
- openssl aes-256-cbc -K $encrypted_6c8b9ee48a27_key -iv $encrypted_6c8b9ee48a27_iv -in alfresco-ansible.pem.enc -out /tmp/dbp-ansible -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/dbp-ansible
- ssh-add /tmp/dbp-ansible
- curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
- unzip awscli-bundle.zip
- ./awscli-bundle/install -b ~/bin/aws
- export PATH=~/bin:$PATH
- export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- export AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- export AWS_DEFAULT_REGION='us-east-1'
- git clone --depth 1 --branch $DTAS_VERSION https://[email protected]/Alfresco/alfresco-deployment-test-automation-scripts.git dtas
script:
- aws ec2 run-instances --image-id ami-0affd4508a5d2481b --count 1 --instance-type t3.large --key-name dbp-ansible --security-group-ids sg-099a05787b0a322c3 --subnet-id subnet-06ffe524598660d99 --tag-specifications "ResourceType=instance,Tags=[{Key=local,Value=machine_no_${TRAVIS_BUILD_NUMBER}},{Key=Creator,Value=${TRAVIS_BUILD_NUMBER}_${TRAVIS_BUILD_NUMBER}},{Key=Owner,Value="Operator\ Experience\ Team"},{Key=Department,Value=Engineering},{Key=Purpose,Value=${TRAVIS_BUILD_NUMBER}_${TRAVIS_BUILD_NUMBER}_local},{Key=NoAutomaticShutdown,Value=false},{Key=Production,Value=False},{Key=Name,Value=molecule_${TRAVIS_BRANCH}_${TRAVIS_BUILD_NUMBER}_local},{Key=instance,Value=${TRAVIS_BRANCH}_${TRAVIS_BUILD_NUMBER}_local}]"
- echo "wait for instance to be up" && sleep 4m
- export PUBLIC_IP=$(aws ec2 describe-instances --filters Name=instance-state-name,Values=running Name=tag-key,Values=local Name=tag-value,Values=machine_no_${TRAVIS_BUILD_NUMBER} --query 'Reservations[*].Instances[*].PublicIpAddress' --output text)
- export INSTANCE_ID=$(aws ec2 describe-instances --filters Name=tag-key,Values=local Name=tag-value,Values=machine_no_${TRAVIS_BUILD_NUMBER} --query 'Reservations[*].Instances[*].InstanceId' --output text)
- ssh-keyscan $PUBLIC_IP >> ~/.ssh/known_hosts
- scripts/generate-zip.sh
- export VERSION=$(cat VERSION)
- scp dist/alfresco-ansible-deployment-${VERSION}.zip centos@${PUBLIC_IP}:/home/centos/
- ssh centos@${PUBLIC_IP} "sudo yum install -y -q unzip python3 python-virtualenv"
- ssh centos@${PUBLIC_IP} "mkdir ~/.pythonvenv && virtualenv -p /usr/bin/python3 ~/.pythonvenv/ansible-${ANSIBLE_VERSION}"
- ssh centos@${PUBLIC_IP} "source ~/.pythonvenv/ansible-${ANSIBLE_VERSION}/bin/activate && pip install --upgrade pip && pip install ansible==${ANSIBLE_VERSION}"
- ssh centos@${PUBLIC_IP} "unzip alfresco-ansible-deployment-${VERSION}.zip"
- scp -r tests centos@${PUBLIC_IP}:/home/centos/alfresco-ansible-deployment-${VERSION}/
- ssh centos@${PUBLIC_IP} "export NEXUS_USERNAME=$NEXUS_USERNAME; export NEXUS_PASSWORD=\"$NEXUS_PASSWORD\"; cd alfresco-ansible-deployment-${VERSION}; source ~/.pythonvenv/ansible-${ANSIBLE_VERSION}/bin/activate && ansible-playbook playbooks/acs.yml -i inventory_local.yml -e \"@6.2.N-extra-vars.yml\""
- sed -i "s+TEST_URL+http://$PUBLIC_IP+g" "tests/test-config-acs6-stack.json"
- cd dtas; pytest --tb=line --configuration ../tests/test-config-acs6-stack.json tests/ -s
- if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[keep env]"* ]]; then aws ec2 terminate-instances --instance-ids $INSTANCE_ID; fi
- stage: Verification
name: Localhost integration checks (ACS 7.1.0 on CentOS 8)
before_install:
- openssl aes-256-cbc -K $encrypted_6c8b9ee48a27_key -iv $encrypted_6c8b9ee48a27_iv -in alfresco-ansible.pem.enc -out /tmp/dbp-ansible -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/dbp-ansible
- ssh-add /tmp/dbp-ansible
- curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
- unzip awscli-bundle.zip
- ./awscli-bundle/install -b ~/bin/aws
- export PATH=~/bin:$PATH
- export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- export AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- export AWS_DEFAULT_REGION='us-east-1'
- git clone --depth 1 --branch $DTAS_VERSION https://[email protected]/Alfresco/alfresco-deployment-test-automation-scripts.git dtas
script:
- aws ec2 run-instances --image-id ami-0d6e9a57f6259ba3a --count 1 --instance-type t3.large --key-name dbp-ansible --security-group-ids sg-099a05787b0a322c3 --subnet-id subnet-06ffe524598660d99 --tag-specifications "ResourceType=instance,Tags=[{Key=local,Value=centos8_machine_no_${TRAVIS_BUILD_NUMBER}},{Key=Creator,Value=${TRAVIS_BUILD_NUMBER}_${TRAVIS_BUILD_NUMBER}},{Key=Owner,Value="Operator\ Experience\ Team"},{Key=Department,Value=Engineering},{Key=Purpose,Value=${TRAVIS_BUILD_NUMBER}_${TRAVIS_BUILD_NUMBER}_centos8},{Key=NoAutomaticShutdown,Value=false},{Key=Production,Value=False},{Key=Name,Value=molecule_${TRAVIS_BRANCH}_${TRAVIS_BUILD_NUMBER}_centos8},{Key=instance,Value=${TRAVIS_BRANCH}_${TRAVIS_BUILD_NUMBER}_centos8}]"
- echo "wait for instance to be up" && sleep 4m
- export PUBLIC_IP=$(aws ec2 describe-instances --filters Name=instance-state-name,Values=running Name=tag-key,Values=local Name=tag-value,Values=centos8_machine_no_${TRAVIS_BUILD_NUMBER} --query 'Reservations[*].Instances[*].PublicIpAddress' --output text)
- export INSTANCE_ID=$(aws ec2 describe-instances --filters Name=tag-key,Values=local Name=tag-value,Values=centos8_machine_no_${TRAVIS_BUILD_NUMBER} --query 'Reservations[*].Instances[*].InstanceId' --output text)
- ssh-keyscan $PUBLIC_IP >> ~/.ssh/known_hosts
- scripts/generate-zip.sh
- export VERSION=$(cat VERSION)
- scp dist/alfresco-ansible-deployment-${VERSION}.zip centos@${PUBLIC_IP}:/home/centos/
- ssh centos@${PUBLIC_IP} "sudo yum update -y -q; sudo yum install -y -q unzip python3"
- ssh centos@${PUBLIC_IP} "sudo pip3 install ansible==${ANSIBLE_VERSION}"
- ssh centos@${PUBLIC_IP} "sudo pip3 install virtualenv"
- ssh centos@${PUBLIC_IP} "mkdir ~/.pythonvenv && virtualenv -p /usr/bin/python3 ~/.pythonvenv/ansible-${ANSIBLE_VERSION}"
- ssh centos@${PUBLIC_IP} "source ~/.pythonvenv/ansible-${ANSIBLE_VERSION}/bin/activate && pip3 install --upgrade pip && pip3 install ansible==${ANSIBLE_VERSION}"
- ssh centos@${PUBLIC_IP} "unzip alfresco-ansible-deployment-${VERSION}.zip"
- scp -r tests centos@${PUBLIC_IP}:/home/centos/alfresco-ansible-deployment-${VERSION}/
- ssh centos@${PUBLIC_IP} "export NEXUS_USERNAME=$NEXUS_USERNAME; export NEXUS_PASSWORD=\"$NEXUS_PASSWORD\"; cd alfresco-ansible-deployment-${VERSION}; ansible-playbook playbooks/acs.yml -i inventory_local.yml -e \"@tests/test-extra-vars.yml\""
- sed -i "s+TEST_URL+http://$PUBLIC_IP+g" "tests/test-config.json"
- cd dtas; pytest --tb=line --configuration ../tests/test-config.json tests/ -s
- if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[keep env]"* ]]; then aws ec2 terminate-instances --instance-ids $INSTANCE_ID; fi
- stage: Verification
name: Localhost integration checks (ACS 7.1.0 on Ubuntu 20.04)
before_install:
- openssl aes-256-cbc -K $encrypted_6c8b9ee48a27_key -iv $encrypted_6c8b9ee48a27_iv -in alfresco-ansible.pem.enc -out /tmp/dbp-ansible -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/dbp-ansible
- ssh-add /tmp/dbp-ansible
- curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
- unzip awscli-bundle.zip
- ./awscli-bundle/install -b ~/bin/aws
- export PATH=~/bin:$PATH
- export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- export AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- export AWS_DEFAULT_REGION='us-east-1'
- git clone --depth 1 --branch $DTAS_VERSION https://[email protected]/Alfresco/alfresco-deployment-test-automation-scripts.git dtas
script:
- aws ec2 run-instances --image-id ami-09e67e426f25ce0d7 --count 1 --instance-type t3.large --key-name dbp-ansible --security-group-ids sg-099a05787b0a322c3 --subnet-id subnet-06ffe524598660d99 --tag-specifications "ResourceType=instance,Tags=[{Key=local,Value=ubuntu20.04_machine_no_${TRAVIS_BUILD_NUMBER}},{Key=Creator,Value=${TRAVIS_BUILD_NUMBER}_${TRAVIS_BUILD_NUMBER}},{Key=Owner,Value="Operator\ Experience\ Team"},{Key=Department,Value=Engineering},{Key=Purpose,Value=${TRAVIS_BUILD_NUMBER}_${TRAVIS_BUILD_NUMBER}_ubuntu20.04},{Key=NoAutomaticShutdown,Value=false},{Key=Production,Value=False},{Key=Name,Value=molecule_${TRAVIS_BRANCH}_${TRAVIS_BUILD_NUMBER}_ubuntu20.04},{Key=instance,Value=${TRAVIS_BRANCH}_${TRAVIS_BUILD_NUMBER}_ubuntu20.04}]"
- echo "wait for instance to be up" && sleep 4m
- export PUBLIC_IP=$(aws ec2 describe-instances --filters Name=instance-state-name,Values=running Name=tag-key,Values=local Name=tag-value,Values=ubuntu20.04_machine_no_${TRAVIS_BUILD_NUMBER} --query 'Reservations[*].Instances[*].PublicIpAddress' --output text)
- export INSTANCE_ID=$(aws ec2 describe-instances --filters Name=tag-key,Values=local Name=tag-value,Values=ubuntu20.04_machine_no_${TRAVIS_BUILD_NUMBER} --query 'Reservations[*].Instances[*].InstanceId' --output text)
- ssh-keyscan $PUBLIC_IP >> ~/.ssh/known_hosts
- scripts/generate-zip.sh
- export VERSION=$(cat VERSION)
- scp dist/alfresco-ansible-deployment-${VERSION}.zip ubuntu@${PUBLIC_IP}:/tmp
- ssh ubuntu@${PUBLIC_IP} "DEBIAN_FRONTEND=noninteractive sudo -E apt-get update && sudo -E apt-get install -y unzip python3 virtualenvwrapper"
- ssh ubuntu@${PUBLIC_IP} ". /usr/share/virtualenvwrapper/virtualenvwrapper.sh && mkvirtualenv ansible-${ANSIBLE_VERSION} && [ -n $VIRTUAL_ENV ] || workon ansible-${ANSIBLE_VERSION} && pip install ansible==${ANSIBLE_VERSION}"
- ssh ubuntu@${PUBLIC_IP} "unzip /tmp/alfresco-ansible-deployment-${VERSION}.zip"
- scp -r tests ubuntu@${PUBLIC_IP}:alfresco-ansible-deployment-${VERSION}/
- ssh ubuntu@${PUBLIC_IP} ". /usr/share/virtualenvwrapper/virtualenvwrapper.sh && workon ansible-${ANSIBLE_VERSION} && export NEXUS_USERNAME=$NEXUS_USERNAME; export NEXUS_PASSWORD=\"$NEXUS_PASSWORD\"; cd alfresco-ansible-deployment-${VERSION}; ansible-playbook playbooks/acs.yml -i inventory_local.yml -e \"@tests/test-extra-vars.yml\""
- sed -i "s+TEST_URL+http://$PUBLIC_IP+g" tests/test-config.json
- cd dtas; pytest --tb=line --configuration ../tests/test-config.json tests/ -s
- if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[keep env]"* ]]; then aws ec2 terminate-instances --instance-ids $INSTANCE_ID; fi
- stage: Verification
name: SSL integration checks (ACS 7.1.0 on CentOS 8)
before_install:
- openssl aes-256-cbc -K $encrypted_6c8b9ee48a27_key -iv $encrypted_6c8b9ee48a27_iv -in alfresco-ansible.pem.enc -out /tmp/dbp-ansible -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/dbp-ansible
- ssh-add /tmp/dbp-ansible
- curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
- unzip awscli-bundle.zip
- ./awscli-bundle/install -b ~/bin/aws
- export PATH=~/bin:$PATH
- export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- export AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- export AWS_DEFAULT_REGION='us-east-1'
- git clone --depth 1 --branch $DTAS_VERSION https://[email protected]/Alfresco/alfresco-deployment-test-automation-scripts.git dtas
script:
- aws ec2 run-instances --image-id ami-0d6e9a57f6259ba3a --count 1 --instance-type t3.large --key-name dbp-ansible --security-group-ids sg-099a05787b0a322c3 --subnet-id subnet-06ffe524598660d99 --tag-specifications "ResourceType=instance,Tags=[{Key=local,Value=centos8_ssl_machine_no_${TRAVIS_BUILD_NUMBER}},{Key=Creator,Value=${TRAVIS_BUILD_NUMBER}_${TRAVIS_BUILD_NUMBER}},{Key=Owner,Value="Operator\ Experience\ Team"},{Key=Department,Value=Engineering},{Key=Purpose,Value=${TRAVIS_BUILD_NUMBER}_${TRAVIS_BUILD_NUMBER}_ssl_centos8},{Key=NoAutomaticShutdown,Value=false},{Key=Production,Value=False},{Key=Name,Value=molecule_${TRAVIS_BRANCH}_${TRAVIS_BUILD_NUMBER}_ssl_centos8},{Key=instance,Value=${TRAVIS_BRANCH}_${TRAVIS_BUILD_NUMBER}_ssl_centos8}]"
- echo "wait for instance to be up" && sleep 4m
- export PUBLIC_IP=$(aws ec2 describe-instances --filters Name=instance-state-name,Values=running Name=tag-key,Values=local Name=tag-value,Values=centos8_ssl_machine_no_${TRAVIS_BUILD_NUMBER} --query 'Reservations[*].Instances[*].PublicIpAddress' --output text)
- export INSTANCE_ID=$(aws ec2 describe-instances --filters Name=tag-key,Values=local Name=tag-value,Values=centos8_ssl_machine_no_${TRAVIS_BUILD_NUMBER} --query 'Reservations[*].Instances[*].InstanceId' --output text)
- sed -i "s+XXXXXX+$PUBLIC_IP+g" "tests/create_ansible-test.trial-dev.alfresco.me.yaml"
- sed -i "s+YYYYYY+$TRAVIS_BUILD_NUMBER+g" "tests/create_ansible-test.trial-dev.alfresco.me.yaml"
- sed -i "s+XXXXXX+$PUBLIC_IP+g" "tests/delete_ansible-test.trial-dev.alfresco.me.yaml"
- sed -i "s+YYYYYY+$TRAVIS_BUILD_NUMBER+g" "tests/delete_ansible-test.trial-dev.alfresco.me.yaml"
- aws route53 change-resource-record-sets --hosted-zone-id ${HOSTED_ZONE_TRIAL_DEV_ALFRESCO_ME} --change-batch file://tests/create_ansible-test.trial-dev.alfresco.me.yaml
- echo "wait for dns entry to be created" && sleep 1m
- ssh-keyscan $PUBLIC_IP >> ~/.ssh/known_hosts
- scripts/generate-zip.sh
- export VERSION=$(cat VERSION)
- scp dist/alfresco-ansible-deployment-${VERSION}.zip centos@${PUBLIC_IP}:/home/centos/
- ssh centos@${PUBLIC_IP} "sudo yum update -y -q; sudo yum install -y -q unzip python3"
- ssh centos@${PUBLIC_IP} "sudo pip3 install ansible==${ANSIBLE_VERSION}"
- ssh centos@${PUBLIC_IP} "sudo pip3 install virtualenv"
- ssh centos@${PUBLIC_IP} "mkdir ~/.pythonvenv && virtualenv -p /usr/bin/python3 ~/.pythonvenv/ansible-${ANSIBLE_VERSION}"
- ssh centos@${PUBLIC_IP} "source ~/.pythonvenv/ansible-${ANSIBLE_VERSION}/bin/activate && pip3 install --upgrade pip && pip3 install ansible==${ANSIBLE_VERSION}"
- ssh centos@${PUBLIC_IP} "unzip alfresco-ansible-deployment-${VERSION}.zip"
- ssh centos@${PUBLIC_IP} "mkdir /home/centos/alfresco-ansible-deployment-${VERSION}/configuration_files/ssl_certificates/"
- sed -i "s+YYYYYY+$TRAVIS_BUILD_NUMBER+g" "tests/test-ssl.yml"
- scp -r tests centos@${PUBLIC_IP}:/home/centos/alfresco-ansible-deployment-${VERSION}/
- aws secretsmanager get-secret-value --secret-id ${SSL_CERT_KEY_PATH} --query SecretString --output text > certificate.key
- aws secretsmanager get-secret-value --secret-id ${SSL_CERT_PATH} --query SecretString --output text > certificate.crt
- scp -r certificate.key centos@${PUBLIC_IP}:/home/centos/alfresco-ansible-deployment-${VERSION}/configuration_files/ssl_certificates/ansible-test-${TRAVIS_BUILD_NUMBER}.trial-dev.alfresco.me.key
- scp -r certificate.crt centos@${PUBLIC_IP}:/home/centos/alfresco-ansible-deployment-${VERSION}/configuration_files/ssl_certificates/ansible-test-${TRAVIS_BUILD_NUMBER}.trial-dev.alfresco.me.crt
- ssh centos@${PUBLIC_IP} "export NEXUS_USERNAME=$NEXUS_USERNAME; export NEXUS_PASSWORD=\"$NEXUS_PASSWORD\"; cd alfresco-ansible-deployment-${VERSION}; ansible-playbook playbooks/acs.yml -i inventory_local.yml -e \"@tests/test-extra-vars.yml\" -e \"@tests/test-ssl.yml\""
- sed -i "s+TEST_URL+https://ansible-test-${TRAVIS_BUILD_NUMBER}.trial-dev.alfresco.me+g" "tests/test-config.json"
- cd dtas; pytest --tb=line --configuration ../tests/test-config.json tests/ -s
- if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[keep env]"* ]]; then aws ec2 terminate-instances --instance-ids $INSTANCE_ID; fi
- cd ..
- aws route53 change-resource-record-sets --hosted-zone-id ${HOSTED_ZONE_TRIAL_DEV_ALFRESCO_ME} --change-batch file://tests/delete_ansible-test.trial-dev.alfresco.me.yaml
- stage: Verification
name: Localhost community integration (ACS Community on CentOS 8)
before_install:
- openssl aes-256-cbc -K $encrypted_6c8b9ee48a27_key -iv $encrypted_6c8b9ee48a27_iv -in alfresco-ansible.pem.enc -out /tmp/dbp-ansible -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/dbp-ansible
- ssh-add /tmp/dbp-ansible
- curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
- unzip awscli-bundle.zip
- ./awscli-bundle/install -b ~/bin/aws
- export PATH=~/bin:$PATH
- export AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- export AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- export AWS_DEFAULT_REGION='us-east-1'
- git clone --depth 1 --branch $DTAS_VERSION https://[email protected]/Alfresco/alfresco-deployment-test-automation-scripts.git dtas
script:
- aws ec2 run-instances --image-id ami-0d6e9a57f6259ba3a --count 1 --instance-type t3.large --key-name dbp-ansible --security-group-ids sg-099a05787b0a322c3 --subnet-id subnet-06ffe524598660d99 --tag-specifications "ResourceType=instance,Tags=[{Key=local,Value=community_centos8_machine_no_${TRAVIS_BUILD_NUMBER}},{Key=Creator,Value=${TRAVIS_BUILD_NUMBER}_${TRAVIS_BUILD_NUMBER}},{Key=Owner,Value="Operator\ Experience\ Team"},{Key=Department,Value=Engineering},{Key=Purpose,Value=${TRAVIS_BUILD_NUMBER}_${TRAVIS_BUILD_NUMBER}_community_centos8},{Key=NoAutomaticShutdown,Value=false},{Key=Production,Value=False},{Key=Name,Value=molecule_${TRAVIS_BRANCH}_${TRAVIS_BUILD_NUMBER}_community_centos8},{Key=instance,Value=${TRAVIS_BRANCH}_${TRAVIS_BUILD_NUMBER}_community_centos8}]"
- echo "wait for instance to be up" && sleep 4m
- export PUBLIC_IP=$(aws ec2 describe-instances --filters Name=instance-state-name,Values=running Name=tag-key,Values=local Name=tag-value,Values=community_centos8_machine_no_${TRAVIS_BUILD_NUMBER} --query 'Reservations[*].Instances[*].PublicIpAddress' --output text)
- export INSTANCE_ID=$(aws ec2 describe-instances --filters Name=tag-key,Values=local Name=tag-value,Values=community_centos8_machine_no_${TRAVIS_BUILD_NUMBER} --query 'Reservations[*].Instances[*].InstanceId' --output text)
- ssh-keyscan $PUBLIC_IP >> ~/.ssh/known_hosts
- scripts/generate-zip.sh
- export VERSION=$(cat VERSION)
- scp dist/alfresco-ansible-deployment-${VERSION}.zip centos@${PUBLIC_IP}:/home/centos/
- ssh centos@${PUBLIC_IP} "sudo yum update -y -q; sudo yum install -y -q unzip python3"
- ssh centos@${PUBLIC_IP} "sudo pip3 install ansible==${ANSIBLE_VERSION}"
- ssh centos@${PUBLIC_IP} "sudo pip3 install virtualenv"
- ssh centos@${PUBLIC_IP} "mkdir ~/.pythonvenv && virtualenv -p /usr/bin/python3 ~/.pythonvenv/ansible-${ANSIBLE_VERSION}"
- ssh centos@${PUBLIC_IP} "source ~/.pythonvenv/ansible-${ANSIBLE_VERSION}/bin/activate && pip3 install --upgrade pip && pip3 install ansible==${ANSIBLE_VERSION}"
- ssh centos@${PUBLIC_IP} "unzip alfresco-ansible-deployment-${VERSION}.zip"
- scp -r tests centos@${PUBLIC_IP}:/home/centos/alfresco-ansible-deployment-${VERSION}/
- ssh centos@${PUBLIC_IP} "cd alfresco-ansible-deployment-${VERSION}; ansible-playbook playbooks/acs.yml -i inventory_local.yml -e \"@community-extra-vars.yml\""
- sed -i "s+google-edit-flat+document-view-googlemaps+g" "dtas/tests/conftest.py"
- sed -i "s+TEST_URL+http://$PUBLIC_IP+g" "tests/test-config-community.json"
- cd dtas; pytest --tb=line --configuration ../tests/test-config-community.json tests/ -s
- if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[keep env]"* ]]; then aws ec2 terminate-instances --instance-ids $INSTANCE_ID; fi
- stage: Verification
name: Single Machine Integration checks
env:
- COMMON_COMMANDS="source ~/.bash_profile;export NEXUS_USERNAME=$NEXUS_USERNAME; export NEXUS_PASSWORD=\"$NEXUS_PASSWORD\";export MOLECULE_NO_LOG=false;export EC2_REGION=us-east-1;export TRAVIS_BRANCH=$TRAVIS_BRANCH;export TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER;export TRAVIS_JOB_NUMBER=$TRAVIS_JOB_NUMBER;export MOLECULE_EPHEMERAL_DIRECTORY=/opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/alfresco-ansible-deployment-single/molecule_temp_dir; export ANSIBLE_CONFIG=/opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/alfresco-ansible-deployment-single/molecule_temp_dir/ansible.cfg; cd /opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/alfresco-ansible-deployment-single" # pragma: allowlist secret
- ANSIBLE_FORCE_COLOR=true
before_install:
- openssl aes-256-cbc -K $encrypted_6c8b9ee48a27_key -iv $encrypted_6c8b9ee48a27_iv -in alfresco-ansible.pem.enc -out /tmp/dbp-ansible -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/dbp-ansible
- ssh-add /tmp/dbp-ansible
- git clone --depth 1 --branch $DTAS_VERSION https://[email protected]/Alfresco/alfresco-deployment-test-automation-scripts.git dtas
script:
- ssh-keyscan $control_machine_ip >> ~/.ssh/known_hosts
- ssh ec2-user@$control_machine_ip "mkdir -p /opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/alfresco-ansible-deployment-single/molecule_temp_dir/"
- rsync -r --delete-after --quiet $TRAVIS_BUILD_DIR/ ec2-user@$control_machine_ip:/opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/alfresco-ansible-deployment-single
- ssh ec2-user@$control_machine_ip "source ~/.bash_profile; mkdir -p /opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/alfresco-ansible-deployment-single/molecule_temp_dir/"
- if [[ "$TRAVIS_COMMIT_MESSAGE" == *"[keep env]"* ]]; then ssh -tt ec2-user@$control_machine_ip "$COMMON_COMMANDS;export KEEP_ENV=true;molecule create -s ec2"; else ssh -tt ec2-user@$control_machine_ip "$COMMON_COMMANDS;export KEEP_ENV=false;molecule create -s ec2"; fi
- ssh ec2-user@$control_machine_ip "$COMMON_COMMANDS;python molecule/ec2/dynamic_inventory.py"
- export TESTHOST=$(ssh ec2-user@$control_machine_ip "$COMMON_COMMANDS;cat molecule_temp_dir/instance_config.yml | yq .[].address -r")
- ssh -tt ec2-user@$control_machine_ip "$COMMON_COMMANDS; ansible-playbook playbooks/acs.yml -i /opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/alfresco-ansible-deployment-single/inventory_ssh.yml -e \"@/opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/alfresco-ansible-deployment-single/tests/test-extra-vars.yml\""
- echo "wait for repo to be up" && sleep 5m
- ssh ec2-user@$control_machine_ip "$COMMON_COMMANDS; sed -i 's+TEST_URL+http://$TESTHOST+g' tests/test-config.json ; cd dtas; pytest --tb=line --configuration ../tests/test-config.json tests/ -s"
- if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[keep env]"* ]]; then ssh -tt ec2-user@$control_machine_ip "$COMMON_COMMANDS;molecule destroy -s ec2"; fi
after_script:
- ssh ec2-user@$control_machine_ip "rm -rf /opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/"
- stage: Verification
name: Multi Machine Integration checks
env:
- ANSIBLE_FORCE_COLOR=true
- COMMON_COMMANDS="source ~/.bash_profile;export NEXUS_USERNAME=$NEXUS_USERNAME;export NEXUS_PASSWORD=\"$NEXUS_PASSWORD\";export MOLECULE_NO_LOG=false;export EC2_REGION=us-east-1;export TRAVIS_BRANCH=$TRAVIS_BRANCH;export TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER;export TRAVIS_JOB_NUMBER=$TRAVIS_JOB_NUMBER;export MOLECULE_EPHEMERAL_DIRECTORY=/opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/alfresco-ansible-deployment/molecule_temp_dir_m; export ANSIBLE_CONFIG=/opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/alfresco-ansible-deployment/molecule_temp_dir_m/ansible.cfg; cd /opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/alfresco-ansible-deployment" # pragma: allowlist secret
before_install:
- openssl aes-256-cbc -K $encrypted_6c8b9ee48a27_key -iv $encrypted_6c8b9ee48a27_iv -in alfresco-ansible.pem.enc -out /tmp/dbp-ansible -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/dbp-ansible
- ssh-add /tmp/dbp-ansible
- git clone --depth 1 --branch $DTAS_VERSION https://[email protected]/Alfresco/alfresco-deployment-test-automation-scripts.git dtas
script:
- ssh-keyscan $control_machine_ip >> ~/.ssh/known_hosts
- ssh ec2-user@$control_machine_ip "mkdir -p /opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/"
- rsync -r --delete-after --quiet $TRAVIS_BUILD_DIR ec2-user@$control_machine_ip:/opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER
- ssh ec2-user@$control_machine_ip "source ~/.bash_profile"
- if [[ "$TRAVIS_COMMIT_MESSAGE" == *"[keep env]"* ]]; then ssh -tt ec2-user@$control_machine_ip "$COMMON_COMMANDS;export KEEP_ENV=true;molecule create -s ec2multi"; else ssh -tt ec2-user@$control_machine_ip "$COMMON_COMMANDS;export KEEP_ENV=false;molecule create -s ec2multi"; fi
- ssh ec2-user@$control_machine_ip "$COMMON_COMMANDS;python molecule/ec2multi/dynamic_inventory.py"
- export TESTHOST=$(ssh ec2-user@$control_machine_ip "$COMMON_COMMANDS;cat inventory_ssh.yml | yq .all.children.nginx.hosts.nginx_1.ansible_host -r")
- ssh -tt ec2-user@$control_machine_ip "$COMMON_COMMANDS;ansible-playbook playbooks/acs.yml -i /opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/alfresco-ansible-deployment/inventory_ssh.yml -e \"@tests/test-extra-vars.yml\""
- echo "wait for repo to be up" && sleep 5m
- ssh ec2-user@$control_machine_ip "$COMMON_COMMANDS; sed -i 's+TEST_URL+http://$TESTHOST+g' tests/test-config.json; cd dtas; pytest --tb=line --configuration ../tests/test-config.json tests/ -s"
- if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[keep env]"* ]]; then ssh -tt ec2-user@$control_machine_ip "$COMMON_COMMANDS;molecule destroy -s ec2multi"; fi
after_script:
- ssh ec2-user@$control_machine_ip "rm -rf /opt/buildacs/$TRAVIS_BRANCH/$TRAVIS_JOB_NUMBER/"
- stage: Release Stage
name: Release
script:
- scripts/generate-zip.sh
# Travis CI runner work on DETACHED HEAD, so we need to checkout the branch
- git checkout -B "${TRAVIS_BRANCH}"
- git config --local user.email "[email protected]"
- export VERSION=`cat VERSION`
- echo "Tagging repository with v$VERSION..."
- export GIT_TAG="v$VERSION"
- git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER"
- git push https://[email protected]/Alfresco/alfresco-ansible-deployment $GIT_TAG
- git tag -d latest
- git tag -a -m "current latest -> $GIT_TAG" -f latest ${GIT_TAG}^{}
- for ref in ':refs/tags/latest' 'latest'; do git push https://[email protected]/Alfresco/alfresco-ansible-deployment $ref; done
- curl -v -F "r=releases" -F "g=org.alfresco" -F "a=alfresco-ansible-deployment" -F "v=${VERSION}" -F "p=zip" -F "file=@dist/alfresco-ansible-deployment-${VERSION}.zip" -u "$NEXUS_USERNAME:$NEXUS_PASSWORD" https://artifacts.alfresco.com/nexus/service/local/artifact/maven/content
deploy:
provider: s3
access_key_id: "${STAGING_AWS_ACCESS_KEY}"
secret_access_key: "${STAGING_AWS_SECRET_KEY}"
bucket: "${S3_STAGING_BUCKET}"
skip_cleanup: true
region: "eu-west-1"
local_dir: dist
glob: "*.zip"
upload-dir: "enterprise/alfresco-ansible-deployment"
after_deploy:
- rm -fv dist/alfresco-ansible-release-*.zip