diff --git a/.github/actions/bake-test-push/action.yml b/.github/actions/bake-test-push/action.yml index dfbca7d4..066e0bc9 100644 --- a/.github/actions/bake-test-push/action.yml +++ b/.github/actions/bake-test-push/action.yml @@ -4,6 +4,11 @@ inputs: description: Target or group to bake required: true type: string + bakefile: + description: Path to the bakefile + required: true + default: "docker-bake.hcl" + type: string env-vars: description: A semicolon delimited list of environment variables to set as overrides for the bake definition required: false @@ -99,14 +104,16 @@ runs: with: targets: "${{ inputs.target }}" push: false + files: ${{ inputs.bakefile }} - name: Test shell: bash run: | - just test "${{ inputs.target }}" + just test "${{ inputs.target }}" "${{ inputs.bakefile }}" - name: Push - ${{ inputs.push-image }} uses: docker/bake-action@v4 with: targets: "${{ inputs.target }}" push: ${{ inputs.push-image }} + files: ${{ inputs.bakefile }} diff --git a/.github/workflows/build-bake-preview.yaml b/.github/workflows/build-bake-preview.yaml index b16a0cf9..01ad249a 100644 --- a/.github/workflows/build-bake-preview.yaml +++ b/.github/workflows/build-bake-preview.yaml @@ -96,26 +96,15 @@ jobs: with: buildkitd-config: ./share/buildkitd.toml - - name: Build - id: build - uses: docker/bake-action@v4 - with: - targets: ${{ env.target }} - push: false - files: docker-bake.preview.hcl - - - name: Test - run: | - just preview-test "${{ env.target }}" - - - name: Push - id: push - if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/dev-rspm' }} - uses: docker/bake-action@v4 - with: - targets: ${{ env.target }} - push: true - files: docker-bake.preview.hcl + - name: Build, Test, and Push + uses: ./.github/actions/bake-test-push + with: + target: ${{ env.target }} + bakefile: docker-bake.preview.hcl + push-image: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/dev-rspm' }} + ghcr-token: ${{ secrets.GITHUB_TOKEN }} + dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - name: Export artifacts run: | diff --git a/Justfile b/Justfile index a0f98b58..407442a6 100644 --- a/Justfile +++ b/Justfile @@ -83,8 +83,8 @@ preview-plan branch="$(git branch --show-current)": # Run tests # just test workbench -test target="default": - python3 {{justfile_directory()}}/tools/test_bake_artifacts.py --target "{{target}}" +test target="default" file="docker-bake.hcl": + python3 {{justfile_directory()}}/tools/test_bake_artifacts.py --target "{{target}}" --file "{{file}}" # just preview-test connect dev preview-test target="default" branch="$(git branch --show-current)":