Skip to content

Commit 02f1cb7

Browse files
authored
Merge pull request #3 from SheplX/stage
Stage
2 parents 78617f6 + 7e49a6d commit 02f1cb7

File tree

7 files changed

+53
-54
lines changed

7 files changed

+53
-54
lines changed

.github/workflows/Backend.CI.yaml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: TODO-FRONTEND-TEST
1+
name: TODO-FRONTEND-CI
22
on:
33
push:
44
# paths:
@@ -17,14 +17,12 @@ on:
1717

1818
env:
1919
BACKEND_IMAGE: backend
20-
SHORT_SHA: ${GITHUB_SHA::7}
2120

2221
jobs:
2322
TODO-BACKEND-CI:
2423
runs-on: ubuntu-latest
25-
env:
26-
SHA12: ${GITHUB_SHA::12}
2724
steps:
25+
2826
- name: Checkout code
2927
uses: actions/checkout@v2
3028

@@ -57,7 +55,6 @@ jobs:
5755
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
5856

5957
- name: Push Image Tag
60-
id: push_image_tag
6158
run: |
6259
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$BACKEND_IMAGE
6360
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
@@ -66,40 +63,40 @@ jobs:
6663
echo VERSION=$VERSION
6764
docker tag $BACKEND_IMAGE $IMAGE_ID:$VERSION
6865
docker push $IMAGE_ID:$VERSION
69-
echo "::set-output name=VERSION::$VERSION"
66+
echo "VERSION=$VERSION" >> $GITHUB_ENV
7067
7168
- name: Update Helm Chart Values at Main
7269
if: ${{ github.ref == 'refs/heads/main'}}
7370
uses: Nextdoor/helm-set-image-tag-action@main
7471
with:
7572
values_files: charts/values.yaml
7673
tag_keys: .backend.tag
77-
tag_value: ${{ steps.push_image_tag.outputs.VERSION }}
74+
tag_value: ${{ env.VERSION }}
7875
commit_branch: ${{ github.ref }}
79-
commit_tag: Todo-Main-Charts-V-${{ steps.push_image_tag.outputs.VERSION }}
80-
commit_message: "Backend update: Tag '${{ steps.push_image_tag.outputs.VERSION }}' added"
76+
commit_tag: Todo-Main-Charts-V-${{ env.VERSION }}
77+
commit_message: "Backend update: Tag '${{ env.VERSION }}' added"
8178

8279
- name: Update Helm Chart Values at Stage
8380
if: ${{ github.ref == 'refs/heads/stage'}}
8481
uses: Nextdoor/helm-set-image-tag-action@main
8582
with:
8683
values_files: charts/values.yaml
8784
tag_keys: .backend.tag
88-
tag_value: ${{ steps.push_image_tag.outputs.VERSION }}
85+
tag_value: ${{ env.VERSION }}
8986
commit_branch: ${{ github.ref }}
90-
commit_tag: Todo-Stage-Charts-V-${{ steps.push_image_tag.outputs.VERSION }}
91-
commit_message: "Backend update: Tag '${{ steps.push_image_tag.outputs.VERSION }}' added"
87+
commit_tag: Todo-Stage-Charts-V-${{ env.VERSION }}
88+
commit_message: "Backend update: Tag '${{ env.VERSION }}' added"
9289

9390
- name: Update Helm Chart Values at Dev
9491
if: ${{ github.ref == 'refs/heads/dev'}}
9592
uses: Nextdoor/helm-set-image-tag-action@main
9693
with:
9794
values_files: charts/values.yaml
9895
tag_keys: .backend.tag
99-
tag_value: ${{ steps.push_image_tag.outputs.VERSION }}
96+
tag_value: ${{ env.VERSION }}
10097
commit_branch: ${{ github.ref }}
101-
commit_tag: Todo-Dev-Charts-V-${{ steps.push_image_tag.outputs.VERSION }}
102-
commit_message: "Backend update: Tag '${{ steps.push_image_tag.outputs.VERSION }}' added"
98+
commit_tag: Todo-Dev-Charts-V-${{ env.VERSION }}
99+
commit_message: "Backend update: Tag '${{ env.VERSION }}' added"
103100

