Skip to content

Expose CI=true and GITHUB_ACTIONS env variables #215

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 4 commits into from
Apr 17, 2025

Conversation

nikola-jokic
Copy link
Collaborator

Fixes #211

@Copilot Copilot AI review requested due to automatic review settings April 15, 2025 10:50
@nikola-jokic nikola-jokic requested a review from a team as a code owner April 15, 2025 10:50
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (3)

packages/k8s/src/hooks/run-container-step.ts:36

  • Add tests covering the scenario where CI is already provided in stepContainer.environmentVariables to ensure it is not overwritten by the default.
if (!('CI' in envs)) {

packages/k8s/src/hooks/prepare-job.ts:237

  • Consider adding test cases to verify behavior when container.environmentVariables already includes a CI value, so the variable is preserved instead of being added again.
if (!('CI' in container['environmentVariables'])) {

packages/docker/src/dockerCommands/container.ts:52

  • Include tests for scenarios where args.environmentVariables already contains a CI or GITHUB_ACTIONS value to confirm that the existing values are not overridden.
if (!('CI' in (args.environmentVariables ?? {}))) {

@nikola-jokic nikola-jokic force-pushed the nikola-jokic/missing-envs branch from 675597f to 6bf42f0 Compare April 15, 2025 11:02
@@ -229,6 +229,18 @@ export function createContainerSpec(
}
}

podContainer.env.push({
Copy link
Contributor

Choose a reason for hiding this comment

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

What if podContainer.env['GITHUB_ACTIONS'] already exists? Should we manage it as we do with CI to prevent duplication?

}
}

dockerArgs.push('-e', 'GITHUB_ACTIONS=true')
Copy link
Contributor

Choose a reason for hiding this comment

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

What if podContainer.env['GITHUB_ACTIONS'] already exists? Should we manage it as with CI to prevent duplication?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -62,6 +62,28 @@ describe('Prepare job', () => {
).resolves.not.toThrow()
})

it('should prepare job with envs CI and GITHUB_ACTIONS', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we include a test to confirm the outcome if either the GITHUB_ACTIONS or the CI environment variable already exists in the job definition?

@nikola-jokic nikola-jokic force-pushed the nikola-jokic/missing-envs branch from 5f4668b to 118262c Compare April 16, 2025 14:01
@nikola-jokic nikola-jokic force-pushed the nikola-jokic/missing-envs branch from 118262c to 92b6492 Compare April 16, 2025 14:40
@nikola-jokic nikola-jokic merged commit 375992c into main Apr 17, 2025
3 checks passed
@nikola-jokic nikola-jokic deleted the nikola-jokic/missing-envs branch April 17, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kubernetes mode missing required environment variables
3 participants