Skip to content

Commit 6fd0b85

Browse files
author
matanper
authored
test login to ecr before build (#219)
1 parent 9ab5da8 commit 6fd0b85

File tree

1 file changed

+15
-31
lines changed

1 file changed

+15
-31
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ jobs:
4242
uses: docker/build-push-action@v4
4343
with:
4444
context: .
45-
file: ./Dockerfile
4645
tags: ${{ secrets.MON_IMAGE_NAME }}:${{ github.sha }}
4746
build-args: |
4847
DEEPCHECKS_CI_TOKEN=${{ secrets.DEEPCHECKS_CI_TOKEN }}
@@ -53,35 +52,13 @@ jobs:
5352
name: commImage
5453
path: /tmp/commImage.tar
5554
docker-push:
56-
if: github.event_name != 'pull_request'
5755
runs-on: ubuntu-latest
58-
needs: build
56+
if: github.event_name != 'pull_request'
5957
steps:
6058
- name: Checkout
6159
uses: actions/checkout@v2
6260
- name: Set up Docker Buildx
6361
uses: docker/setup-buildx-action@v2
64-
- name: Download artifact
65-
uses: actions/download-artifact@v2
66-
with:
67-
name: commImage
68-
path: /tmp
69-
- name: Load Docker image
70-
# Loading the image from artifact should reuse it and rebuild only the missing arm64 version
71-
run: docker load --input /tmp/commImage.tar
72-
- name: Build and push
73-
uses: docker/build-push-action@v4
74-
with:
75-
context: .
76-
file: ./Dockerfile
77-
platforms: linux/amd64,linux/arm64/v8
78-
outputs: type=image,push=false
79-
tags: |
80-
${{ secrets.MON_IMAGE_NAME }}:${{ github.sha }}
81-
${{ secrets.MON_IMAGE_NAME }}:latest
82-
${{ secrets.PUBLIC_IMAGE_NAME }}:latest
83-
build-args: |
84-
DEEPCHECKS_CI_TOKEN=${{ secrets.DEEPCHECKS_CI_TOKEN }}
8562
- name: Configure AWS credentials
8663
uses: aws-actions/configure-aws-credentials@v1
8764
with:
@@ -91,10 +68,6 @@ jobs:
9168
- name: Login to Amazon ECR
9269
id: login-ecr
9370
uses: aws-actions/amazon-ecr-login@v1
94-
- name: Build and push
95-
run: |
96-
docker push ${{ secrets.MON_IMAGE_NAME }}:${{ github.sha }}
97-
docker push ${{ secrets.MON_IMAGE_NAME }}:latest
9871
- name: Configure AWS credentials (Public)
9972
uses: aws-actions/configure-aws-credentials@v1
10073
with:
@@ -106,9 +79,20 @@ jobs:
10679
uses: aws-actions/amazon-ecr-login@v1
10780
with:
10881
registry-type: public
109-
- name: Push to public
110-
run: |
111-
docker push ${{ secrets.PUBLIC_IMAGE_NAME }}:latest
82+
# Sadly, buildx does not support loading images from file to reuse the image from the previous step
83+
# https://github.com/docker/buildx/issues/847
84+
- name: Build and push
85+
uses: docker/build-push-action@v4
86+
with:
87+
context: .
88+
platforms: linux/amd64,linux/arm64/v8
89+
pull: true
90+
tags: |
91+
${{ secrets.MON_IMAGE_NAME }}:${{ github.sha }}
92+
${{ secrets.MON_IMAGE_NAME }}:latest
93+
${{ secrets.PUBLIC_IMAGE_NAME }}:latest
94+
build-args: |
95+
DEEPCHECKS_CI_TOKEN=${{ secrets.DEEPCHECKS_CI_TOKEN }}
11296
- name: Logout from Amazon ECR
11397
if: always()
11498
run: |

0 commit comments

Comments
 (0)