From e30072a6823f2a6445889df5ac0788cfdeb40650 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Tue, 23 Aug 2022 20:42:55 +0100 Subject: [PATCH 01/41] adding ci --- .github/workflows/continuous-integration.yml | 29 ++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/continuous-integration.yml diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..771be1d --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,29 @@ +name: Continuous Integration + +on: + push: + branches: + - master + - develop + - staging + +jobs: + buildAndTest: + name: Build and Test + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [1.1.0] + + steps: + - uses: actions/checkout@v1 + + - name: Install Dependencies + run: npm + + - name: Build + run: npm build + + - name: Test + run: npm test --watchAll=false \ No newline at end of file From 9aa076708b0f658f2c0329d88717e86a39e904a4 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Tue, 23 Aug 2022 21:59:42 +0100 Subject: [PATCH 02/41] adding ci --- .github/workflows/continuous-integration.yml | 2 +- seed/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 771be1d..5f985b5 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -26,4 +26,4 @@ jobs: run: npm build - name: Test - run: npm test --watchAll=false \ No newline at end of file + run: npm test \ No newline at end of file diff --git a/seed/index.js b/seed/index.js index e2d9001..9141ca7 100644 --- a/seed/index.js +++ b/seed/index.js @@ -79,7 +79,7 @@ var products = quantity: 10, department: 'Women', category: 'Basics', - date: 1581397200000 + date: 15813972000 }), new Product({ _id: "5bedf3b9c14d7822b39d9d45", From 3f337b8e598d361897ed525a8be49cbd7e2e685d Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Tue, 23 Aug 2022 22:01:47 +0100 Subject: [PATCH 03/41] adding ci --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 5f985b5..d644050 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v1 - name: Install Dependencies - run: npm + run: npm install - name: Build run: npm build From ec0e0ce37dec76e0d80982aa8f043dc0bb187ac8 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 06:02:40 +0100 Subject: [PATCH 04/41] adding ci --- .DS_Store | Bin 6148 -> 6148 bytes .github/workflows/continuous-integration.yml | 72 ++++++++++++++----- Dockerfile | 8 +++ 3 files changed, 62 insertions(+), 18 deletions(-) create mode 100644 Dockerfile diff --git a/.DS_Store b/.DS_Store index a6bacf264ca7df6af4f61935eddc3830183df064..7f055b47e181f75677baf694e2ec5043ec81118e 100644 GIT binary patch delta 35 rcmZoMXfc@J&&a+pU^gQp`(z%b#>q#SE^R)>?8q{)A$>DD$6tN`);$br delta 106 zcmZoMXfc@J&&atkU^gQp=VTtHMqM6;JcfLR6oyoWc!pdstCS%J$Sd~D$xlwo$xmWn pU=UznV3YvT^CmYj-IZo#C}YS3swhWS!?1F50COnIW_FIh`~X?b8La>S diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index d644050..7398318 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -1,29 +1,65 @@ -name: Continuous Integration +name: Deploy Node app on AWS Elastic Beanstalk + +env: + APP_NAME: tls-ecommerce-app + S3_BUCKET: tls-ecommerce-app-bucket + AWS_REGION: us-east-1 + AWS_PLATFORM: Docker + PIPELINE_ID: ${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER} on: push: - branches: - - master - - develop - - staging + branches: [ main ] jobs: - buildAndTest: - name: Build and Test + create_eb_version: runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + - run: | + AWS_VERSION_LABEL=${{env.APP_NAME}}-${{env.PIPELINE_ID}} - strategy: - matrix: - node-version: [1.1.0] + echo "Creating Source Bundle" + zip -r ${{env.APP_NAME}}.zip app.js Dockerfile dockerignore package.json + S3_KEY="$AWS_VERSION_LABEL.zip" - steps: - - uses: actions/checkout@v1 + echo "Uploading Source Bundle to S3" + aws s3 cp ${{env.APP_NAME}}.zip s3://${{env.S3_BUCKET}}/${S3_KEY} --region ${{env.AWS_REGION}} - - name: Install Dependencies - run: npm install + echo "Creating Elastic Beanstalk version" + aws elasticbeanstalk create-application-version --application-name ${{env.APP_NAME}} --version-label $AWS_VERSION_LABEL --region ${{env.AWS_REGION}} --source-bundle S3Bucket=${{env.S3_BUCKET}},S3Key=${S3_KEY} --auto-create-application + + deploy_aws: + needs: [create_eb_version] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.6 (needed for eb cli) + uses: actions/setup-python@v1 + with: + python-version: "3.6" + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-id: ${{ secrets.AWS_ID }} + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + - run: | + AWS_VERSION_LABEL=${{env.APP_NAME}}-${{env.PIPELINE_ID}} - - name: Build - run: npm build + echo "Installing Elastic Beanstalk Cli" + python -m pip install --upgrade pip + pip install awsebcli --upgrade + eb --version - - name: Test - run: npm test \ No newline at end of file + echo "Deploy init" + eb init -i ${{env.APP_NAME}} -p ${{env.AWS_PLATFORM}} -k ${{secrets.AWS_ID}} --region ${{env.AWS_REGION}} + eb deploy ${{env.APP_NAME}} --version ${AWS_VERSION_LABEL} + echo "Deploy finished" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2a68fe4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM node:10 +WORKDIR /usr/src/app +COPY package*.json ./ +RUN npm install +COPY . . +ENV APP_PORT 8080 +EXPOSE 8080 +CMD [ "node", "app.js" ] \ No newline at end of file From 791429f3dfab2e389fc8aa4f6491a476d5a22810 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 06:05:22 +0100 Subject: [PATCH 05/41] adding nodejs-app --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7398318..34693b2 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -1,4 +1,4 @@ -name: Deploy Node app on AWS Elastic Beanstalk +name: Deploy Nodejs-app on AWS Elastic Beanstalk env: APP_NAME: tls-ecommerce-app From 6345bf8131169f3997e8553eae6499a030170334 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 08:18:23 +0100 Subject: [PATCH 06/41] updating the ci.yaml file --- .github/workflows/continuous-integration.yml | 74 ++++++-------------- 1 file changed, 20 insertions(+), 54 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 34693b2..19fe07a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -1,65 +1,31 @@ -name: Deploy Nodejs-app on AWS Elastic Beanstalk - -env: - APP_NAME: tls-ecommerce-app - S3_BUCKET: tls-ecommerce-app-bucket - AWS_REGION: us-east-1 - AWS_PLATFORM: Docker - PIPELINE_ID: ${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER} +name: Continuous Integration/Continuous Deployment on: push: - branches: [ main ] + branches: + - master + - develop + - staging jobs: - create_eb_version: + buildAndTest: + name: Build and Test runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION }} - - run: | - AWS_VERSION_LABEL=${{env.APP_NAME}}-${{env.PIPELINE_ID}} - - echo "Creating Source Bundle" - zip -r ${{env.APP_NAME}}.zip app.js Dockerfile dockerignore package.json - S3_KEY="$AWS_VERSION_LABEL.zip" - - echo "Uploading Source Bundle to S3" - aws s3 cp ${{env.APP_NAME}}.zip s3://${{env.S3_BUCKET}}/${S3_KEY} --region ${{env.AWS_REGION}} - echo "Creating Elastic Beanstalk version" - aws elasticbeanstalk create-application-version --application-name ${{env.APP_NAME}} --version-label $AWS_VERSION_LABEL --region ${{env.AWS_REGION}} --source-bundle S3Bucket=${{env.S3_BUCKET}},S3Key=${S3_KEY} --auto-create-application + strategy: + matrix: + node-version: [12.x, 14.x, 16.x] - deploy_aws: - needs: [create_eb_version] - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.6 (needed for eb cli) - uses: actions/setup-python@v1 - with: - python-version: "3.6" - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-id: ${{ secrets.AWS_ID }} - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION }} - - run: | - AWS_VERSION_LABEL=${{env.APP_NAME}}-${{env.PIPELINE_ID}} + - uses: actions/checkout@v1 - echo "Installing Elastic Beanstalk Cli" - python -m pip install --upgrade pip - pip install awsebcli --upgrade - eb --version + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run build --if-present + - run: npm test - echo "Deploy init" - eb init -i ${{env.APP_NAME}} -p ${{env.AWS_PLATFORM}} -k ${{secrets.AWS_ID}} --region ${{env.AWS_REGION}} - eb deploy ${{env.APP_NAME}} --version ${AWS_VERSION_LABEL} - echo "Deploy finished" + \ No newline at end of file From abafaeb80383705a58ae9375312b79a7ccee40c5 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 08:21:21 +0100 Subject: [PATCH 07/41] updating the ci.yaml file --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 19fe07a..b2157bf 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -26,6 +26,6 @@ jobs: cache: 'npm' - run: npm ci - run: npm run build --if-present - - run: npm test + # - run: npm test \ No newline at end of file From f1f1824a42d12d947c061c3153402788ed06e2e1 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 08:55:43 +0100 Subject: [PATCH 08/41] updating the build file for continuous integration --- .github/workflows/continuous-integration.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index b2157bf..cbe6730 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -2,6 +2,7 @@ name: Continuous Integration/Continuous Deployment on: push: + pull: branches: - master - develop @@ -14,7 +15,7 @@ jobs: strategy: matrix: - node-version: [12.x, 14.x, 16.x] + node-version: [16.x] steps: - uses: actions/checkout@v1 @@ -26,6 +27,12 @@ jobs: cache: 'npm' - run: npm ci - run: npm run build --if-present - # - run: npm test + + name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 \ No newline at end of file From d76b8420fdd837de65ca110ad146a8e7986bef11 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 08:59:36 +0100 Subject: [PATCH 09/41] updating the build file for continuous integration --- .github/workflows/continuous-integration.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index cbe6730..4aa81dc 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -2,7 +2,6 @@ name: Continuous Integration/Continuous Deployment on: push: - pull: branches: - master - develop From a87e72a2210fdde98c1910cf719b0609fbfb1553 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 09:00:51 +0100 Subject: [PATCH 10/41] updating the build file for continuous integration --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 4aa81dc..f39c5ad 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -27,7 +27,7 @@ jobs: - run: npm ci - run: npm run build --if-present - name: Configure AWS Credentials + - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} From 7958ab6d7faf2a3758ff667b3245cff02447a243 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 09:06:38 +0100 Subject: [PATCH 11/41] updating the build file for continuous integration --- .github/workflows/continuous-integration.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f39c5ad..d0819a1 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -27,11 +27,11 @@ jobs: - run: npm ci - run: npm run build --if-present - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 \ No newline at end of file From da91c56b72e40156c96f61b07674181b779b0959 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 15:47:59 +0100 Subject: [PATCH 12/41] adding the jenkinsfile --- .github/workflows/continuous-integration.yml | 37 -------------------- Jenkinsfile | 28 +++++++++++++++ 2 files changed, 28 insertions(+), 37 deletions(-) delete mode 100644 .github/workflows/continuous-integration.yml create mode 100644 Jenkinsfile diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml deleted file mode 100644 index d0819a1..0000000 --- a/.github/workflows/continuous-integration.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Continuous Integration/Continuous Deployment - -on: - push: - branches: - - master - - develop - - staging - -jobs: - buildAndTest: - name: Build and Test - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [16.x] - - steps: - - uses: actions/checkout@v1 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm ci - - run: npm run build --if-present - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..03d56e3 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,28 @@ +pipeline { + agent any + + tools {nodejs "node"} + + stages { + + stage('Git') { + steps { + git 'https://github.com/QNNAKWUE/Ecommerce-Nodejs.git' + } + } + + stage('Build') { + steps { + sh 'npm install' + sh '<>' + } + } + + + stage('Test') { + steps { + sh 'node test' + } + } + } +} \ No newline at end of file From c6a0cee09a6a3ade1df49027da4d6f9d5286e6c9 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 16:06:32 +0100 Subject: [PATCH 13/41] adding the jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 03d56e3..1ea76b4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any - tools {nodejs "node"} + tools {nodejs '7.7.3'} stages { From 6ed70fc240072e039de52b975e7545d004ffe6e5 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 16:19:08 +0100 Subject: [PATCH 14/41] adding the jenkinsfile --- Jenkinsfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1ea76b4..b17b42d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,9 @@ pipeline { - agent any - - tools {nodejs '7.7.3'} + agent { + docker { + image 'node:lts-bullseye-slim' + args '-p 3000:3000' + } stages { From 8c6b7ce2bab1a14d3b22c7a9288d69faf77f90b3 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 16:22:13 +0100 Subject: [PATCH 15/41] adding the jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index b17b42d..4e4a23f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,4 +27,5 @@ pipeline { } } } +} } \ No newline at end of file From dfb50e7ed8097a5d0e1941280a89dc4f8a6677ec Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 16:28:27 +0100 Subject: [PATCH 16/41] adding the jenkinsfile --- Jenkinsfile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4e4a23f..c5528e0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,9 +1,7 @@ pipeline { - agent { - docker { - image 'node:lts-bullseye-slim' - args '-p 3000:3000' - } + agent any + + tools {NodeJS Plugin} stages { @@ -27,5 +25,4 @@ pipeline { } } } -} } \ No newline at end of file From c21cb7a6c67a9ae86022d9da09e5d50af8543ee4 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 16:44:21 +0100 Subject: [PATCH 17/41] adding the jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c5528e0..867a25e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any - tools {NodeJS Plugin} + tools {nodejs "latest"} stages { From e8381c44c33c0c3c0de5434832c1a6afd0d03af6 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 16:59:20 +0100 Subject: [PATCH 18/41] adding the jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 867a25e..3db811a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any - tools {nodejs "latest"} + tools {nodejs '12.10.0'} stages { From fef8d8c470a866f61b8d34ba8fca5213bf5ac2a3 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 17:05:29 +0100 Subject: [PATCH 19/41] adding the jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3db811a..03d56e3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any - tools {nodejs '12.10.0'} + tools {nodejs "node"} stages { From 7d909030e2ff03e29c4d1f7e0e63768b1a458e3f Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 17:47:24 +0100 Subject: [PATCH 20/41] adding the jenkinsfile --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 03d56e3..1f9bb5b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,6 @@ pipeline { agent any - tools {nodejs "node"} stages { From 60ba17040ee490532fb32a820f31adf23884e957 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 18:07:34 +0100 Subject: [PATCH 21/41] adding the jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 1f9bb5b..03d56e3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,7 @@ pipeline { agent any + tools {nodejs "node"} stages { From f4ad854bfd1d6e455b33f6fd9dad3c072a823268 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 18:58:02 +0100 Subject: [PATCH 22/41] adding the jenkinsfile --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 03d56e3..575aca4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,9 @@ pipeline { agent any - tools {nodejs "node"} + tools { + nodejs '18.8.0' + } stages { From 0ed64f085e366a50c09136b7aa28ac96e8d37fd8 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 20:14:19 +0100 Subject: [PATCH 23/41] adding the jenkinsfile --- Jenkinsfile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 575aca4..5635895 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,15 +16,9 @@ pipeline { stage('Build') { steps { sh 'npm install' - sh '<>' + } } - - stage('Test') { - steps { - sh 'node test' - } - } } } \ No newline at end of file From 183f128978c2f44d1676c2773620c61bc74bf523 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 21:34:00 +0100 Subject: [PATCH 24/41] adding the jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5635895..c4fd77a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,13 +7,13 @@ pipeline { stages { - stage('Git') { + stage('Checkout Code From Git') { steps { git 'https://github.com/QNNAKWUE/Ecommerce-Nodejs.git' } } - stage('Build') { + stage('Building Source Code') { steps { sh 'npm install' From f2526d0609f5d16d87c338a8bcb7914637da7186 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 23:36:27 +0100 Subject: [PATCH 25/41] adding the jenkinsfile --- Jenkinsfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c4fd77a..f214195 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,14 @@ pipeline { sh 'npm install' } - } + } + + stage('Build') { + steps { + sh 'npm build' + + } + } } } \ No newline at end of file From bf1792b1af42a1f4fcda80dc063f6051fdc73a81 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 23:43:33 +0100 Subject: [PATCH 26/41] adding the jenkinsfile --- Jenkinsfile | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f214195..3c42070 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,19 +13,22 @@ pipeline { } } - stage('Building Source Code') { - steps { - sh 'npm install' + // stage('Building Source Code') { + // steps { + // sh 'npm install' - } - } + // } + // } - stage('Build') { - steps { - sh 'npm build' - - } - } + stage ('Build') { + //env.PATH = "/opt/jenkins/bin:${env.PATH}" + catchError { + // Install dependencies + sh 'npm install' + // Build assets with eg. webpack + sh 'npm run build' + } + } } } \ No newline at end of file From 9a2751c57f5b01509ee16bd6f780ec6a48652159 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 23:45:30 +0100 Subject: [PATCH 27/41] adding the jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3c42070..1be7053 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,8 +21,8 @@ pipeline { // } stage ('Build') { - //env.PATH = "/opt/jenkins/bin:${env.PATH}" - catchError { + + steps { // Install dependencies sh 'npm install' // Build assets with eg. webpack From f4c2f575298d9f6c76018ea8ba041310063facf7 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Wed, 24 Aug 2022 23:47:46 +0100 Subject: [PATCH 28/41] adding the jenkinsfile --- Jenkinsfile | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1be7053..125f1ce 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,22 +13,12 @@ pipeline { } } - // stage('Building Source Code') { - // steps { - // sh 'npm install' + stage('Build') { + steps { + sh 'npm install' - // } - // } - - stage ('Build') { - - steps { - // Install dependencies - sh 'npm install' - // Build assets with eg. webpack - sh 'npm run build' - } - } + } + } } } \ No newline at end of file From 17720df4e2017e6e6ef3e3ab28c96ed39944ae10 Mon Sep 17 00:00:00 2001 From: Queen Nnakwue Date: Thu, 25 Aug 2022 11:32:41 +0100 Subject: [PATCH 29/41] updating the jenkinsfile --- Jenkinsfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5635895..30b28a0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,17 +7,22 @@ pipeline { stages { - stage('Git') { + stage('Fetch Code from Git') { steps { - git 'https://github.com/QNNAKWUE/Ecommerce-Nodejs.git' + git branch: 'master' url: 'https://github.com/QNNAKWUE/Ecommerce-Nodejs.git' } } stage('Build') { steps { sh 'npm install' - } + + stage('Test') { + steps { + sh 'npm test' + } + } } } From c67eb7637b5e483e447861062a94e9707dda0963 Mon Sep 17 00:00:00 2001 From: qnnakwue Date: Thu, 25 Aug 2022 12:25:26 +0100 Subject: [PATCH 30/41] updated jenkins --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 30b28a0..07dca7e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { stages { - stage('Fetch Code from Git') { + stage('Fetch Code from Github') { steps { git branch: 'master' url: 'https://github.com/QNNAKWUE/Ecommerce-Nodejs.git' } From 83abf01cff2f045d6cd1161a7b993653bfff8370 Mon Sep 17 00:00:00 2001 From: qnnakwue Date: Thu, 25 Aug 2022 13:51:49 +0100 Subject: [PATCH 31/41] merged master --- Jenkinsfile | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 45fd88d..063100a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,11 +7,7 @@ pipeline { stages { -<<<<<<< HEAD - stage('Fetch Code from Github') { -======= - stage('Checkout Code From Git') { ->>>>>>> master + stage('Fetch Code') { steps { git branch: 'master' url: 'https://github.com/QNNAKWUE/Ecommerce-Nodejs.git' } @@ -22,11 +18,11 @@ pipeline { sh 'npm install' } - stage('Test') { - steps { - sh 'npm test' - } - } + // stage('Test') { + // steps { + // sh 'npm test' + // } + // } } } From 24c9810004779ef5c5dc95634adfa6ec4cae09ee Mon Sep 17 00:00:00 2001 From: qnnakwue Date: Thu, 25 Aug 2022 14:02:32 +0100 Subject: [PATCH 32/41] merged master --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 063100a..e0dbac2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,13 +17,13 @@ pipeline { steps { sh 'npm install' } - + } // stage('Test') { // steps { // sh 'npm test' // } // } - } + } } \ No newline at end of file From c90fc67cac22987d017cc9e25311bb70b44faf5c Mon Sep 17 00:00:00 2001 From: qnnakwue Date: Thu, 25 Aug 2022 14:03:44 +0100 Subject: [PATCH 33/41] merged master --- Jenkinsfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e0dbac2..9b67fcc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { stage('Fetch Code') { steps { - git branch: 'master' url: 'https://github.com/QNNAKWUE/Ecommerce-Nodejs.git' + git branch: 'master', url: 'https://github.com/QNNAKWUE/Ecommerce-Nodejs.git' } } @@ -18,11 +18,11 @@ pipeline { sh 'npm install' } } - // stage('Test') { - // steps { - // sh 'npm test' - // } - // } + stage('Test') { + steps { + sh 'npm test' + } + } } From ce5339268db993bf6c75cd384739550d7150435d Mon Sep 17 00:00:00 2001 From: qnnakwue Date: Thu, 25 Aug 2022 14:09:47 +0100 Subject: [PATCH 34/41] merged master --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9b67fcc..d1c32b9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,11 +18,11 @@ pipeline { sh 'npm install' } } - stage('Test') { - steps { - sh 'npm test' - } - } + // stage('Test') { + // steps { + // sh 'npm test' + // } + // } } From f02b5ac3befc13114ed26c0e84548b8395fff1e3 Mon Sep 17 00:00:00 2001 From: qnnakwue Date: Thu, 25 Aug 2022 16:23:18 +0100 Subject: [PATCH 35/41] merged master --- Jenkinsfile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d1c32b9..cb4e4b4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,11 +11,23 @@ pipeline { steps { git branch: 'master', url: 'https://github.com/QNNAKWUE/Ecommerce-Nodejs.git' } + post { + success { + echo "Now Archiving." + archiveArtifacts artifacts: '**/*.war' + } + } } stage('Build') { steps { - sh 'npm install' + sh 'npm clean install -DskipTests' + } + } + + stage ('Checkstyle Analysis'){ + steps { + sh 'npm checkstyle:checkstyle' } } // stage('Test') { From 418ee2e720406faee03dc44eede7dff3c251e375 Mon Sep 17 00:00:00 2001 From: qnnakwue Date: Thu, 25 Aug 2022 16:25:15 +0100 Subject: [PATCH 36/41] merged master --- Jenkinsfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index cb4e4b4..945d18d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,12 +11,12 @@ pipeline { steps { git branch: 'master', url: 'https://github.com/QNNAKWUE/Ecommerce-Nodejs.git' } - post { - success { - echo "Now Archiving." - archiveArtifacts artifacts: '**/*.war' - } - } + // post { + // success { + // echo "Now Archiving." + // archiveArtifacts artifacts: '**/*.war' + // } + // } } stage('Build') { From 2f820a92e15e70d2029686a6f421391edecd3141 Mon Sep 17 00:00:00 2001 From: qnnakwue Date: Thu, 25 Aug 2022 16:26:21 +0100 Subject: [PATCH 37/41] merged master --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 945d18d..8ad1141 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ pipeline { stage('Build') { steps { - sh 'npm clean install -DskipTests' + sh 'npm clean install' } } From 7bf849a20848463059d35772246d47b6ceed2ebc Mon Sep 17 00:00:00 2001 From: qnnakwue Date: Thu, 25 Aug 2022 16:27:12 +0100 Subject: [PATCH 38/41] merged master --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8ad1141..d166df3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ pipeline { stage('Build') { steps { - sh 'npm clean install' + sh 'npm install' } } From 12da3ece5f4a66cf82a8166c7fd3ec1a5f9d9066 Mon Sep 17 00:00:00 2001 From: qnnakwue Date: Thu, 25 Aug 2022 17:03:41 +0100 Subject: [PATCH 39/41] merged master --- Jenkinsfile | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d166df3..7dc21dd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,31 +11,36 @@ pipeline { steps { git branch: 'master', url: 'https://github.com/QNNAKWUE/Ecommerce-Nodejs.git' } - // post { - // success { - // echo "Now Archiving." - // archiveArtifacts artifacts: '**/*.war' - // } - // } } + stage('Install dependencies') { + steps { + echo 'Installing dependencies...' + sh 'rm -rf node_modules package-lock.json && npm install' + } +} stage('Build') { - steps { - sh 'npm install' - } + steps { + sh 'npm run build' + } +} + stage ('Static Analysis') { + steps { + sh ' ./node_modules/eslint/bin/eslint.js -f checkstyle src > eslint.xml' + } + post { + always { + recordIssues enabledForFailure: true, aggregatingResults: true, tool: checkStyle(pattern: 'eslint.xml') + } + } } +} + +// # Path parameters +// export metric_id="n.name" + +// curl -X DELETE "https://api.datadoghq.com/api/v2/logs/config/metrics/${n.name}" \ +// -H "Accept: application/json" \ +// -H "DD-API-KEY: ${DD_API_KEY}" \ +// -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" - stage ('Checkstyle Analysis'){ - steps { - sh 'npm checkstyle:checkstyle' - } - } - // stage('Test') { - // steps { - // sh 'npm test' - // } - // } - - - } -} \ No newline at end of file From 5f719b84f5129480ce498e2d9278823186ed4530 Mon Sep 17 00:00:00 2001 From: qnnakwue Date: Thu, 25 Aug 2022 17:05:21 +0100 Subject: [PATCH 40/41] merged master --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 7dc21dd..70618f6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,6 +36,8 @@ pipeline { } } +} + // # Path parameters // export metric_id="n.name" From 21cd532b13f1dcce8524372a66a660859a03e7cb Mon Sep 17 00:00:00 2001 From: qnnakwue Date: Thu, 25 Aug 2022 17:14:14 +0100 Subject: [PATCH 41/41] merged master --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 70618f6..512bfac 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ pipeline { } stage('Build') { steps { - sh 'npm run build' + sh 'npm build' } } stage ('Static Analysis') {