/
config.yml
52 lines (47 loc) · 1.49 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
version: 2.1
jobs:
build_and_push:
docker:
- image: cimg/node:20.3.1
steps:
- checkout
- setup_remote_docker
- run:
name: Lets build and push image
command: |
version="build-$CIRCLE_BUILD_NUM"
echo $version
docker build -t mastanhub/todo-app:$version .
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
docker push mastanhub/todo-app:$version
Update_manifest:
docker:
- image: cimg/base:2023.06
steps:
- checkout
- setup_remote_docker
- run:
name: Updating Manifest file
command: |
TAG=$CIRCLE_BUILD_NUM
((TAG--))
git clone https://github.com/Mastangithub123/kube_manifest.git
git config --global user.email "mastanazure.123@gmail.com"
git config --global user.name "Mastangithub123"
pwd
cd kube_manifest
pwd
echo $TAG
sed -i "s/build-.*/build-$TAG/g" manifest/deployment.yaml
cat manifest/deployment.yaml
git add .
git commit -m "new build with imgTag build-$TAG"
git config credential.helper 'cache --timeout=120'
git push -q https://$GITHUB_PERSONAL_TOKEN@github.com/Mastangithub123/kube_manifest.git main
workflows:
GitOpsflow:
jobs:
- build_and_push
- Update_manifest:
requires:
- build_and_push