104101
# - name: 'Updating Helm Charts values on branch main'
105102
# if: ${{ github.ref == 'refs/heads/main' }}

.github/workflows/Frontend.CI.yaml

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: TODO-FRONTEND-CI
22
on:
33
push:
4-
paths:
5-
- 'frontend/**'
4+
# paths:
5+
# - 'frontend/**'
66
branches:
77
- main
88
- dev
@@ -11,41 +11,42 @@ on:
1111
branches:
1212
- main
1313
- dev
14-
paths:
15-
- 'frontend/**'
14+
- stage
15+
# paths:
16+
# - 'frontend/**'
1617

1718
env:
1819
FRONTEND_IMAGE: frontend
1920

2021
jobs:
2122
TODO-FRONTEND-CI:
2223
runs-on: ubuntu-latest
24+
2325
steps:
26+
2427
- name: Checkout code
2528
uses: actions/checkout@v2
2629

27-
- name: Get changed files in the Frontend folder
30+
- name: Check Changed Files In Frontend Folder
2831
id: frontend
2932
uses: tj-actions/changed-files@v35
3033
with:
3134
files: ${{ env.FRONTEND_IMAGE }}/**
3235

33-
- name: Frontend changed files
36+
- name: Changed Files
3437
if: steps.frontend.outputs.any_changed == 'true'
3538
run: |
3639
echo "Changed Files: ${{ steps.frontend.outputs.all_changed_files }}"
3740
38-
- name: Build Docker image
39-
working-directory: frontend/
41+
- name: Build Frontend Docker Image
42+
working-directory: frontend/events
4043
run: docker build -t $FRONTEND_IMAGE .
4144

4245
- name: Scan Frontend Image
43-
if: steps.frontend.outputs.any_changed == 'true'
4446
uses: aquasecurity/trivy-action@master
4547
with:
4648
image-ref: ${{ env.FRONTEND_IMAGE }}
47-
format: sarif
48-
output: 'console'
49+
format: 'table'
4950
exit-code: '0'
5051
ignore-unfixed: true
5152
vuln-type: 'os,library'
@@ -55,49 +56,49 @@ jobs:
5556
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
5657

5758
- name: Push Image Tag
59+
id: tag
5860
run: |
5961
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$FRONTEND_IMAGE
6062
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
61-
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
62-
VERSION=$GITHUB_SHA
63-
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
63+
VERSION=${GITHUB_SHA:0:7}
6464
echo IMAGE_ID=$IMAGE_ID
65-
echo VERSION=$GITHUB_SHA
65+
echo VERSION=$VERSION
6666
docker tag $FRONTEND_IMAGE $IMAGE_ID:$VERSION
6767
docker push $IMAGE_ID:$VERSION
68+
echo "VERSION=$VERSION" >> $GITHUB_ENV
6869
69-
- name: Update Frontend Helm chart values if main
70-
if: github.ref == 'refs/heads/main'
70+
- name: Update Helm Chart Values at Main
71+
if: ${{ github.ref == 'refs/heads/main'}}
7172
uses: Nextdoor/helm-set-image-tag-action@main
7273
with:
7374
values_files: charts/values.yaml
74-
tag_keys: .backend.tag
75-
tag_value: ${{ github.sha }}
75+
tag_keys: .frontend.tag
76+
tag_value: ${{ env.VERSION }}
7677
commit_branch: ${{ github.ref }}
77-
commit_tag: ${{ github.ref }}-chart
78-
commit_message: Tag ${{ github.sha }} Updated On Charts !
79-
80-
- name: Update Frontend Helm chart values if stage
81-
if: github.ref == 'refs/heads/stage'
78+
commit_tag: Todo-Main-Charts-V-${{ env.VERSION }}
79+
commit_message: "Frontend update: Tag '${{ env.VERSION }}' added"
80+
81+
- name: Update Helm Chart Values at Stage
82+
if: ${{ github.ref == 'refs/heads/stage'}}
8283
uses: Nextdoor/helm-set-image-tag-action@main
8384
with:
8485
values_files: charts/values.yaml
8586
tag_keys: .frontend.tag
86-
tag_value: ${{ github.sha }}
87+
tag_value: ${{ env.VERSION }}
8788
commit_branch: ${{ github.ref }}
88-
commit_tag: ${{ github.ref }}-chart
89-
commit_message: Tag ${{ github.sha }} Updated On Charts !
89+
commit_tag: Todo-Stage-Charts-V-${{ env.VERSION }}
90+
commit_message: "Frontend update: Tag '${{ env.VERSION }}' added"
9091

91-
- name: Update Frontend Helm chart values if dev
92-
if: github.ref == 'refs/heads/dev'
92+
- name: Update Helm Chart Values at Dev
93+
if: ${{ github.ref == 'refs/heads/dev'}}
9394
uses: Nextdoor/helm-set-image-tag-action@main
9495
with:
9596
values_files: charts/values.yaml
9697
tag_keys: .frontend.tag
97-
tag_value: ${{ github.sha }}
98+
tag_value: ${{ env.VERSION }}
9899
commit_branch: ${{ github.ref }}
99-
commit_tag: ${{ github.ref }}-chart
100-
commit_message: Tag ${{ github.sha }} Updated On Charts !
100+
commit_tag: Todo-Dev-Charts-V-${{ env.VERSION }}
101+
commit_message: "Frontend update: Tag '${{ env.VERSION }}' added"
101102

102103
# - name: 'Updating Helm Charts values on branch main'
103104
# if: ${{ github.ref == 'refs/heads/main' }}

backend/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
dist/
2+
node_modules/

charts/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ appVersion: 1.16.0
33
description: Todo app Helm chart
44
name: Todo app
55
type: application
6-
version: 0.1.87
6+
version: 0.1.94

charts/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Todo app
22

3-
![Version: 0.1.87](https://img.shields.io/badge/Version-0.1.87-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square)
3+
![Version: 0.1.94](https://img.shields.io/badge/Version-0.1.94-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square)
44

55
Todo app Helm chart
66

@@ -10,9 +10,9 @@ Todo app Helm chart
1010
|-----|------|---------|-------------|
1111
| DBname.name | string | `"db"` | |
1212
| backend.repository | string | `"docker.pkg.github.com/Todo-Full-Stack-Deployment/sheplx/backend"` | |
13-
| backend.tag | string | `"cd43314"` | |
13+
| backend.tag | string | `"a8105cf"` | |
1414
| frontend.repository | string | `"docker.pkg.github.com/Todo-Full-Stack-Deployment/sheplx/frontend"` | |
15-
| frontend.tag | string | `"c8dd64edf28cdfa5c7c8b95b581e2549857a5ee8"` | |
15+
| frontend.tag | string | `"d4fb2b4"` | |
1616
| ingress.tls[0].hosts[0] | string | `"todo.devops.com"` | |
1717
| spec.replicas | int | `3` | |
1818

charts/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ ingress:
44
- todo.devops.com
55
backend:
66
repository: docker.pkg.github.com/Todo-Full-Stack-Deployment/sheplx/backend
7-
tag: "cd43314"
7+
tag: "a8105cf"
88
frontend:
99
repository: docker.pkg.github.com/Todo-Full-Stack-Deployment/sheplx/frontend
10-
tag: c8dd64edf28cdfa5c7c8b95b581e2549857a5ee8
10+
tag: d4fb2b4
1111
spec:
1212
replicas: 3
1313
DBname:

frontend/events/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# See http://help.github.com/ignore-files/ for more about ignoring files.
22

3-
# Compiled output
3+
# Compiled
44
/dist
55
/tmp
66
/out-tsc

0 commit comments

Comments
 (0)