-
Notifications
You must be signed in to change notification settings - Fork 238
69 lines (58 loc) · 2.22 KB
/
ci-build-push-e2e-tests.yaml
File metadata and controls
69 lines (58 loc) · 2.22 KB
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
name: Build and push E2E Test Image
on:
push:
branches:
- main
permissions:
contents: read
env:
E2E_IMAGE_TAG_BASE: quay.io/${{ secrets.QUAY_ORG }}/opendatahub-operator-e2e
jobs:
build-push-e2e-image:
name: Build and push E2E test image
runs-on: ubuntu-latest
env:
IMAGE_BUILDER: podman
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- name: Quay.io login
uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1.7
env:
QUAY_ID: ${{ secrets.QUAY_ID }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
with:
registry: quay.io
username: ${{ env.QUAY_ID }}
password: ${{ env.QUAY_TOKEN }}
- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: go.mod
- name: Retrieve branch name
id: branch-name
uses: tj-actions/branch-names@5250492686b253f06fa55861556d1027b067aeb5
- name: Generate image tags
id: image-tag
run: |
# tag based on shortened commit SHA
COMMIT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
BRANCH_NAME=$(echo ${{ steps.branch-name.outputs.current_branch }})
echo "E2E_IMAGE_TAG="${BRANCH_NAME} >> $GITHUB_OUTPUT
echo "E2E_IMAGE_TAG_COMMIT=${BRANCH_NAME}-${COMMIT_SHA}" >> $GITHUB_OUTPUT
- name: Build and push E2E test image
env:
E2E_IMAGE: ${{ env.E2E_IMAGE_TAG_BASE }}:${{ steps.image-tag.outputs.E2E_IMAGE_TAG }}
E2E_IMAGE_COMMIT: ${{ env.E2E_IMAGE_TAG_BASE }}:${{ steps.image-tag.outputs.E2E_IMAGE_TAG_COMMIT }}
run: |
echo "Building E2E test image: ${E2E_IMAGE}"
podman build \
--platform linux/amd64 \
-f Dockerfiles/e2e-tests/e2e-tests.Dockerfile \
-t "${E2E_IMAGE}" -t "${E2E_IMAGE_COMMIT}" \
.
echo "Pushing E2E test image: ${E2E_IMAGE}"
podman push "${E2E_IMAGE}"
echo "Pushing E2E test image: ${E2E_IMAGE_COMMIT}"
podman push "${E2E_IMAGE_COMMIT}"
echo "E2E test image built and pushed successfully!"