From 1dc57f2d039882f2a7a8b14264c3f555ef3a48bc Mon Sep 17 00:00:00 2001 From: Rakhi Mundhada Date: Tue, 23 Jan 2024 14:36:23 +0530 Subject: [PATCH] test_pipeline changest --- ps_spec.yml | 169 ++++++++++++++++++++++++++-------------------------- 1 file changed, 83 insertions(+), 86 deletions(-) diff --git a/ps_spec.yml b/ps_spec.yml index 7ca26b85..7c705b05 100644 --- a/ps_spec.yml +++ b/ps_spec.yml @@ -2,94 +2,91 @@ version: 1.0 service_name: paws-collector stages: - - - name: PR Test - when: - - pull_request - - pull_request: - trigger_phrase: test it - image: node:18 - compute_size: small - commands: - - make test - - - - name: Master Push - Publish - when: - - push: ['master'] - image: node:18 - compute_size: small - commands: - - | - set -ex - echo //registry.npmjs.org/:_authToken=$NPM_TOKEN > .npmrc - npm whoami - - PKGNAME=$(node -e 'console.log(require("./package.json").name)') - PKGVERSION=$(node -e 'console.log(require("./package.json").version)') - WORDCOUNT=$(npm view "${PKGNAME}@${PKGVERSION}" | wc -c) - - git config --global credential.helper \'store\' || true - echo "https://$ALPS_GH_USER:$ALPS_GH_TOKEN@github.com" > ~/.git-credentials - - npm install - - if [ $(git tag -l "$PKGVERSION") ]; then - echo "Skip tagging $PKGNAME $PKGVERSION version already exist" - else - git tag -a $PKGVERSION -m "$PKGNAME release $PKGVERSION" HEAD - if [ "$WORDCOUNT" -eq 0 ]; then - make test-all - echo "PUBLISHING $PKGNAME $PKGVERSION" - npm run lint - git push origin $PKGVERSION - npm publish --access public - else - echo "NOT PUBLISHING $PKGNAME $PKGVERSION" - fi - fi - - echo done - outputs: - file: ./.ps_outputs/* + - name: PR Test + when: + - pull_request + - pull_request: + trigger_phrase: test it + image: node:18 + compute_size: small + commands: + - make test - - name: build-collector-auth0 - image: 422372788747.dkr.ecr.us-east-1.amazonaws.com/al-paws-collector-pipeline:latest - compute_size: small_arm - when: - - pull_request: + - name: Master Push - Publish + when: + - push: ["master"] + image: node:18 + compute_size: small + commands: + - | + set -ex + echo //registry.npmjs.org/:_authToken=$NPM_TOKEN > .npmrc + npm whoami + + PKGNAME=$(node -e 'console.log(require("./package.json").name)') + PKGVERSION=$(node -e 'console.log(require("./package.json").version)') + WORDCOUNT=$(npm view "${PKGNAME}@${PKGVERSION}" | wc -c) + + git config --global credential.helper \'store\' || true + echo "https://$ALPS_GH_USER:$ALPS_GH_TOKEN@github.com" > ~/.git-credentials + + npm install + + if [ $(git tag -l "$PKGVERSION") ]; then + echo "Skip tagging $PKGNAME $PKGVERSION version already exist" + else + git tag -a $PKGVERSION -m "$PKGNAME release $PKGVERSION" HEAD + if [ "$WORDCOUNT" -eq 0 ]; then + make test-all + echo "PUBLISHING $PKGNAME $PKGVERSION" + npm run lint + git push origin $PKGVERSION + npm publish --access public + else + echo "NOT PUBLISHING $PKGNAME $PKGVERSION" + fi + fi + - echo done + outputs: + file: ./.ps_outputs/* + - name: build-collector-auth0 + image: 422372788747.dkr.ecr.us-east-1.amazonaws.com/al-paws-collector-pipeline:latest + compute_size: small_arm + when: + - pull_request: trigger_phrase: build-collector-auth0 - commands: - - source $NVM_DIR/nvm.sh && nvm use 18 - - export ALPS_SERVICE_VERSION=$(node -p "require('./collectors/auth0/package.json').version") - # - echo "ALPS_SERVICE_VERSION=$ALPS_SERVICE_VERSION" >> $GITHUB_ENV - - npm install - - make package - - mkdir auth0-collecctor - - cp -r cfn al-auth0-collector.zip al-auth0-collector.json auth0-collector - env: - - ALPS_SERVICE_VERSION: ${{ env.ALPS_SERVICE_VERSION }} - outputs: - file: ./auth0-collecctor + commands: + - source $NVM_DIR/nvm.sh && nvm use 18 + - export ALPS_SERVICE_VERSION=$(node -p "require('./collectors/auth0/package.json').version") + # - echo "ALPS_SERVICE_VERSION=$ALPS_SERVICE_VERSION" >> $GITHUB_ENV + - npm install + - make package + - mkdir auth0-collecctor + - cp -r cfn al-auth0-collector.zip al-auth0-collector.json auth0-collector + env: + - ALPS_SERVICE_VERSION: ${{ env.ALPS_SERVICE_VERSION }} + outputs: + file: ./auth0-collecctor packagers: - basic - - name: build-collector-carbonback - image: 422372788747.dkr.ecr.us-east-1.amazonaws.com/al-paws-collector-pipeline:latest - compute_size: small_arm - when: - - pull_request: - trigger_phrase: build-collector-carbonback - commands: - - source $NVM_DIR/nvm.sh && nvm use 18 - - export ALPS_SERVICE_VERSION=$(node -p "require('./collectors/carbonblack/package.json').version") - # - echo "ALPS_SERVICE_VERSION=$ALPS_SERVICE_VERSION" >> $GITHUB_ENV - - npm install - - make package - - mkdir auth0-collecctor - - cp -r cfn al-auth0-collector.zip al-auth0-collector.json auth0-collector - env: - - ALPS_SERVICE_VERSION: ${{ env.ALPS_SERVICE_VERSION }} - outputs: - file: ./auth0-collecctor - packagers: - - basic \ No newline at end of file + - name: build-collector-carbonback + image: 422372788747.dkr.ecr.us-east-1.amazonaws.com/al-paws-collector-pipeline:latest + compute_size: small_arm + when: + - pull_request: + trigger_phrase: build-collector-carbonback + commands: + - source $NVM_DIR/nvm.sh && nvm use 18 + - export ALPS_SERVICE_VERSION=$(node -p "require('./collectors/carbonblack/package.json').version") + # - echo "ALPS_SERVICE_VERSION=$ALPS_SERVICE_VERSION" >> $GITHUB_ENV + - npm install + - make package + - mkdir auth0-collecctor + - cp -r cfn al-auth0-collector.zip al-auth0-collector.json auth0-collector + env: + - ALPS_SERVICE_VERSION: ${{ env.ALPS_SERVICE_VERSION }} + outputs: + file: ./auth0-collecctor + packagers: + - basic