From c01789edd2655e094c6dea4667a8bc5bdc2743de Mon Sep 17 00:00:00 2001 From: Rakhi Mundhada Date: Wed, 31 Jan 2024 16:58:42 +0530 Subject: [PATCH] make package for all the collectors and create artifact --- Makefile | 11 ++++++++++- ps_spec.yml | 33 ++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 20a37dcb..f47625f0 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ AWS_LAMBDA_PAWS_PACKAGE_NAME ?= al-paws-collector.zip AWS_CFN_TEMPLATE_PATH ?= ./cfn/paws-collector.template AWS_CFN_TEMPLATE_SHARED_PATH ?= ./cfn/paws-collector-shared.template COLLECTOR_DIRS ?= $(shell find collectors/ -type d -maxdepth 1 -mindepth 1) -COLLECTOR_NAMES ?= $(shell find collectors/ -type d -maxdepth 1 -mindepth 1 -exec basename {} \;) +COLLECTOR_NAMES ?= $(shell find collectors/ -type d -maxdepth 1 -mindepth 1 -exec basename {} \; | grep -v "template") .PHONY: test @@ -34,6 +34,15 @@ test-all: test fi; \ done; +package-all: + mkdir -p artifact_folder + for d in $(COLLECTOR_NAMES); do \ + echo -e "\n************\n\n creaating package for $$d\n\n************\n\n"; \ + make -C collectors/$$d package || exit 1; \ + mkdir -p artifact_folder/$$d-collector; \ + cp -r collectors/$$d/cfn/*.template collectors/$$d/al-$$d-collector.zip collectors/$$d/al-$$d-collector.json artifact_folder/$$d-collector/; \ + done; + package: test package.zip package.zip: node_modules/ *.js package.json diff --git a/ps_spec.yml b/ps_spec.yml index 08e695a5..5912d263 100644 --- a/ps_spec.yml +++ b/ps_spec.yml @@ -55,16 +55,14 @@ stages: when: - pull_request: trigger_phrase: build-collector-auth0 + - pull_request: + trigger_phrase: build-collectors env: ALPS_SERVICE_NAME: "paws-auth0-collector" - ALPS_SERVICE_VERSION: "1.1.56" + ALPS_SERVICE_VERSION: "1.1.55" commands: - source $NVM_DIR/nvm.sh && nvm use 18 - cd collectors/auth0 - - export ALPS_SERVICE_VERSION=$(node -p "require('./package.json').version") - - echo "ALPS_SERVICE_VERSION=$ALPS_SERVICE_VERSION" - - export ALPS_SERVICE_NAME=paws-$(node -p "require('./package.json').name") - - echo "ALPS_SERVICE_NAME=$ALPS_SERVICE_NAME" - npm install - make package - mkdir auth0-collector @@ -81,13 +79,11 @@ stages: when: - pull_request: trigger_phrase: build-collector-carbonback + - pull_request: + trigger_phrase: build-collectors commands: - source $NVM_DIR/nvm.sh && nvm use 18 - cd collectors/carbonblack - - export ALPS_SERVICE_VERSION=$(node -p "require('./package.json').version") - - echo "ALPS_SERVICE_VERSION=$ALPS_SERVICE_VERSION" - - export ALPS_SERVICE_NAME=paws-$(node -p "require('./package.json').name") - - echo "ALPS_SERVICE_NAME=$ALPS_SERVICE_NAME" - source ~/.bashrc - npm install - make package @@ -96,7 +92,26 @@ stages: - zip -r ../../carbonback-collector.zip carbonback-collector env: ALPS_SERVICE_NAME: "paws-carbonblack-collector" + ALPS_SERVICE_VERSION: "1.0.52" outputs: file: ./carbonback-collector* + packagers: + - basic + + - name: build artifact for all collector + image: 422372788747.dkr.ecr.us-east-1.amazonaws.com/al-paws-collector-pipeline:latest + compute_size: small_arm + when: + - pull_request: + trigger_phrase: build-all + - tag: ['\d+.\d+.\d+'] + env: + ALPS_SERVICE_VERSION: "2.2.1" + commands: + - source $NVM_DIR/nvm.sh && nvm use 18 + - make package-all + - zip -r artifact_folder.zip artifact_folder + outputs: + file: ./artifact_folder* packagers: - basic \ No newline at end of file