From c3885d26524defcd14f5ca16f9908c32be1f9c0d Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Wed, 15 Feb 2023 18:48:38 +0530 Subject: [PATCH 01/18] Update buildspec.yml --- buildspec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index d471d7d..5d919b9 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -17,7 +17,7 @@ phases: commands: - echo Build started on `date` - echo Compiling the Node.js code - - mocha test.js + post_build: commands: - echo Build completed on `date` From 34f2d5a377d5f062076aa4d80f32662f9e4f940e Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Wed, 15 Feb 2023 19:02:57 +0530 Subject: [PATCH 02/18] Update buildspec.yml --- buildspec.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildspec.yml b/buildspec.yml index 5d919b9..5fb0da9 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -21,6 +21,8 @@ phases: post_build: commands: - echo Build completed on `date` + - today_date=$(date '+%Y%m%') + - echo $today_date # Include only the files required for your application to run. # Do not use recursively include artifacts from node_modules directory as it will include unnecessary packages # used only for building and testing. From 5728388d99800b634cb799ad6670ec1a90884e56 Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Wed, 15 Feb 2023 19:08:35 +0530 Subject: [PATCH 03/18] Update buildspec.yml --- buildspec.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/buildspec.yml b/buildspec.yml index 5fb0da9..b813d84 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -21,8 +21,9 @@ phases: post_build: commands: - echo Build completed on `date` - - today_date=$(date '+%Y%m%') - - echo $today_date + - last_tag_name=$(git tag --sort=-version: refname | head -1 ) + - echo $last_tag_name + # Include only the files required for your application to run. # Do not use recursively include artifacts from node_modules directory as it will include unnecessary packages # used only for building and testing. From 6ca0623e18fd16dd462f4190621e12d3fa2d19bd Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Wed, 15 Feb 2023 19:19:19 +0530 Subject: [PATCH 04/18] Update buildspec.yml --- buildspec.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/buildspec.yml b/buildspec.yml index b813d84..4189296 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -23,6 +23,7 @@ phases: - echo Build completed on `date` - last_tag_name=$(git tag --sort=-version: refname | head -1 ) - echo $last_tag_name + - echo $date # Include only the files required for your application to run. # Do not use recursively include artifacts from node_modules directory as it will include unnecessary packages From a035150e3fc56186a7408f67c1f66f62ce6bf8b5 Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Wed, 15 Feb 2023 19:25:41 +0530 Subject: [PATCH 05/18] Update buildspec.yml --- buildspec.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index 4189296..3e64e19 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -21,9 +21,10 @@ phases: post_build: commands: - echo Build completed on `date` - - last_tag_name=$(git tag --sort=-version: refname | head -1 ) + - put-parameter --name "MY_VARIABLE" --value "MyValue" --type "String" --overwrite - echo $last_tag_name - echo $date + - git tag # Include only the files required for your application to run. # Do not use recursively include artifacts from node_modules directory as it will include unnecessary packages From b77bb454ac5d7370c6e2cc0893cab3d99afe721e Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Wed, 15 Feb 2023 19:28:58 +0530 Subject: [PATCH 06/18] Update buildspec.yml --- buildspec.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index 3e64e19..e2c7117 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -21,7 +21,6 @@ phases: post_build: commands: - echo Build completed on `date` - - put-parameter --name "MY_VARIABLE" --value "MyValue" --type "String" --overwrite - echo $last_tag_name - echo $date - git tag From bc13eb0640076f87df3effe33625860c0aa365ce Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Thu, 16 Feb 2023 11:20:06 +0530 Subject: [PATCH 07/18] tag script --- tag.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tag.sh diff --git a/tag.sh b/tag.sh new file mode 100644 index 0000000..24a91d6 --- /dev/null +++ b/tag.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Create a new tag with date and incrementing version of a git repo + +# Get the current version of the repo +CURRENT_VERSION=$(git tag | sort -V | tail -n1) + +# split the version into components +VERSION_NUMBERS=(${CURRENT_VERSION//./ }) + +# Increment the last number in the version +VERSION_NUMBERS[2]=$((${VERSION_NUMBERS[2]}+1)) + +# Re-create the version string +NEW_VERSION="${VERSION_NUMBERS[0]}.${VERSION_NUMBERS[1]}.${VERSION_NUMBERS[2]}" + +# Get the current date +DATE=$(date +"%Y%m%d") + +# Create the new tag +TAG="eemp.infra.dev$DATE.$NEW_VERSION" + +# Add and push the tag +git tag $TAG +git push origin $TAG From ca5d30efce6829b5d64a920a1a9e2a6103d1b0a1 Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Thu, 16 Feb 2023 11:23:32 +0530 Subject: [PATCH 08/18] Update buildspec.yml --- buildspec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index e2c7117..0a1c841 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -24,7 +24,7 @@ phases: - echo $last_tag_name - echo $date - git tag - + - ./tag.sh # Include only the files required for your application to run. # Do not use recursively include artifacts from node_modules directory as it will include unnecessary packages # used only for building and testing. From d710df33a173632b79c72156ebf6d8329333807e Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Thu, 16 Feb 2023 11:26:30 +0530 Subject: [PATCH 09/18] Update buildspec.yml --- buildspec.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/buildspec.yml b/buildspec.yml index 0a1c841..770fe32 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -24,6 +24,7 @@ phases: - echo $last_tag_name - echo $date - git tag + - chmod +x tag.sh - ./tag.sh # Include only the files required for your application to run. # Do not use recursively include artifacts from node_modules directory as it will include unnecessary packages From 08c23613a8bdd2bccb1c413a902e419f0ef403a3 Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Thu, 16 Feb 2023 11:32:01 +0530 Subject: [PATCH 10/18] Update buildspec.yml --- buildspec.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buildspec.yml b/buildspec.yml index 770fe32..5bd4ffa 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -13,6 +13,9 @@ phases: - echo Installing source NPM dependencies... - npm install - npm install unit.js + - git config --global user.email "nagadevops2016@gmail.com" + - git config --global user.name "nagadevops2016" + build: commands: - echo Build started on `date` From 8a49ec2dd0d3c92d70d4253a72831f089885f3bf Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Thu, 16 Feb 2023 11:51:14 +0530 Subject: [PATCH 11/18] Update buildspec.yml --- buildspec.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildspec.yml b/buildspec.yml index 5bd4ffa..ae5594a 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -23,6 +23,8 @@ phases: post_build: commands: + - whoami + - pwd - echo Build completed on `date` - echo $last_tag_name - echo $date From 20fb656782729d9b04081e9751c1bf3b595778d3 Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Thu, 16 Feb 2023 12:00:31 +0530 Subject: [PATCH 12/18] Update buildspec.yml --- buildspec.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index ae5594a..5533aa5 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -15,7 +15,8 @@ phases: - npm install unit.js - git config --global user.email "nagadevops2016@gmail.com" - git config --global user.name "nagadevops2016" - + - ssh-keygen -t rsa -b 2048 + - cat ~/.ssh/id_rsa.pub build: commands: - echo Build started on `date` From 71b1ecb5ffaa0fadb78ef09ede804523d4908d49 Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Thu, 16 Feb 2023 12:05:33 +0530 Subject: [PATCH 13/18] Update buildspec.yml --- buildspec.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/buildspec.yml b/buildspec.yml index 5533aa5..6a98c4f 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -13,10 +13,11 @@ phases: - echo Installing source NPM dependencies... - npm install - npm install unit.js + - cat /root/.ssh/id_rsa.pub - git config --global user.email "nagadevops2016@gmail.com" - git config --global user.name "nagadevops2016" - - ssh-keygen -t rsa -b 2048 - - cat ~/.ssh/id_rsa.pub + - ssh-keygen -t rsa -b 2048 /root/.ssh/id_rsa + - cat /root/.ssh/id_rsa.pub build: commands: - echo Build started on `date` From 5bee47723de14a30aebfcfec0f7a907a0b204063 Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Thu, 16 Feb 2023 12:07:19 +0530 Subject: [PATCH 14/18] Update buildspec.yml --- buildspec.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index 6a98c4f..a6aa6be 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -13,7 +13,6 @@ phases: - echo Installing source NPM dependencies... - npm install - npm install unit.js - - cat /root/.ssh/id_rsa.pub - git config --global user.email "nagadevops2016@gmail.com" - git config --global user.name "nagadevops2016" - ssh-keygen -t rsa -b 2048 /root/.ssh/id_rsa From bdb07e4e3434d1386d578ed3d1c475a5dd7ceb30 Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Thu, 16 Feb 2023 12:09:35 +0530 Subject: [PATCH 15/18] Update buildspec.yml --- buildspec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index a6aa6be..39d5de5 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -15,7 +15,7 @@ phases: - npm install unit.js - git config --global user.email "nagadevops2016@gmail.com" - git config --global user.name "nagadevops2016" - - ssh-keygen -t rsa -b 2048 /root/.ssh/id_rsa + - ssh-keygen -t rsa -b 4096 -f /root/.ssh/id_rsa - cat /root/.ssh/id_rsa.pub build: commands: From 5868ef7154087e3e8ab9caef32ce85c060c0eddf Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Thu, 16 Feb 2023 12:33:21 +0530 Subject: [PATCH 16/18] Update buildspec.yml --- buildspec.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index 39d5de5..dead512 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -15,7 +15,6 @@ phases: - npm install unit.js - git config --global user.email "nagadevops2016@gmail.com" - git config --global user.name "nagadevops2016" - - ssh-keygen -t rsa -b 4096 -f /root/.ssh/id_rsa - cat /root/.ssh/id_rsa.pub build: commands: From 2e6a6e9f1caafbbaa44de7b3580a0b044bf45958 Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Thu, 16 Feb 2023 12:34:20 +0530 Subject: [PATCH 17/18] Update tag.sh --- tag.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tag.sh b/tag.sh index 24a91d6..a31ceca 100644 --- a/tag.sh +++ b/tag.sh @@ -21,4 +21,4 @@ TAG="eemp.infra.dev$DATE.$NEW_VERSION" # Add and push the tag git tag $TAG -git push origin $TAG +git push origin $TAG git@github.com:nagadevops2016/aws-nodejs-sample-codebuild.git From 32639f2d9e1f9f1116f78f92f1d68091020635b8 Mon Sep 17 00:00:00 2001 From: nagadevops2016 <63189611+nagadevops2016@users.noreply.github.com> Date: Thu, 16 Feb 2023 18:03:29 +0530 Subject: [PATCH 18/18] Update tag.sh --- tag.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tag.sh b/tag.sh index a31ceca..d29b49a 100644 --- a/tag.sh +++ b/tag.sh @@ -22,3 +22,4 @@ TAG="eemp.infra.dev$DATE.$NEW_VERSION" # Add and push the tag git tag $TAG git push origin $TAG git@github.com:nagadevops2016/aws-nodejs-sample-codebuild.git +##