-
-
Notifications
You must be signed in to change notification settings - Fork 640
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
Google Cloud Secret Manager + GitHub Actions env export #905
Google Cloud Secret Manager + GitHub Actions env export #905
Conversation
c63105e
to
34dbd44
Compare
Hi @petersamokhin, I"m not familiar with Google Cloud in general, including Google Cloud Secret Manager, so pardon me if I"m doing dump questions here (for context, I"m a software engineer, not a DevOps guys). I feel that this feature is too specific for Task. In other words, it"s possible that we"d be maintaining it for a single company to use, which is non-ideal. We try add features that are more generic and serves to a wider range of use cases. How does Google Cloud Secret Manager really work? It authenticates and then adds variables to the ENV? Do you mind pasting your "boilerplate-ish" version as a example so I can understand better? I want to understand if we could add any non-GCP-specific feature that would work not only for you, but also for AWS for example, and even different scenarios not necessarily related to cloud authentication. |
I tend to agree. My expectation here is that you would use existing tools to fetch secrets from GCP such as the If the aim is to fetch secrets during CI, then there are also existing GitHub actions to fetch secrets (and I"m sure other CI providers have similar solutions). Supporting this inside Task creates an expectation that other providers will also be added in the future and this is a sizeable amount of functionality to maintain (with domain specific knowledge) that is currently outside the scope of a task runner. To my knowledge |
hey there! thanks a lot for the swift and detailed responses.
I"m a software engineer too; even more — a mobile developer 😺
Introducing this kind of functionality (like in this PR) IMO would make
Just like the GitHub Actions secrets, Vault, AWS secrets or whatever else: secure key-value storage.
This exact manager in my PR — yes, it either authenticates OR uses the existing auth, e.g. if you have the local development setup and Essentially it adds a more advanced & convenient version of version: "3"
vars:
# before: some steps skiped (auth, project selection)
FOO_BAR:
sh: gcloud secrets versions access latest --secret=my-secret-key
# after
FOO_BAR:
gcp: my-secret-key And the second feature in the PR, yes, it adds all
Yes, easily, most of the logic is very abstract in the PR. Adding Hashicorp Vault, AWS, and whatever else secrets or cloud providers, is gonna be very easy. A new manager and a few lines of code in the compiler and that"s all. @pd93
Yes, but it"s an open-source repo, innit? 😸 If anybody is gonna expect any functionality, they are free to do it themselves.
Yes, it doesn"t; this logic is absent in Not insisting on merging this PR anyway: I already prepared a custom version of binaries and even a GitHub Action to set it up. But it"d be great. Cheers! |
For comparison, the boilerplate I meant above: Before
name: gha-workflow
jobs:
job_id:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: "auth"
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ secrets.gcp_credentials }}"
- id: "secrets"
uses: "google-github-actions/get-secretmanager-secrets@v0"
with:
secrets: |-
my-secret:gcp-secret-id
- run: task something
env:
MY_SECRET: "${{ steps.secrets.outputs.my-secret }}"
version: "3"
tasks:
something:
cmds: echo {{.MY_SECRET}} After
name: gha-workflow
jobs:
job_id:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: whatever/setup-task@v1
- run: task something
env:
TASK_GCP_CREDENTIALS_JSON: "${{ secrets.gcp_credentials }}"
version: "3"
tasks:
something:
vars:
MY_SECRET:
gcp: gcp-secret-id
cmds: echo {{.MY_SECRET}} With more secrets used it becomes much worse. Also, it"s possible to extract the vars to a separate file and optionally include it based on the env or OS, which would be extremely inconvenient to do with make/envfile/other github actions. |
368ca6a
to
f9f60a0
Compare
f9f60a0
to
a3cb750
Compare
hey there @andreynering @pd93! could you please review the above and give a decision? 🙂 I could help maintain this piece of logic in your repo as well if you don"t mind, just let me know. |
This is @andreynering"s decision, but I would personally vote against this for the following reasons:
|
I totally agree with @pd93 I"ve been using Task for quite a while now and I really like its simplicity and focus on one thing, executing tasks. |
Hi @petersamokhin, I"m sorry, but I"m going to close this PR. This is a significant amount of code added (and that will need to be maintained) to add just of bit of convenience. Also, as we said, we try to add features that are more generic and will serve more users in potentially more use cases. There"s a chance that your company would be the only company really using this feature. Integrations with specific tools are usually discarded unless for tools that are popular enough. For example, an integration with Docker may happen eventually, but that"s a very popular tool and that integration would benefit many different use cases. You"re free to maintain a fork if you want. I"m open for questions here or on Discord if needed. Cheers! |
What and why?
We discovered Task (thanks for the project!) and would like to use it in our CI pipelines as well, however, it"s a bit boilerplate-ish to access the secrets and/or apply them to the CI environment. Task is gonna be a replacement for Makefile for us.
New features
Google Cloud Secret Manager vars
tl;dr (more — in docs):
GitHub Actions vars export
tl;dr
After
task test
you can useFOO_BAR
fromGITHUB_ENV
in GitHub Actions.