Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions modules/argocd/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
RELEASE_TAG ?= 0.1.0
.PHONY: updater/test check-prereq-variables
RELEASE_TAG ?= 1.0.0
dirs ?= rendered/
env ?=
app ?= ""

dev_dir = rendered/environments/aws.dev
qa_dir = rendered/environments/aws.qa
logs_dir = rendered/environments/aws.logs
prod_dir = rendered/environments/aws.prod
Comment on lines +6 to +9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be good to filter on app and env the same way make k8s/tanka/generate does it (using tk env list --names). In fact, we could probably pull that out into a "list with filters" common script.

Using that, you wouldn't need to filter by app in argocd-image-updater-tester; you could just pass in a list of directories:

@bin/argocd-image-updater-tester --dirs "$$(list_with_filters.sh --app '$(app)' --env '$(env)' | paste -d, -)"


.PHONY: updater/test check-prereq-variables get-dirs

## Test argocd-image-updater annotations
updater/test: check-prereq-variables
updater/test: check-prereq-variables get-dirs
Copy link
Contributor

@nabadger nabadger Jul 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this module should sit under k8s/argocd which is then more consistent with our other helpers.

I also think updater is a bit too generic so would suggest image-updater-tester (using the app name as a reference)

So you would end up with

make k8s/argocd/image-updater-tester/...

@echo $(dirs)
@mkdir -p bin
@wget -O bin/argocd-image-updater-tester --header "PRIVATE-TOKEN: $(word 2,$(subst :, ,$(GITLAB_SECRET)))" https://gitlab.com/api/v4/projects/37621397/packages/generic/argocd-image-updater-tester/${RELEASE_TAG}/argocd-image-updater-tester
@chmod +x bin/argocd-image-updater-tester
@bin/argocd-image-updater-tester
@bin/argocd-image-updater-tester --dirs=${dir} --apps=${app}
@rm bin/argocd-image-updater-tester
@rm bin/argocd-image-updater
@rm -d bin

check-prereq-variables:
@[ "${GITLAB_SECRET}" ] || ( echo -e "ERROR: GITLAB_SECRET environment variable is not defined. Set the variable before running.\nexport GITLAB_SECRET=\"<gitlab_username>:<gitlab_token>\"\nhttps://argocd-image-updater.readthedocs.io/en/stable/basics/authentication/#using-an-environment-variable"; exit 1 )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little painful (creating/exporting this var). Would it not be better to bundle this as a docker image instead - that would typically mean we don't have to re-auth each time since.


get-dirs:
ifdef env
$(eval dirs := $())
$(foreach e,$(env),$(eval dirs+=$($(e)_dir)))
endif