Skip to content

fix(gar/gcs): stop creating files and folders within workdir #894

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

guicaulada
Copy link
Contributor

This pull request includes changes to the GitHub Actions workflow files to improve the handling of credentials when logging into Google services. The main change is the addition of the create_credentials_file: false parameter to prevent the creation of unnecessary credentials files.

Changes to actions/login-to-gar/action.yaml:

  • Added create_credentials_file: false to the with section to prevent creating credentials files during the login process. [1] [2]

Changes to actions/login-to-gcs/action.yaml:

  • Added create_credentials_file: false to the with section to prevent creating credentials files during the login process.

This is to stop the action from dirtying the current working directory causing issues for actions that rely on the state of the local git repository.

@guicaulada guicaulada requested a review from a team as a code owner April 8, 2025 11:29
@guicaulada guicaulada changed the title Disable credentials file creation on google-github-actions/auth fix(auth): Disable credentials file creation on google-github-actions/auth Apr 8, 2025
@guicaulada guicaulada changed the title fix(auth): Disable credentials file creation on google-github-actions/auth fix(auth): disable credentials file creation on google-github-actions/auth Apr 8, 2025
@guicaulada guicaulada changed the title fix(auth): disable credentials file creation on google-github-actions/auth fix(gar/gcs): stop creating files and folders within workdir Apr 8, 2025
@dsotirakis
Copy link
Contributor

It will probably work, since we made this change, so I don't believe that we need credentials file anymore. At least for login-to-gar. But we have to test it first. Will do soon

@@ -138,7 +138,7 @@ runs:

- name: Login to GAR
if: ${{ inputs.push == 'true' }}
uses: ./shared-workflows/actions/login-to-gar
uses: /tmp/shared-workflows/actions/login-to-gar
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't work - I get

Error: grafana/shared-workflows/gc/disable-google-creds-file/actions/push-to-gar-docker/action.yaml (Line: 141, Col: 13): Expected format {org}/{repo}[/path]@ref. Actual '/tmp/shared-workflows/actions/login-to-gar'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, modified that to use ../ instead of tmp hopefully that works!

@zerok
Copy link
Contributor

zerok commented Apr 10, 2025

Just as a general question: For what scenarios are these credentials in a file needed? Probably not gcloud-cli commands, right?

@dsotirakis
Copy link
Contributor

Just as a general question: For what scenarios are these credentials in a file needed? Probably not gcloud-cli commands, right?

We needed this here in order for gcloud to work. Now that we use an auth_token, doesn't look like we need it anymore.

@iainlane iainlane requested a review from a team April 14, 2025 13:22
Copy link
Contributor

@dsotirakis dsotirakis left a comment

Choose a reason for hiding this comment

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

Tested this and doesn't work, so requesting changes in order to not break peoples workflows which run from main. I'd split this PR to two - one to remove the credentials and another one to change paths. I can create one PR to change the paths and then we can rebase this one.

@dsotirakis
Copy link
Contributor

@guicaulada @zerok please let me know if you think this is a good idea for the one part of this issue :)

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.

3 participants