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

feat: support secrets in render task definition #152

Conversation

yehudacohen
Copy link
Contributor

Issue #, if available:
#20
Description of changes:
Add ability to add secrets to task definition. There is already a pull request here #143 which tries to do this, but it isn't backward compatible. This pull request is. It also doesn't add tests which this PR does.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@kroehre
Copy link

kroehre commented Apr 26, 2022

👍 we'd love to use this feature. What's blocking?

@cairesvs
Copy link

cairesvs commented Nov 6, 2023

Hi 👋 Any updates about when this will be merged? I think it's a needed feature 🙏

fgreinus added a commit to circus-kitchens/amazon-ecs-render-task-definition that referenced this pull request Jan 24, 2024
taken from aws-actions#152

Signed-off-by: Florian Greinus <[email protected]>
@canhassancode
Copy link

Hi there, any update on this?

@amazreech
Copy link
Contributor

amazreech commented May 10, 2024

Hi @yehudacohen, thank you so much for your contribution. Apologies on the delay.
We will be working on reviewing Pull Requests on the repository. In the mean time please ensure that below steps, if not already done, are taken care of in your PR:

  1. Verify if PR follows semantic pull request conventions.

  2. Please be sure to run npm run package command to update dist/ folder with latest dependencies.

  3. Resolve merge conflicts on the PR if any.

@banthaherder
Copy link

@yehudacohen great work on this! Looks like it is approved just need a quick fix for merge conflicts. Can't wait to use this 🙌

@aminzar-access
Copy link

Any updates on this? Cheers!

@@ -68,9 +68,48 @@ async function run() {
containerDef.environment.push(variable);
}
})
if (secrets) {
// If environment array is missing, create it
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment Needs Update, from environment array to secrets array

Comment on lines +80 to +91
const trimmedLine = line.trim();
// Skip if empty
if (trimmedLine.length === 0) { return; }
// Split on =
const separatorIdx = trimmedLine.indexOf("=");
// If there's nowhere to split
if (separatorIdx === -1) {
throw new Error(
`Cannot parse the secret '${trimmedLine}'. Secret pairs must be of the form NAME=valueFrom,
where valueFrom is an arn from parameter store or secrets manager. See AWS documentation for more information:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html.`);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally, this (Lines 80 to Lines 91, I think) could be transferred to a common method as we are using same set of code when fetching environmentVariables as well.

}



Copy link
Contributor

@amazreech amazreech Sep 24, 2024

Choose a reason for hiding this comment

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

nit: unnecessary whitespace

@@ -94,13 +121,14 @@ describe('Render task definition', () => {
expect(core.setOutput).toHaveBeenNthCalledWith(1, 'task-definition', 'new-task-def-file-name');
});

test('renders a task definition at an absolute path, and with initial environment empty', async () => {
test('renders a task definition at an absolute path, and with initial environment and secrets empty', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I might have understood this wrong and I see that the naming was always this way but the test name here is not accurate as the secrets and environment provided is not empty?

@pt-vamshi
Copy link

waiting for this feature

@karanbokil karanbokil added the feature-request A feature should be added or improved. label Sep 27, 2024
@amazreech amazreech changed the base branch from master to supports-secrets-in-render-task-definition September 30, 2024 14:16
@amazreech amazreech changed the base branch from supports-secrets-in-render-task-definition to master September 30, 2024 14:20
@amazreech amazreech changed the base branch from master to supports-secrets-in-render-task-definition September 30, 2024 14:22
@kg-aws
Copy link
Contributor

kg-aws commented Oct 3, 2024

Hi - We have made a follow up PR #334 to fix the merge issues. We have unforgettably added the original authors to that PR. Closing this PR.

#334

@kg-aws kg-aws closed this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.