Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions .github/actions/build-push-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ inputs:
description: "dockerfile to build"
required: true
image-name:
description: ""
description: "image name (without registry)"
required: true
username:
required: false
default: ""
password:
required: false
default: ""
outputs:
branch:
description: "Branch name for the PR"
Expand All @@ -29,6 +35,7 @@ runs:
shell: bash
env:
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.105"
IMAGE_TAG: europe-docker.pkg.dev/parity-ci-2024/temp-images/${{ inputs.image-name }}
run: |
export DOCKER_IMAGES_VERSION=${{ github.event.pull_request.head.sha }}
if [[ ${{ github.event_name }} == "merge_group" ]]; then export DOCKER_IMAGES_VERSION="${GITHUB_SHA::8}"; fi
Expand All @@ -37,7 +44,27 @@ runs:
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
--build-arg IMAGE_NAME="${{ inputs.image-name }}" \
--build-arg ZOMBIENET_IMAGE="${ZOMBIENET_IMAGE}" \
-t "${{ inputs.image-name }}:$DOCKER_IMAGES_VERSION" \
-t "${{ env.IMAGE_TAG }}:$DOCKER_IMAGES_VERSION" \
-f ${{ inputs.dockerfile }} \
.
docker push "${{ inputs.image-name }}:$DOCKER_IMAGES_VERSION"
docker push "${{ env.IMAGE_TAG }}:$DOCKER_IMAGES_VERSION"

- name: login to dockerhub
id: login
# fork check
if: ${{ inputs.username != '' && inputs.password != '' && github.event_name != 'merge_group' }}
uses: docker/login-action@v3
with:
username: ${{ inputs.username }}
password: ${{ inputs.password }}

- name: push to dockerhub
shell: bash
if: ${{ inputs.username != '' && inputs.password != '' && github.event_name != 'merge_group' }}
run: |
export DOCKER_IMAGES_VERSION=${{ github.event.pull_request.head.sha }}
export DOCKERHUB_TAG=docker.io/paritypr/${{ inputs.image-name }}:${{ github.event.pull_request.number || 'master' }}-${GITHUB_SHA::8}
docker tag "europe-docker.pkg.dev/parity-ci-2024/temp-images/${{ inputs.image-name }}:$DOCKER_IMAGES_VERSION" $DOCKERHUB_TAG
docker push $DOCKERHUB_TAG


28 changes: 21 additions & 7 deletions .github/workflows/build-publish-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,10 @@ jobs:
- name: build and push image
uses: ./.github/actions/build-push-image
with:
image-name: "europe-docker.pkg.dev/parity-ci-2024/temp-images/test-parachain"
image-name: "test-parachain"
dockerfile: "docker/dockerfiles/test-parachain_injected.Dockerfile"
username: ${{ secrets.PARITYPR_DOCKERHUB_USERNAME }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's going to fail for PRs from forks. I'd add a separate job that'll push images for master only.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need optional image push from PR branches not only master.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated, now login/push only if secrets are present

password: ${{ secrets.PARITYPR_DOCKERHUB_PASSWORD }}

#
#
Expand All @@ -441,8 +443,10 @@ jobs:
- name: build and push image
uses: ./.github/actions/build-push-image
with:
image-name: "europe-docker.pkg.dev/parity-ci-2024/temp-images/polkadot-debug"
image-name: "polkadot-debug"
dockerfile: "docker/dockerfiles/polkadot/polkadot_injected_debug.Dockerfile"
username: ${{ secrets.PARITYPR_DOCKERHUB_USERNAME }}
password: ${{ secrets.PARITYPR_DOCKERHUB_PASSWORD }}

#
#
Expand All @@ -465,8 +469,10 @@ jobs:
- name: build and push image
uses: ./.github/actions/build-push-image
with:
image-name: "europe-docker.pkg.dev/parity-ci-2024/temp-images/colander"
image-name: "colander"
dockerfile: "docker/dockerfiles/collator_injected.Dockerfile"
username: ${{ secrets.PARITYPR_DOCKERHUB_USERNAME }}
password: ${{ secrets.PARITYPR_DOCKERHUB_PASSWORD }}

#
#
Expand All @@ -489,8 +495,10 @@ jobs:
- name: build and push image
uses: ./.github/actions/build-push-image
with:
image-name: "europe-docker.pkg.dev/parity-ci-2024/temp-images/malus"
image-name: "malus"
dockerfile: "docker/dockerfiles/malus_injected.Dockerfile"
username: ${{ secrets.PARITYPR_DOCKERHUB_USERNAME }}
password: ${{ secrets.PARITYPR_DOCKERHUB_PASSWORD }}

#
#
Expand All @@ -513,8 +521,10 @@ jobs:
- name: build and push image
uses: ./.github/actions/build-push-image
with:
image-name: "europe-docker.pkg.dev/parity-ci-2024/temp-images/substrate"
image-name: "substrate"
dockerfile: "docker/dockerfiles/substrate_injected.Dockerfile"
username: ${{ secrets.PARITYPR_DOCKERHUB_USERNAME }}
password: ${{ secrets.PARITYPR_DOCKERHUB_PASSWORD }}

#
#
Expand Down Expand Up @@ -562,8 +572,10 @@ jobs:
- name: build and push image
uses: ./.github/actions/build-push-image
with:
image-name: "europe-docker.pkg.dev/parity-ci-2024/temp-images/bridges-zombienet-tests"
image-name: "bridges-zombienet-tests"
dockerfile: "docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile"
username: ${{ secrets.PARITYPR_DOCKERHUB_USERNAME }}
password: ${{ secrets.PARITYPR_DOCKERHUB_PASSWORD }}

#
#
Expand All @@ -586,8 +598,10 @@ jobs:
- name: build and push image
uses: ./.github/actions/build-push-image
with:
image-name: "europe-docker.pkg.dev/parity-ci-2024/temp-images/polkadot-parachain-debug"
image-name: "polkadot-parachain-debug"
dockerfile: "docker/dockerfiles/polkadot-parachain/polkadot-parachain-debug_unsigned_injected.Dockerfile"
username: ${{ secrets.PARITYPR_DOCKERHUB_USERNAME }}
password: ${{ secrets.PARITYPR_DOCKERHUB_PASSWORD }}

confirm-required-build-jobs-passed:
runs-on: ubuntu-latest
Expand Down
Loading