forked from instana/robot-shop
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Killpit/master
Add 6 CI/CD pipelines for microservices
- Loading branch information
Showing
6 changed files
with
256 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Cart | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- '**.js' # Only trigger on changes to Python files (**.py) | ||
- '.github/workflows/cart.yaml' # Include workflow file changes | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- '**.js' # Only trigger on changes to Python files (**.py) | ||
- '.github/workflows/cart.yaml' # Include workflow file changes | ||
|
||
jobs: | ||
payment: | ||
name: Build and deploy cart microservice | ||
runs-on: [self-hosted] # Use a standard runner instead of self-hosted | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: NPM install | ||
run: npm install | ||
|
||
- name: Build Docker image | ||
run: | | ||
docker build -t cart . # Build image tagged as 'payment' from current directory | ||
- name: Docker Login (use secrets) | ||
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Docker Push | ||
run: | | ||
docker tag cart ${name}/cart:latest | ||
docker push ${name}/cart:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Catalogue | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- '**.js' # Only trigger on changes to Python files (**.py) | ||
- '.github/workflows/catalogue.yaml' # Include workflow file changes | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- '**.js' # Only trigger on changes to Python files (**.py) | ||
- '.github/workflows/catalogue.yaml' # Include workflow file changes | ||
|
||
jobs: | ||
payment: | ||
name: Build and deploy catalogue microservice | ||
runs-on: [self-hosted] # Use a standard runner instead of self-hosted | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: NPM install | ||
run: npm install | ||
|
||
- name: Build Docker image | ||
run: | | ||
docker build -t catalogue . # Build image tagged as 'payment' from current directory | ||
- name: Docker Login (use secrets) | ||
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Docker Push | ||
run: | | ||
docker tag catalogue ${name}/catalogue:latest | ||
docker catalogue ${name}/catalogue:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Dispatch | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- '**.go' # Only trigger on changes to Python files (**.py) | ||
- '.github/workflows/dispatch.yaml' # Include workflow file changes | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- '**.go' # Only trigger on changes to Python files (**.py) | ||
- '.github/workflows/dispatch.yaml' # Include workflow file changes | ||
|
||
jobs: | ||
payment: | ||
name: Build and deploy dispatch microservice | ||
runs-on: [self-hosted] # Use a standard runner instead of self-hosted | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Go install | ||
run: | | ||
curl -sL https://dl.google.com/go/go1.18.linux-amd64.tar.gz | | ||
export PATH=$PATH:/home/runner/go/bin | ||
- name: Build Docker image | ||
run: | | ||
docker build -t payment . # Build image tagged as 'payment' from current directory | ||
- name: Docker Login (use secrets) | ||
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Docker Push | ||
run: | | ||
docker tag dispatch ${name}/dispatch:latest | ||
docker push ${name}/dispatch:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Payment | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- '**.py' # Only trigger on changes to Python files (**.py) | ||
- '.github/workflows/payment.yaml' # Include workflow file changes | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- '**.py' # Only trigger on changes to Python files (**.py) | ||
- '.github/workflows/payment.yaml' # Include workflow file changes | ||
|
||
jobs: | ||
payment: | ||
name: Build and deploy payment microservice | ||
runs-on: [self-hosted] # Use a standard runner instead of self-hosted | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Python install | ||
run: sudo apt-get install python3 | ||
|
||
- name: Build Docker image | ||
run: | | ||
docker build -t payment . # Build image tagged as 'payment' from current directory | ||
- name: Docker Login (use secrets) | ||
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Docker Push | ||
run: | | ||
docker tag payment ${name}/payment:latest | ||
docker push ${name}/payment:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Dispatch | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- '**.java' # Only trigger on changes to Python files (**.py) | ||
- '.github/workflows/shipping.yaml' # Include workflow file changes | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- '**.java' # Only trigger on changes to Python files (**.py) | ||
- '.github/workflows/shipping.yaml' # Include workflow file changes | ||
|
||
jobs: | ||
payment: | ||
name: Build and deploy shipping microservice | ||
runs-on: [self-hosted] # Use a standard runner instead of self-hosted | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Go install | ||
run: | | ||
sudo apt-get install openjdk 17 | | ||
java -version | ||
- name: Build Docker image | ||
run: | | ||
docker build -t shipping . | ||
- name: Docker Login (use secrets) | ||
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Docker Push | ||
run: | | ||
docker tag shipping ${name}/shipping:latest | ||
docker push ${name}/shipping:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: User | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- '**.js' # Only trigger on changes to Python files (**.py) | ||
- '.github/workflows/user.yaml' # Include workflow file changes | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- '**.js' # Only trigger on changes to Python files (**.py) | ||
- '.github/workflows/user.yaml' # Include workflow file changes | ||
|
||
jobs: | ||
payment: | ||
name: Build and deploy user microservice | ||
runs-on: [self-hosted] # Use a standard runner instead of self-hosted | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: NPM install | ||
run: npm install | ||
|
||
- name: Build Docker image | ||
run: | | ||
docker build -t user . # Build image tagged as 'payment' from current directory | ||
- name: Docker Login (use secrets) | ||
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Docker Push | ||
run: | | ||
docker tag user ${name}/user:latest | ||
docker user ${name}/user:latest |