-
Notifications
You must be signed in to change notification settings - Fork 4
Add git-conceal-unlock wrapper
#195
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6b85f23
Introduce `git-conceal-unlock` wrapper script
AliSoftware 9ab2426
Add CHANGELOG entry
AliSoftware 479ffd1
Update doc header
AliSoftware 31bc622
Wording adjustment
AliSoftware 412544e
Use `exec` instead of subprocess + `exit $?`
AliSoftware 4f8cad6
Add a note about the default env var
AliSoftware File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Description: | ||
| # A wrapper script to run `git-conceal unlock` on CI | ||
| # See https://github.com/Automattic/git-conceal | ||
| # | ||
| # The wrapper automatically runs the `install.sh` script of `git-conceal` | ||
| # if it's not already installed locally before running `git-conceal unlock env:…`. | ||
| # | ||
| # By default, it uses the `GIT_CONCEAL_SECRET_KEY` environment variable as the key source. | ||
| # You can override it by passing the environment variable name as the first argument. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Note: this default env var name has been purposely chosen with a `_SECRET_KEY` suffix | ||
| # so that Buildkite will automatically redact any accidental leak of its value in CI logs. | ||
| # See https://buildkite.com/docs/agent/v3/cli-pipeline#redacted-vars | ||
| # See https://github.com/buildkite/elastic-ci-stack-s3-secrets-hooks/blob/cb27042/s3secrets-helper/secrets/secrets.go#L31-L38 | ||
| env_var_name=${1:-GIT_CONCEAL_SECRET_KEY} | ||
|
|
||
| # If installed in the $PATH, execute it (replacing this current process) | ||
| if command -v git-conceal &> /dev/null; then | ||
| exec git-conceal unlock "env:${env_var_name}" | ||
| fi | ||
|
|
||
| INSTALL_DIR="${PWD}" | ||
| # If already installed in INSTALL_DIR, execute it (replacing this current process) | ||
| if [[ -x "${INSTALL_DIR}/git-conceal" ]]; then | ||
| exec "${INSTALL_DIR}/git-conceal" unlock "env:${env_var_name}" | ||
| fi | ||
|
|
||
| # Otherwise, install it locally and execute it | ||
| echo "git-conceal binary not found. Installing it..." | ||
| mkdir -p "${INSTALL_DIR}" | ||
| curl -fsSL https://raw.githubusercontent.com/Automattic/git-conceal/trunk/install.sh | bash -s -- --prefix "${INSTALL_DIR}" | ||
| "${INSTALL_DIR}/git-conceal" unlock "env:${env_var_name}" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.