-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (53 loc) · 1.89 KB
/
cnf-test-partner-image.yaml
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
name: 'Test/push the `cnf-test-partner` image'
on:
push:
paths:
- 'test-partner/Dockerfile'
pull_request:
defaults:
run:
shell: bash
env:
REGISTRY: quay.io
IMAGE_NAME: testnetworkfunction/cnf-test-partner
IMAGE_TAG: latest
IMAGE_CONTAINER_FILE_PATH: ./test-partner/Dockerfile
jobs:
test-cnf-test-partner-image:
name: 'Build and test the `cnf-test-partner` image'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: 'Build the `cnf-test-partner` image'
run: docker build -t $IMAGE_NAME:$IMAGE_TAG . --no-cache -f $IMAGE_CONTAINER_FILE_PATH
working-directory: .
- name: 'Test: Check if ping is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which ping
- name: 'Test: Check if ip is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which ip
- name: 'Test: Check if ssh is installed'
run: docker run $IMAGE_NAME:$IMAGE_TAG which ssh
push-cnf-test-partner-image:
if: ${{ github.ref == 'refs/heads/main' }}
name: 'Push the new `cnf-test-partner` image to Quay.io'
needs: test-cnf-test-partner-image
runs-on: ubuntu-22.04
steps:
- name: Checkout the main branch
uses: actions/checkout@v3
with:
ref: main
- name: Authenticate against Quay.io
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
# Use a Robot Account to authenticate against Quay.io
# https://docs.quay.io/glossary/robot-accounts.html
username: ${{ secrets.QUAY_ROBOT_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: 'Build and push the new `cnf-test-partner` image'
uses: docker/build-push-action@v3
with:
push: true
file: ${{ env.IMAGE_CONTAINER_FILE_PATH }}
tags: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}'