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

refactor: GITHUB_ENV command / remove env.PATH #1503

Merged
merged 13 commits into from
Feb 4, 2023

Conversation

ChristopherHX
Copy link
Contributor

@ChristopherHX ChristopherHX commented Dec 11, 2022

I'm potentially breaking non standard act specfic workflows

With this change are all file commands in a single place again.

Closes #1384
Closes #1421

Anastasia1510
Anastasia1510 previously approved these changes Dec 11, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2022

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ EDITORCONFIG editorconfig-checker 12 0 0.04s
✅ REPOSITORY gitleaks yes no 2.41s
✅ REPOSITORY git_diff yes no 0.0s
✅ REPOSITORY secretlint yes no 0.98s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 12, 2022
@ChristopherHX ChristopherHX changed the title fix: GITHUB_ENV / PATH handling for docker container fix: GITHUB_ENV / PATH handling Dec 12, 2022
@codecov
Copy link

codecov bot commented Dec 12, 2022

Codecov Report

Merging #1503 (3237a13) into master (4989f44) will increase coverage by 0.68%.
The diff coverage is 75.44%.

@@            Coverage Diff             @@
##           master    #1503      +/-   ##
==========================================
+ Coverage   61.22%   61.91%   +0.68%     
==========================================
  Files          46       46              
  Lines        7141     7246     +105     
==========================================
+ Hits         4372     4486     +114     
+ Misses       2462     2457       -5     
+ Partials      307      303       -4     
Impacted Files Coverage Δ
pkg/container/docker_cli.go 82.23% <ø> (ø)
pkg/container/docker_logger.go 52.08% <ø> (ø)
pkg/container/docker_pull.go 33.33% <ø> (ø)
pkg/container/docker_run.go 13.58% <ø> (ø)
pkg/container/docker_volume.go 0.00% <ø> (ø)
pkg/container/docker_images.go 27.02% <29.41%> (-4.13%) ⬇️
pkg/model/github_context.go 61.06% <32.00%> (-19.40%) ⬇️
pkg/container/docker_auth.go 51.35% <56.25%> (+3.73%) ⬆️
pkg/runner/runner.go 86.45% <66.66%> (-2.05%) ⬇️
pkg/runner/step.go 83.33% <75.00%> (+0.36%) ⬆️
... and 19 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ChristopherHX ChristopherHX marked this pull request as ready for review December 12, 2022 20:29
@ChristopherHX ChristopherHX requested a review from a team as a code owner December 12, 2022 20:29
Copy link
Contributor Author

@ChristopherHX ChristopherHX left a comment

Choose a reason for hiding this comment

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

I got it working, inclusive tests for custom PATH in docker actions etc.

pkg/runner/action_composite.go Outdated Show resolved Hide resolved
pkg/runner/run_context.go Outdated Show resolved Hide resolved
Comment on lines -174 to -168
err := rc.JobContainer.UpdateFromImageEnv(step.getEnv())(ctx)
if err != nil {
return err
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This add PATH to the env object, but in actions/runner env.PATH is empty

- run: |
FROM ubuntu:latest
ENV PATH="/opt/texlive/texdir/bin/x86_64-linuxmusl:${PATH}"
ENV ORG_PATH="${PATH}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ORG_PATH is a copy of the expected PATH value, this enshures PATH is unset in env ctx for docker actions

runs-on: ubuntu-latest
container:
image: node:16-buster-slim
options: --user node
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The previous non root user image has PATH issues with node, due to intentional changes.

@ChristopherHX ChristopherHX changed the title fix: GITHUB_ENV / PATH handling refactor: fix GITHUB_ENV / PATH handling Dec 12, 2022
@mergify
Copy link
Contributor

mergify bot commented Dec 15, 2022

@ChristopherHX this pull request is now in conflict 😩

@mergify mergify bot added the conflict PR has conflicts label Dec 15, 2022
@ChristopherHX ChristopherHX changed the title refactor: fix GITHUB_ENV / PATH handling refactor: GITHUB_ENV command / remove env.PATH Dec 16, 2022
@mergify mergify bot added needs-work Extra attention is needed and removed conflict PR has conflicts labels Dec 18, 2022
@nektos nektos deleted a comment from mergify bot Dec 18, 2022
KnisterPeter
KnisterPeter previously approved these changes Dec 19, 2022
Copy link
Member

@KnisterPeter KnisterPeter left a comment

Choose a reason for hiding this comment

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

Looks good.

@mergify mergify bot removed the needs-work Extra attention is needed label Dec 19, 2022
@ChristopherHX ChristopherHX marked this pull request as draft December 21, 2022 20:20
@ChristopherHX
Copy link
Contributor Author

ChristopherHX commented Dec 21, 2022

@catthehacker provided some details about the act images I didn't know, so this PR should be blocked for now to not break users.

This PR removes also reading other envs than PATH from /etc/environment, so this break everything for these images.

@ChristopherHX ChristopherHX marked this pull request as ready for review January 18, 2023 16:23
@ChristopherHX
Copy link
Contributor Author

ChristopherHX commented Jan 18, 2023

I opened a PR to the act docker images repo catthehacker/docker_images#83 to resolve the issues caused by this PR.

I'm not shure how to enshure that docker images are semi uptodate, because this is a breaking change for the docker_images repo.

Oh no recent changes to branch protection rules, made the update branch button disappear, GitHub settings are fixed

@catthehacker
Copy link
Member

I'm not shure how to enshure that docker images are semi uptodate, because this is a breaking change for the docker_images repo.

What do you mean?

@ChristopherHX
Copy link
Contributor Author

I mean act doesn't pull images by default. Some may end up creating an issue about missing node in PATH.

@catthehacker
Copy link
Member

Change so it pulls by default 😛

or add feature that fetches latest meta about used image and warn user when image is outdated/doesn't match

@ChristopherHX ChristopherHX marked this pull request as draft January 26, 2023 22:24
@ChristopherHX
Copy link
Contributor Author

I added more tests and fixed an issue, which leaked the step env of the composite actions.

You can now define env variables with the same name as a env var in the step env as new global variables, tests has been added.

I hope this PR doesn't cause new issues and I think this is ready now.

@ChristopherHX ChristopherHX marked this pull request as ready for review January 31, 2023 16:24
@mergify
Copy link
Contributor

mergify bot commented Jan 31, 2023

@ChristopherHX this pull request has failed checks 🛠

No, only coverage upload failed with a weird error.

@mergify mergify bot added the needs-work Extra attention is needed label Jan 31, 2023
@mergify mergify bot removed the needs-work Extra attention is needed label Feb 1, 2023
@mergify mergify bot requested a review from a team February 1, 2023 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants