This is an automated email from the ASF dual-hosted git repository. yikun pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark-docker.git
The following commit(s) were added to refs/heads/master by this push: new cfcbeac [SPARK-41287][INFRA] Add test workflow to help self-build image test in fork repo cfcbeac is described below commit cfcbeac5d2b922a5ee7dfd2b4a5cf08072c827b7 Author: Yikun Jiang <yikunk...@gmail.com> AuthorDate: Mon Nov 28 17:55:18 2022 +0800 [SPARK-41287][INFRA] Add test workflow to help self-build image test in fork repo ### What changes were proposed in this pull request? This patch adds a test workflow to help fork repo to test image in their fork repos. ![image](https://user-images.githubusercontent.com/1736354/204183109-e2341397-251e-42a0-b5f7-c1c1f9334ff9.png) such like: - https://github.com/Yikun/spark-docker/actions/runs/3552072792/jobs/5966742869 - https://github.com/Yikun/spark-docker/actions/runs/3561513498/jobs/5982485960 ### Why are the changes needed? Help devs/users test their own image in their fork repo ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Test in my fork repo: https://github.com/Yikun/spark-docker/actions/workflows/test.yml Closes #26 from Yikun/test-workflow. Authored-by: Yikun Jiang <yikunk...@gmail.com> Signed-off-by: Yikun Jiang <yikunk...@gmail.com> --- .github/workflows/main.yml | 28 +++++++++++-- .github/workflows/publish.yml | 2 +- .github/workflows/{publish.yml => test.yml} | 62 ++++++++++++++++------------- 3 files changed, 60 insertions(+), 32 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ebafcdc..fd37990 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,13 +37,18 @@ on: required: true type: string default: 11 + build: + description: Build the image or not. + required: false + type: boolean + default: true publish: description: Publish the image or not. required: false type: boolean default: false repository: - description: The registry to be published (Avaliable only when publish is selected). + description: The registry to be published/tested. (Available only in publish/test workflow) required: false type: string default: ghcr.io/apache/spark-docker @@ -52,6 +57,11 @@ on: required: false type: string default: python + image-tag: + type: string + description: The image tag to be tested. (Available only in test workflow) + required: false + default: latest jobs: main: @@ -83,11 +93,18 @@ jobs: esac TAG=scala${{ inputs.scala }}-java${{ inputs.java }}-$SUFFIX - REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') - TEST_REPO=localhost:5000/$REPO_OWNER/spark-docker IMAGE_NAME=spark IMAGE_PATH=${{ inputs.spark }}/$TAG - UNIQUE_IMAGE_TAG=${{ inputs.spark }}-$TAG + if [ "${{ inputs.build }}" == "true" ]; then + # Use the local registry to build and test + REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') + TEST_REPO=localhost:5000/$REPO_OWNER/spark-docker + UNIQUE_IMAGE_TAG=${{ inputs.spark }}-$TAG + else + # Use specified {repository}/spark:{image-tag} image to test + TEST_REPO=${{ inputs.repository }} + UNIQUE_IMAGE_TAG=${{ inputs.image-tag }} + fi IMAGE_URL=$TEST_REPO/$IMAGE_NAME:$UNIQUE_IMAGE_TAG PUBLISH_REPO=${{ inputs.repository }} @@ -119,15 +136,18 @@ jobs: echo "PUBLISH_IMAGE_URL:"${PUBLISH_IMAGE_URL} - name: Build - Set up QEMU + if: ${{ inputs.build }} uses: docker/setup-qemu-action@v2 - name: Build - Set up Docker Buildx + if: ${{ inputs.build }} uses: docker/setup-buildx-action@v2 with: # This required by local registry driver-opts: network=host - name: Build - Build and push test image + if: ${{ inputs.build }} uses: docker/build-push-action@v3 with: context: ${{ env.IMAGE_PATH }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4a07f5d..2941cfb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -36,7 +36,7 @@ on: type: boolean required: true repository: - description: The registry to be published (Avaliable only when publish is true). + description: The registry to be published (Available only when publish is true). required: false default: ghcr.io/apache/spark-docker type: choice diff --git a/.github/workflows/publish.yml b/.github/workflows/test.yml similarity index 57% copy from .github/workflows/publish.yml copy to .github/workflows/test.yml index 4a07f5d..efb401b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ # under the License. # -name: "Publish" +name: "Test" on: workflow_dispatch: @@ -25,44 +25,52 @@ on: spark: description: 'The Spark version of Spark image.' required: true - default: '3.3.0' + default: '3.3.1' type: choice options: - 3.3.0 - 3.3.1 - publish: - description: 'Publish the image or not.' - default: false - type: boolean + java: + description: 'The Java version of Spark image.' + default: 11 + type: string required: true - repository: - description: The registry to be published (Avaliable only when publish is true). - required: false - default: ghcr.io/apache/spark-docker + scala: + description: 'The Scala version of Spark image.' + default: 2.12 + type: string + required: true + image-type: + description: 'The image type of Spark image.' + required: true + default: 'python' type: choice options: - # GHCR: This required the write permission of apache/spark-docker (Spark Committer) - - ghcr.io/apache/spark-docker - # Dockerhub: This required the DOCKERHUB_TOKEN and DOCKERHUB_USER (Spark Committer) - - apache + - all + - python + - scala + - r + repository: + description: The registry to be tested. + required: true + type: string + default: ghcr.io/apache/spark-docker + image-tag: + description: 'The image tag to be tested.' + default: latest + type: string + required: true jobs: run-build: - # if: startsWith(inputs.spark, '3.3') - strategy: - matrix: - scala: [2.12] - java: [11] - image-type: ["all", "python", "scala", "r"] - permissions: - packages: write - name: Run + name: Test ${{ inputs.repository }}/spark:${{ inputs.image-tag }} secrets: inherit uses: ./.github/workflows/main.yml with: spark: ${{ inputs.spark }} - scala: ${{ matrix.scala }} - java: ${{ matrix.java }} - publish: ${{ inputs.publish }} + scala: ${{ inputs.scala }} + java: ${{ inputs.java }} repository: ${{ inputs.repository }} - image-type: ${{ matrix.image-type }} + image-tag: ${{ inputs.image-tag }} + image-type: ${{ inputs.image-type }} + build: false --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org