Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change so vault requires the GITHUB_TOKEN #37

Merged
merged 1 commit into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include $(SHIPKIT_MAKEFILES)/bats-testing.make

# -- Variables ---
export BOT_EMAIL ?= [email protected]
export VAULT_URL = https://github.com/9ci/vault.git
export VAULT_REPO = 9ci/vault
# can be set here but best do it on command line with make
# export LOGIT_DEBUG_ENABLED := true

Expand Down
12 changes: 10 additions & 2 deletions makefiles/vault.make
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ VAULT_DIR ?= $(BUILD_DIR)/vault
VAULT_FILES ?= bot.enc.env
VAULT_BOT_ENV_FILE := $(VAULT_DIR)/bot.env

VAULT_BASE_URL ?= github.com/$(VAULT_REPO).git
VAULT_GITHUB_URL ?= https://$(VAULT_BASE_URL)

ifdef GITHUB_TOKEN
VAULT_GITHUB_URL = https://dummy:$(GITHUB_TOKEN)@$(VAULT_BASE_URL)
endif


# --- look for build/vault/bot.env , run sops.decrypt-vault-files --
# we import it straight into make since these are secrets, dont want them in BUILD_VARS where they can get logged

Expand Down Expand Up @@ -42,8 +50,8 @@ $(SOP_SH):
# easier for testing
sops.install: $(SOP_SH)

vault.clone: | _verify_VAULT_URL
[ ! -e $(VAULT_DIR) ] && git clone $(VAULT_URL) $(VAULT_DIR) || :;
vault.clone: | _verify_VAULT_GITHUB_URL
[ ! -e $(VAULT_DIR) ] && git clone $(VAULT_GITHUB_URL) $(VAULT_DIR) || :;

# alias for legacy refs
vault.decrypt-files: vault.decrypt
Expand Down