From bdc73fd152b3e5bea6c9908e04355773aa4f816c Mon Sep 17 00:00:00 2001 From: Rakhi Mundhada Date: Mon, 12 Feb 2024 18:12:46 +0530 Subject: [PATCH] copy the cfn folder of paws collector as well --- Makefile | 6 +++++- README.md | 12 +++++++----- build_collector.sh | 11 +++++++---- ps_spec.yml | 14 +++++++------- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index e70160e8..f45adf8c 100644 --- a/Makefile +++ b/Makefile @@ -40,8 +40,12 @@ package-all: 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 collectors/$$d/al-$$d-collector.zip collectors/$$d/al-$$d-collector.json collectors/$$d/themis-template artifact_folder/$$d-collector/; \ + cp -r collectors/$$d/cfn collectors/$$d/al-$$d-collector.zip collectors/$$d/al-$$d-collector.json artifact_folder/$$d-collector/; \ + if [ -d "./collectors/$$d/themis-template" ]; then \ + cp -r collectors/$$d/themis-template artifact_folder/$$d-collector/; \ + fi; \ done; + cp -r cfn artifact_folder; package: test package.zip diff --git a/README.md b/README.md index ebb7febb..a3eb697d 100644 --- a/README.md +++ b/README.md @@ -103,13 +103,15 @@ make sam-local ## Build artifact 1. To build the single/individual collector : - a. Update `ALPS_SERVICE_VERSION` from collector package.json version. - b. Trigger the phrase base on the collector name once the pr is approved. + - a. Update `ALPS_SERVICE_VERSION` from collector package.json version. + - b. Trigger the phrase base on the collector name once the pr is approved. ex. to create artifact for auth0 ,phrase will be `build-collector-auth0` 2. To build all the collectors: There is two way of building the all collector as follow: - 1. Update the `ALPS_SERVICE_VERSION` for each collector as per package.json and trigger the common prase `build-collectors` once pr is approved. - - 2. After pr is merge to master branch ,create the tag, which will build the single artifact for all collectors. + 1. Update the `ALPS_SERVICE_VERSION` for each collector as per package.json and trigger the common prase `build-collectors` once pr is approved. + + ***OR*** + + 2. After pr is merge to master branch ,create the tag, which will build the single artifact for all collectors. diff --git a/build_collector.sh b/build_collector.sh index 2a9dc86f..45c3504b 100755 --- a/build_collector.sh +++ b/build_collector.sh @@ -1,10 +1,13 @@ #!/bin/sh COLLECTOR_NAME=$1 -cd collectors/"$COLLECTOR_NAME" || exit 1 -npm install || exit 1 -make package || exit 1 +cd collectors/"$COLLECTOR_NAME" +npm install +make package mkdir -p "${COLLECTOR_NAME}"-collector -cp -r cfn al-"${COLLECTOR_NAME}"-collector.zip al-"${COLLECTOR_NAME}"-collector.json themis-template "${COLLECTOR_NAME}"-collector +cp -r cfn al-"${COLLECTOR_NAME}"-collector.zip al-"${COLLECTOR_NAME}"-collector.json "${COLLECTOR_NAME}"-collector +if [ -d "./themis-template" ]; then \ + cp -r themis-template "${COLLECTOR_NAME}"-collector; \ +fi; \ zip -r ../../"${COLLECTOR_NAME}"-collector.zip "${COLLECTOR_NAME}"-collector diff --git a/ps_spec.yml b/ps_spec.yml index b1343c15..5c1a4a19 100644 --- a/ps_spec.yml +++ b/ps_spec.yml @@ -69,7 +69,7 @@ stages: packagers: - basic - - name: build-collector-carbonback + - name: build-collector-carbonblack image: 422372788747.dkr.ecr.us-east-1.amazonaws.com/al-paws-collector-pipeline:latest compute_size: small_arm when: @@ -84,7 +84,7 @@ stages: ALPS_SERVICE_NAME: "paws-carbonblack-collector" ALPS_SERVICE_VERSION: "1.0.52" #set the value from collector package json outputs: - file: ./carbonback-collector* + file: ./carbonblack-collector* packagers: - basic @@ -164,22 +164,22 @@ stages: packagers: - basic - - name: build-collector-gsuit + - name: build-collector-gsuite 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-gsuit + trigger_phrase: build-collector-gsuite - pull_request: trigger_phrase: build-collectors env: - ALPS_SERVICE_NAME: "paws-gsuit-collector" + ALPS_SERVICE_NAME: "paws-gsuite-collector" ALPS_SERVICE_VERSION: "1.2.53" #set the value from collector package json commands: - source $NVM_DIR/nvm.sh && nvm use 18 - - ./build_collector.sh gsuit + - ./build_collector.sh gsuite outputs: - file: ./gsuit-collector* + file: ./gsuite-collector* packagers: - basic