-
Notifications
You must be signed in to change notification settings - Fork 37
188 lines (182 loc) · 8.37 KB
/
arm64.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
name: (ARM64) ACS Packaging CI
on:
schedule:
- cron: "0 3 * * 1-5"
workflow_dispatch:
env:
GITHUB_ACTIONS_DEPLOY_TIMEOUT: 60
MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
TAS_ENVIRONMENT: ./tests/environment
TAS_SCRIPTS: ../alfresco-community-repo/packaging/tests/scripts
AWS_REGION: eu-west-1
DTAS_VERSION: v1.2.2
jobs:
start-runner:
name: "Start self-hosted EC2 runner"
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: "Configure AWS credentials"
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_EC2_GITHUB_RUNNER_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_EC2_GITHUB_RUNNER_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
- name: "Start EC2 runner"
id: start-ec2-runner
uses: machulav/ec2-github-runner@4e0303de215db88e1c489e07a15ca4d867f488ea
with:
mode: start
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
ec2-image-id: ami-0ec31c3e3b729bb6d # Ubuntu 22.04 ARM64 w/ 125GB drive
ec2-instance-type: c6g.2xlarge
subnet-id: subnet-0777c70a4cd9ce944
security-group-id: sg-0f89a325d9eb147cb
aws-resource-tags: >
[
{"Key": "Name", "Value": "arm64-acs-packaging-gh-runner"},
{"Key": "Creator", "Value": "${{ github.repository }}"},
{"Key": "Owner", "Value": "ACS Feature Teams"},
{"Key": "Department", "Value": "Alfresco Engineering"},
{"Key": "Purpose", "Value": "GH runner for ARM64 acs-packaging tests"},
{"Key": "Production", "Value": "false"}
]
arm64_health_check:
name: "ARM64 Health Check"
needs: start-runner
runs-on: ${{ needs.start-runner.outputs.label }}
outputs:
test_failure: ${{ steps.persist_test_failure_flag.outputs.test_failure }}
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- name: "Install required software"
run: |
# Install Docker as per https://docs.docker.com/engine/install/ubuntu/
apt-get update
apt-get install ca-certificates curl gnupg -y
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
# Additionally install git, zip and unzip (required by SDKMAN to install Maven), python3
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin git zip unzip python3 python3-pip -y
# Workaround due to $HOME not being set causing issues with settings.xml installation in setup-build-java
mkdir -p /root/.m2
cp .ci.settings.xml /root/.m2/settings.xml
- name: "Install Maven"
uses: sdkman/sdkman-action@b1f9b696c79148b66d3d3a06f7ea801820318d0f
with:
candidate: maven
version: "3.8.8"
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: "Login to Docker Hub"
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: "Login to Quay.io"
uses: docker/[email protected]
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: "Get latest matching tag"
run: |
VERSION_NUMBER=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
TEST_GIT_TAG=$(git tag --list --sort=-taggerdate "$VERSION_NUMBER*" | head -n 1)
if [ -z $TEST_GIT_TAG ]; then
TEST_GIT_TAG=$(git tag --list --sort=-taggerdate | head -n 1)
fi
echo "TEST_GIT_TAG=$TEST_GIT_TAG" >> $GITHUB_ENV
- name: "Prepare test config"
run: |
git checkout $TEST_GIT_TAG
mvn clean install -B -ntp -DskipTests -f tests/pipeline-all-amps/repo/pom.xml
cat tests/pipeline-all-amps/repo/target/dtas/dtas-config.json
- name: "Set up the environment"
id: setup-env
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
env:
AWS_ACCESS_KEY: ${{ secrets.AWS_S3_PIPELINE_AMPS_ACCESS_KEY_ID }}
AWS_SECRET_KEY: ${{ secrets.AWS_S3_PIPELINE_AMPS_SECRET_ACCESS_KEY }}
run: |
# Make necessary env files available
git clone --depth=1 --branch master https://${{ secrets.BOT_GITHUB_USERNAME }}:${{ secrets.BOT_GITHUB_TOKEN }}@github.com/Alfresco/alfresco-community-repo.git ../alfresco-community-repo
# Start the environment
export PIPELINE_ALL_AMPS_REGISTRY=quay.io/
export PIPELINE_ALL_AMPS_TAG=$TEST_GIT_TAG
${TAS_SCRIPTS}/start-compose.sh ${TAS_ENVIRONMENT}/docker-compose-pipeline-all-amps.yml
${TAS_SCRIPTS}/wait-for-alfresco-start.sh "http://localhost:8080/alfresco/" 180
docker ps
curl -v --user [email protected]:admin http://localhost:8080/alfresco/api/discovery
- name: "Run tests"
id: run-tests
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
run: |
# Make necessary test files available
git clone --depth 1 --branch $DTAS_VERSION https://${{ secrets.BOT_GITHUB_USERNAME }}:${{ secrets.BOT_GITHUB_TOKEN }}@github.com/Alfresco/alfresco-deployment-test-automation-scripts.git dtas
cd dtas
pip install -r requirements.txt
python3 -m pytest --configuration ../tests/pipeline-all-amps/repo/target/dtas/dtas-config.json tests/ -s
- name: "Dump all Docker containers logs"
uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
if: failure() && (steps.setup-env.outcome == 'failure' || steps.run-tests.outcome == 'failure')
- name: "Persist test failure flag"
id: persist_test_failure_flag
run: echo "test_failure=true" >> "$GITHUB_OUTPUT"
if: failure()
stop-runner:
name: "Stop self-hosted EC2 runner"
needs:
- start-runner
- arm64_health_check
runs-on: ubuntu-latest
if: always()
steps:
- name: "Configure AWS credentials"
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_EC2_GITHUB_RUNNER_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_EC2_GITHUB_RUNNER_SECRET_ACCESS_KEY }}
aws-region: eu-west-2
- name: "Stop EC2 runner"
uses: machulav/ec2-github-runner@4e0303de215db88e1c489e07a15ca4d867f488ea
with:
mode: stop
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
jira_integration:
name: "JIRA integration"
runs-on: ubuntu-latest
needs:
- arm64_health_check
if: always()
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: "Run the JIRA Integration script"
run: |
pip install -r ./scripts/ci/jira/requirements.txt
./scripts/ci/jira/jira_integration.py
env:
BUILD_WEB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}
JOB_NAME: arm64_health_check
TEST_FAILURE: ${{ needs.arm64_health_check.outputs.test_failure }}