Skip to content

Commit

Permalink
create the artifact for each collector and upload to artifact storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakhi Mundhada authored and Rakhi Mundhada committed Feb 2, 2024
1 parent 560517c commit 10fd600
Show file tree
Hide file tree
Showing 4 changed files with 363 additions and 51 deletions.
13 changes: 11 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,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 collectors/$$d/al-$$d-collector.zip collectors/$$d/al-$$d-collector.json artifact_folder/$$d-collector/ || exit 1; \
done;

package: test package.zip

package.zip: node_modules/ *.js package.json
Expand Down Expand Up @@ -71,4 +80,4 @@ clean:
if [ "$$d" != "collectors//template" ]; then \
make -C $$d clean || exit 1; \
fi \
done;
done;
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,18 @@ 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.

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

10 changes: 10 additions & 0 deletions build_collector.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
COLLECTOR_NAME=$1

cd collectors/"$COLLECTOR_NAME" || exit 1
npm install || exit 1
make package || exit 1

mkdir -p "${COLLECTOR_NAME}"-collector
cp -r cfn al-"${COLLECTOR_NAME}"-collector.zip al-"${COLLECTOR_NAME}"-collector.json "${COLLECTOR_NAME}"-collector
zip -r ../../"${COLLECTOR_NAME}"-collector.zip "${COLLECTOR_NAME}"-collector
Loading

0 comments on commit 10fd600

Please sign in to comment.