|
| 1 | +name: 'Test/push the `debug-partner` image' |
| 2 | +on: |
| 3 | + push: |
| 4 | + paths: |
| 5 | + - 'test-partner/Dockerfile.debug-partner' |
| 6 | + pull_request: |
| 7 | +defaults: |
| 8 | + run: |
| 9 | + shell: bash |
| 10 | + working-directory: test-partner |
| 11 | +env: |
| 12 | + REGISTRY: quay.io |
| 13 | + IMAGE_NAME: testnetworkfunction/debug-partner |
| 14 | + IMAGE_TAG: latest |
| 15 | + IMAGE_CONTAINER_FILE_PATH: test-partner/Dockerfile.debug-partner |
| 16 | + |
| 17 | +jobs: |
| 18 | + test-debug-partner-image: |
| 19 | + name: 'Build and test the `debug-partner` image' |
| 20 | + runs-on: ubuntu-20.04 |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + |
| 25 | + - name: 'Build the `debug-partner` image' |
| 26 | + run: docker build --no-cache -f Dockerfile.debug-partner -t $IMAGE_NAME:$IMAGE_TAG . |
| 27 | + |
| 28 | + - name: 'Test: Check if lscpu is installed' |
| 29 | + run: docker run $IMAGE_NAME:$IMAGE_TAG which lscpu |
| 30 | + |
| 31 | + - name: 'Test: Check if lsblk is installed' |
| 32 | + run: docker run $IMAGE_NAME:$IMAGE_TAG which lsblk |
| 33 | + |
| 34 | + - name: 'Test: Check if lspci is installed' |
| 35 | + run: docker run $IMAGE_NAME:$IMAGE_TAG which lspci |
| 36 | + |
| 37 | + push-debug-partner-image: |
| 38 | + if: ${{ github.ref == 'refs/heads/main' }} |
| 39 | + name: 'Push the new `debug-partner` image to Quay.io' |
| 40 | + needs: test-debug-partner-image |
| 41 | + runs-on: ubuntu-20.04 |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout the main branch |
| 45 | + uses: actions/checkout@v2 |
| 46 | + with: |
| 47 | + ref: main |
| 48 | + |
| 49 | + - name: Authenticate against Quay.io |
| 50 | + uses: docker/login-action@v1 |
| 51 | + with: |
| 52 | + registry: ${{ env.REGISTRY }} |
| 53 | + # Use a Robot Account to authenticate against Quay.io |
| 54 | + # https://docs.quay.io/glossary/robot-accounts.html |
| 55 | + username: ${{ secrets.QUAY_ROBOT_USERNAME }} |
| 56 | + password: ${{ secrets.QUAY_ROBOT_TOKEN }} |
| 57 | + |
| 58 | + - name: 'Build and push the new `debug-partner` image' |
| 59 | + uses: docker/build-push-action@v2 |
| 60 | + with: |
| 61 | + push: true |
| 62 | + file: ${{ env.IMAGE_CONTAINER_FILE_PATH }} |
| 63 | + tags: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}' |
0 commit comments