Skip to content

Commit b442aad

Browse files
committed
Publish ARM Ansible Docker images
1 parent b5ab05d commit b442aad

File tree

5 files changed

+89
-24
lines changed

5 files changed

+89
-24
lines changed

.github/workflows/build.yml

+44-6
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,76 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Check out repository code
14-
uses: actions/checkout@master
14+
uses: actions/checkout@main
15+
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v2
18+
with:
19+
platforms: linux/arm64
1520

1621
- name: Set up Docker Buildx
17-
uses: docker/setup-buildx-action@v1
22+
uses: docker/setup-buildx-action@v2
1823

1924
- name: Build and push the image
20-
uses: docker/build-push-action@v2
25+
uses: docker/build-push-action@v3
2126
with:
2227
context: base
2328
push: false
29+
platforms: linux/amd64,linux/arm64
2430
tags: |
2531
${{ secrets.PREPROD_PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL }}:${{ github.ref == 'refs/heads/main' && 'latest' || 'future' }}
2632
ghcr.io/spacelift-io/runner-ansible:${{ github.ref == 'refs/heads/main' && 'latest' || 'future' }}
2733
34+
- name: Test if ansible binary works
35+
run: |
36+
# We need to rebuild the images because the previous step is a multi-arch build
37+
# and it doesn't produce outputs unfortunately.
38+
39+
# ARM64
40+
docker build --platform linux/arm64 -t ansible-test-arm base
41+
docker run --rm ansible-test-arm ansible --version
42+
43+
# AMD64
44+
docker build --platform linux/amd64 -t ansible-test-amd64 base
45+
docker run --rm ansible-test-amd64 ansible --version
46+
2847
aws:
2948
name: Build and deploy the alpine base AWS image
3049
runs-on: ubuntu-latest
3150
steps:
3251
- name: Check out repository code
33-
uses: actions/checkout@master
52+
uses: actions/checkout@main
53+
3454
- name: Set env
3555
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
3656

57+
- name: Set up QEMU
58+
uses: docker/setup-qemu-action@v2
59+
with:
60+
platforms: linux/arm64
61+
3762
- name: Set up Docker Buildx
38-
uses: docker/setup-buildx-action@v1
63+
uses: docker/setup-buildx-action@v2
3964

4065
- name: Build and push the image
41-
uses: docker/build-push-action@v2
66+
uses: docker/build-push-action@v3
4267
with:
4368
build-args: |
4469
REPOSITORY_BASE_PATH=${{ secrets.PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL }}
4570
context: aws
4671
push: false
4772
tags: |
4873
${{ secrets.PREPROD_PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL_AWS }}:${{ github.ref == 'refs/heads/main' && 'latest' || 'future' }}
74+
75+
- name: Test if ansible binary works
76+
run: |
77+
# We need to rebuild the images because the previous step is a multi-arch build
78+
# and it doesn't produce outputs unfortunately.
79+
80+
# ARM64
81+
docker build --platform linux/arm64 --build-arg REPOSITORY_BASE_PATH=${{ secrets.PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL }} -t ansible-test-arm aws
82+
docker run --rm ansible-test-arm sh -c "python3 -c \"import boto3; print(boto3.__version__)\" && ansible --version"
83+
84+
# AMD64
85+
docker build --platform linux/amd64 --build-arg REPOSITORY_BASE_PATH=${{ secrets.PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL }} -t ansible-test-amd64 aws
86+
docker run --rm ansible-test-amd64 sh -c "python3 -c \"import boto3; print(boto3.__version__)\" && ansible --version"

.github/workflows/deploy-preproduction.yml

+19-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Check out repository code
23-
uses: actions/checkout@master
23+
uses: actions/checkout@main
24+
25+
- name: Set up QEMU
26+
uses: docker/setup-qemu-action@v2
27+
with:
28+
platforms: linux/arm64
2429

2530
- name: Configure AWS credentials
2631
uses: aws-actions/configure-aws-credentials@v1
@@ -46,12 +51,13 @@ jobs:
4651
password: ${{ secrets.GITHUB_TOKEN }}
4752

4853
- name: Set up Docker Buildx
49-
uses: docker/setup-buildx-action@v1
54+
uses: docker/setup-buildx-action@v2
5055

5156
- name: Build and push the image
52-
uses: docker/build-push-action@v2
57+
uses: docker/build-push-action@v3
5358
with:
5459
context: base
60+
platforms: linux/amd64,linux/arm64
5561
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/future' }}
5662
tags: |
5763
${{ secrets.PREPROD_PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL }}:${{ github.ref == 'refs/heads/main' && 'latest' || 'future' }}
@@ -64,7 +70,13 @@ jobs:
6470
runs-on: ubuntu-latest
6571
steps:
6672
- name: Check out repository code
67-
uses: actions/checkout@master
73+
uses: actions/checkout@main
74+
75+
- name: Set up QEMU
76+
uses: docker/setup-qemu-action@v2
77+
with:
78+
platforms: linux/arm64
79+
6880
- name: Set env
6981
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
7082

