diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a34c1d6..e2056f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,13 +41,13 @@ jobs: tags: bde2020/spark-base:${{env.DOCKER_IMAGE_TAG}} push: ${{ github.event_name != 'pull_request' }} - master_worker_submit: + master_worker: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - base: [master, worker, submit] + image: [master, worker] needs: 'base' steps: @@ -75,13 +75,56 @@ jobs: [ "$IMAGE_TAG" == "master" ] && IMAGE_TAG=latest echo "DOCKER_IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV - - name: Build and push Spark maser, worker and submit image + - name: Build and push Spark maser and worker image id: docker_build_maser_worker_submit_image uses: docker/build-push-action@v2 with: - context: ${{ matrix.base }} - file: ${{ matrix.base }}/Dockerfile - tags: bde2020/spark-${{ matrix.base }}:${{env.DOCKER_IMAGE_TAG}} + context: ${{ matrix.image }} + file: ${{ matrix.image }}/Dockerfile + tags: bde2020/spark-${{ matrix.image }}:${{env.DOCKER_IMAGE_TAG}} + push: ${{ github.event_name != 'pull_request' }} + + submit: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + image: [submit] + + needs: 'base' + steps: + + - name: Check Out Repo + uses: actions/checkout@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Get branch names + id: branch-name + uses: tj-actions/branch-names@v5 + + - name: Sets env vars for image_tag + run: | + IMAGE_TAG=${{ steps.branch-name.outputs.current_branch }} + [ "$IMAGE_TAG" == "master" ] && IMAGE_TAG=latest + echo "DOCKER_IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV + + - name: Build and push Spark submit image + id: docker_build_maser_worker_submit_image + uses: docker/build-push-action@v2 + with: + context: ${{ matrix.image }} + file: ${{ matrix.image }}/Dockerfile + tags: bde2020/spark-${{ matrix.image }}:${{env.DOCKER_IMAGE_TAG}} push: ${{ github.event_name != 'pull_request' }} template: @@ -92,7 +135,7 @@ jobs: matrix: template: [java, scala, python] - needs: 'base' + needs: 'submit' steps: - name: Check Out Repo @@ -125,4 +168,4 @@ jobs: context: template/${{ matrix.template }} file: template/${{ matrix.template }}/Dockerfile tags: bde2020/spark-${{ matrix.template }}-template:${{env.DOCKER_IMAGE_TAG}} - push: ${{ github.event_name != 'pull_request' }} \ No newline at end of file + push: ${{ github.event_name != 'pull_request' }}