@@ -11,38 +11,76 @@ jobs:
11
11
runs-on : ubuntu-latest
12
12
steps :
13
13
- 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
15
20
16
21
- name : Set up Docker Buildx
17
- uses : docker/setup-buildx-action@v1
22
+ uses : docker/setup-buildx-action@v2
18
23
19
24
- name : Build and push the image
20
- uses : docker/build-push-action@v2
25
+ uses : docker/build-push-action@v3
21
26
with :
22
27
context : base
23
28
push : false
29
+ platforms : linux/amd64,linux/arm64
24
30
tags : |
25
31
${{ secrets.PREPROD_PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL }}:${{ github.ref == 'refs/heads/main' && 'latest' || 'future' }}
26
32
ghcr.io/spacelift-io/runner-ansible:${{ github.ref == 'refs/heads/main' && 'latest' || 'future' }}
27
33
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
+
28
47
aws :
29
48
name : Build and deploy the alpine base AWS image
30
49
runs-on : ubuntu-latest
31
50
steps :
32
51
- name : Check out repository code
33
- uses : actions/checkout@master
52
+ uses : actions/checkout@main
53
+
34
54
- name : Set env
35
55
run : echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
36
56
57
+ - name : Set up QEMU
58
+ uses : docker/setup-qemu-action@v2
59
+ with :
60
+ platforms : linux/arm64
61
+
37
62
- name : Set up Docker Buildx
38
- uses : docker/setup-buildx-action@v1
63
+ uses : docker/setup-buildx-action@v2
39
64
40
65
- name : Build and push the image
41
- uses : docker/build-push-action@v2
66
+ uses : docker/build-push-action@v3
42
67
with :
43
68
build-args : |
44
69
REPOSITORY_BASE_PATH=${{ secrets.PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL }}
45
70
context : aws
46
71
push : false
47
72
tags : |
48
73
${{ 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"
0 commit comments