Skip to content

(ARM64) ACS Packaging CI #473

(ARM64) ACS Packaging CI

(ARM64) ACS Packaging CI #473

Workflow file for this run

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=23.3.0-A22" >> $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: "Docker ps"
if: failure()
run: |
docker ps
- 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 }}