Skip to content

Commit

Permalink
Separate each build in its own job (#6)
Browse files Browse the repository at this point in the history
Co-authored-by: Mohamadamin Karami <mohamadamin.karami@divar.ir>
  • Loading branch information
mohamadaminkarami and Mohamadamin Karami authored Nov 20, 2024
1 parent 8c0f2b7 commit cf48d44
Showing 1 changed file with 200 additions and 32 deletions.
232 changes: 200 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
RELEASE: ${{ github.event.release.tag_name || 'latest' }}

jobs:
build-base-images:
build-dish-pash-base:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -41,6 +41,25 @@ jobs:
docker push binpash/dish-pash-base:${{ env.RELEASE }}
docker push binpash/dish-pash-base:latest
build-hadoop-pash-base:
runs-on: ubuntu-latest
needs: build-dish-pash-base

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and tag hadoop pash base image
run: |
cd docker-hadoop
Expand All @@ -57,36 +76,79 @@ jobs:
docker push binpash/hadoop-pash-base:${{ env.RELEASE }}
docker push binpash/hadoop-pash-base:latest
build-dependant-images:
build-hadoop-namenode:
runs-on: ubuntu-latest
needs: build-base-images
needs: build-hadoop-pash-base

strategy:
matrix:
image:
- name: hadoop-namenode
path: ./namenode
base_image: hadoop-pash-base
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: hadoop-datanode
path: ./datanode
base_image: hadoop-pash-base
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: hadoop-resourcemanager
path: ./resourcemanager
base_image: hadoop-pash-base
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and tag hadoop namenode image
run: |
cd docker-hadoop
- name: hadoop-nodemanager
path: ./nodemanager
base_image: hadoop-pash-base
docker build -t binpash/hadoop-namenode:${{ env.RELEASE }} ./namenode \
--build-arg RELEASE=${{ env.RELEASE }} --build-arg BASE=binpash/hadoop-pash-base
- name: hadoop-historyserver
path: ./historyserver
base_image: hadoop-pash-base
# Tag the image with 'latest'
docker tag binpash/hadoop-namenode:${{ env.RELEASE }} \
binpash/hadoop-namenode:latest
- name: hadoop-submit
path: ./submit
base_image: hadoop-pash-base
- name: Push hadoop namenode image
run: |
docker push binpash/hadoop-namenode:${{ env.RELEASE }}
docker push binpash/hadoop-namenode:latest
build-hadoop-datanode:
runs-on: ubuntu-latest
needs: build-hadoop-pash-base

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and tag hadoop datanode image
run: |
cd docker-hadoop
docker build -t binpash/hadoop-datanode:${{ env.RELEASE }} ./datanode \
--build-arg RELEASE=${{ env.RELEASE }} --build-arg BASE=binpash/hadoop-pash-base
# Tag the image with 'latest'
docker tag binpash/hadoop-datanode:${{ env.RELEASE }} \
binpash/hadoop-datanode:latest
- name: Push hadoop datanode image
run: |
docker push binpash/hadoop-datanode:${{ env.RELEASE }}
docker push binpash/hadoop-datanode:latest
build-hadoop-resourcemanager:
runs-on: ubuntu-latest
needs: build-hadoop-pash-base

steps:
- name: Checkout code
Expand All @@ -103,16 +165,122 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and tag Docker image
- name: Build and tag hadoop resourcemanager image
run: |
cd docker-hadoop
# Build Image
docker build -t binpash/${{ matrix.image.name }}:${{ env.RELEASE }} ${{ matrix.image.path }} \
--build-arg RELEASE=${{ env.RELEASE }} --build-arg BASE=binpash/${{ matrix.image.base_image }}
docker build -t binpash/hadoop-resourcemanager:${{ env.RELEASE }} ./resourcemanager \
--build-arg RELEASE=${{ env.RELEASE }} --build-arg BASE=binpash/hadoop-pash-base
# Tag the image with 'latest'
docker tag binpash/${{ matrix.image.name }}:${{ env.RELEASE }} binpash/${{ matrix.image.name }}:latest
- name: Push Docker image
docker tag binpash/hadoop-resourcemanager:${{ env.RELEASE }} \
binpash/hadoop-resourcemanager:latest
- name: Push hadoop resourcemanager image
run: |
docker push binpash/hadoop-resourcemanager:${{ env.RELEASE }}
docker push binpash/hadoop-resourcemanager:latest
build-hadoop-nodemanager:
runs-on: ubuntu-latest
needs: build-hadoop-pash-base

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and tag hadoop nodemanager image
run: |
cd docker-hadoop
docker build -t binpash/hadoop-nodemanager:${{ env.RELEASE }} ./nodemanager \
--build-arg RELEASE=${{ env.RELEASE }} --build-arg BASE=binpash/hadoop-pash-base
docker tag binpash/hadoop-nodemanager:${{ env.RELEASE }} /
binpash/hadoop-nodemanager:latest
- name: Push hadoop nodemanager image
run: |
docker push binpash/hadoop-nodemanager:${{ env.RELEASE }}
docker push binpash/hadoop-nodemanager:latest
build-hadoop-historyserver:
runs-on: ubuntu-latest
needs: build-hadoop-pash-base

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and tag hadoop historyserver image
run: |
cd docker-hadoop
docker build -t binpash/hadoop-historyserver:${{ env.RELEASE }} ./historyserver \
--build-arg RELEASE=${{ env.RELEASE }} --build-arg BASE=binpash/hadoop-pash-base
# Tag the image with 'latest'
docker tag binpash/hadoop-historyserver:${{ env.RELEASE }} \
binpash/hadoop-historyserver:latest
- name: Push hadoop historyserver image
run: |
docker push binpash/hadoop-historyserver:${{ env.RELEASE }}
docker push binpash/hadoop-historyserver:latest
build-hadoop-submit:
runs-on: ubuntu-latest
needs: build-hadoop-pash-base

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and tag hadoop submit image
run: |
cd docker-hadoop
docker build -t binpash/hadoop-submit:${{ env.RELEASE }} ./submit \
--build-arg RELEASE=${{ env.RELEASE }} --build-arg BASE=binpash/hadoop-pash-base
# Tag the image with 'latest'
docker tag binpash/hadoop-submit:${{ env.RELEASE }} \
binpash/hadoop-submit:latest
- name: Push hadoop submit image
run: |
docker push binpash/${{ matrix.image.name }}:${{ env.RELEASE }}
docker push binpash/${{ matrix.image.name }}:latest
docker push binpash/hadoop-submit:${{ env.RELEASE }}
docker push binpash/hadoop-submit:latest

0 comments on commit cf48d44

Please sign in to comment.