|
1 | 1 | name: Pull Request |
2 | 2 | on: [pull_request] |
3 | 3 |
|
| 4 | +env: |
| 5 | + REGISTRY: ghcr.io |
| 6 | + IMAGE_NAME: ${{ github.repository }} |
| 7 | + |
4 | 8 | jobs: |
5 | 9 | lint: |
6 | 10 | name: Lint |
@@ -74,19 +78,44 @@ jobs: |
74 | 78 | name: Docker Tests |
75 | 79 | needs: [lint] |
76 | 80 | runs-on: ubuntu-latest |
77 | | - |
| 81 | + |
78 | 82 | steps: |
79 | | - - name: checkout |
| 83 | + - name: Checkout repository |
80 | 84 | uses: actions/checkout@v4 |
81 | 85 |
|
82 | | - - name: docker build |
83 | | - run: make docker-build |
| 86 | + - name: Set up Docker Buildx |
| 87 | + uses: docker/setup-buildx-action@v3 |
| 88 | + with: |
| 89 | + driver: docker |
| 90 | + |
| 91 | + - name: Log in to the Container registry |
| 92 | + uses: docker/login-action@v3 |
| 93 | + with: |
| 94 | + registry: ${{ env.REGISTRY }} |
| 95 | + username: ${{ github.actor }} |
| 96 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 97 | + |
| 98 | + - name: Extract metadata (tags, labels) for Docker |
| 99 | + id: meta |
| 100 | + uses: docker/metadata-action@v5 |
| 101 | + with: |
| 102 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 103 | + |
| 104 | + - name: Build and push Docker image |
| 105 | + uses: docker/build-push-action@v6 |
| 106 | + with: |
| 107 | + context: . |
| 108 | + build-args: | |
| 109 | + KONSTRAINT_VER="${{ env.DOCKER_METADATA_OUTPUT_VERSION }}" |
| 110 | + push: false |
| 111 | + tags: ${{ steps.meta.outputs.tags }} |
| 112 | + labels: ${{ steps.meta.outputs.labels }} |
84 | 113 |
|
85 | 114 | - name: test create command |
86 | | - run: docker run -v $PWD:/konstraint konstraint create /konstraint/examples |
| 115 | + run: docker run -v $PWD:/konstraint ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DOCKER_METADATA_OUTPUT_VERSION }} create /konstraint/examples |
87 | 116 |
|
88 | 117 | - name: test doc command |
89 | | - run: docker run -v $PWD:/konstraint konstraint doc /konstraint/examples |
| 118 | + run: docker run -v $PWD:/konstraint ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DOCKER_METADATA_OUTPUT_VERSION }} doc /konstraint/examples |
90 | 119 |
|
91 | 120 | policy-checks: |
92 | 121 | name: Policy Checks |
|
0 commit comments