Skip to content

Commit

Permalink
[ENG-53643]Collector release cycle improvements[Build CI job and CD j…
Browse files Browse the repository at this point in the history
…ob] (#362)

* create the artifact for each collector and upload to artifact storage
  • Loading branch information
rakhimundhada15 authored Feb 14, 2024
1 parent 560517c commit 5c3eda5
Show file tree
Hide file tree
Showing 4 changed files with 372 additions and 51 deletions.
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -34,6 +34,19 @@ 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 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

package.zip: node_modules/ *.js package.json
Expand Down Expand Up @@ -71,4 +84,4 @@ clean:
if [ "$$d" != "collectors//template" ]; then \
make -C $$d clean || exit 1; \
fi \
done;
done;
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,20 @@ make test
make sam-local
```
4. Please see `local/event.json` for the event payload used for local invocation.


## 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.
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.

***OR***

2. After pr is merge to master branch ,create the tag, which will build the single artifact for all collectors.

13 changes: 13 additions & 0 deletions build_collector.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
COLLECTOR_NAME=$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 "${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
Loading

0 comments on commit 5c3eda5

Please sign in to comment.