@@ -85,12 +97,13 @@ jobs:
8597
REPOSITORY_BASE_PATH: ${{ secrets.PREPROD_PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL }}
8698

8799
- name: Set up Docker Buildx
88-
uses: docker/setup-buildx-action@v1
100+
uses: docker/setup-buildx-action@v2
89101

90102
- name: Build and push the image
91-
uses: docker/build-push-action@v2
103+
uses: docker/build-push-action@v3
92104
with:
93105
context: aws
106+
platforms: linux/amd64,linux/arm64
94107
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/future' }}
95108
tags: |
96109
${{ secrets.PREPROD_PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL }}/runner-ansible-aws:${{ github.ref == 'refs/heads/main' && 'latest' || 'future' }}

.github/workflows/deploy-production.yml

+20-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Check out repository code
23-
uses: actions/checkout@master
23+
uses: actions/checkout@main
24+
25+
- name: Set up QEMU
26+
uses: docker/setup-qemu-action@v2
27+
with:
28+
platforms: linux/arm64
2429

2530
- name: Configure AWS credentials
2631
uses: aws-actions/configure-aws-credentials@v1
@@ -46,23 +51,31 @@ jobs:
4651
password: ${{ secrets.GITHUB_TOKEN }}
4752

4853
- name: Set up Docker Buildx
49-
uses: docker/setup-buildx-action@v1
54+
uses: docker/setup-buildx-action@v2
5055

5156
- name: Build and push the image
52-
uses: docker/build-push-action@v2
57+
uses: docker/build-push-action@v3
5358
with:
5459
context: base
60+
platforms: linux/amd64,linux/arm64
5561
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/future' }}
5662
tags: |
5763
${{ secrets.PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL }}:${{ github.ref == 'refs/heads/main' && 'latest' || 'future' }}
64+
ghcr.io/spacelift-io/runner-ansible:${{ github.ref == 'refs/heads/main' && 'latest' || 'future' }}
5865
5966
aws:
6067
needs: base
6168
name: Build and deploy the alpine base AWS image
6269
runs-on: ubuntu-latest
6370
steps:
6471
- name: Check out repository code
65-
uses: actions/checkout@master
72+
uses: actions/checkout@main
73+
74+
- name: Set up QEMU
75+
uses: docker/setup-qemu-action@v2
76+
with:
77+
platforms: linux/arm64
78+
6679
- name: Set env
6780
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
6881

@@ -83,14 +96,15 @@ jobs:
8396
REPOSITORY_PATH: ${{ secrets.PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL_AWS }}
8497

8598
- name: Set up Docker Buildx
86-
uses: docker/setup-buildx-action@v1
99+
uses: docker/setup-buildx-action@v2
87100

88101
- name: Build and push the image
89-
uses: docker/build-push-action@v2
102+
uses: docker/build-push-action@v3
90103
with:
91104
build-args: |
92105
REPOSITORY_BASE_PATH=${{ secrets.PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL }}
93106
context: aws
107+
platforms: linux/amd64,linux/arm64
94108
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/future' }}
95109
tags: |
96110
${{ secrets.PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL_AWS }}:${{ github.ref == 'refs/heads/main' && 'latest' || 'future' }}

.github/workflows/prod-pr.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ jobs:
88
create-pr:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@main
1212

1313
- name: Create Pull Request
14-
uses: vsoch/pull-request-action@1.0.13
14+
uses: vsoch/pull-request-action@1.0.22
1515
env:
1616
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1717
PASS_IF_EXISTS: true

.github/workflows/trivy.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@main
1919

2020
- name: Build an image from Dockerfile
2121
run: |
@@ -31,7 +31,7 @@ jobs:
3131
severity: "CRITICAL,HIGH"
3232

3333
- name: Upload Trivy scan results to GitHub Security tab
34-
uses: github/codeql-action/upload-sarif@v1
34+
uses: github/codeql-action/upload-sarif@v2
3535
with:
3636
sarif_file: "trivy-results.sarif"
3737

@@ -41,7 +41,7 @@ jobs:
4141

4242
steps:
4343
- name: Checkout code
44-
uses: actions/checkout@v2
44+
uses: actions/checkout@main
4545

4646
- name: Build an image from Dockerfile
4747
run: |
@@ -57,6 +57,6 @@ jobs:
5757
severity: "CRITICAL,HIGH"
5858

5959
- name: Upload Trivy scan results to GitHub Security tab
60-
uses: github/codeql-action/upload-sarif@v1
60+
uses: github/codeql-action/upload-sarif@v2
6161
with:
6262
sarif_file: "trivy-results.sarif"

0 commit comments

Comments
 (0)