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

Fix credentials not passed or configured the CI workflow #286

Merged
merged 8 commits into from
Jul 3, 2024

Conversation

llucax
Copy link
Contributor

@llucax llucax commented Jul 2, 2024

  • Replace the old setup-git-user step with gh-action-setup-git
  • Add a gh-action-setup-git step to every job doing a checkout
  • ci: Pass git credentials to the test-installation job
  • Improve spacing of the test-installation job
  • Add migration steps to the migration script
  • Apply the migration script to this repository
  • Remove the TODOs from the migration
  • Update release notes

Fixes #278.

The new actions is also able to set credentials, and we add an example
on how to set credentials for projects that have private dependencies.

We also move the step to the beginning, in case the submodule
dependencies are private.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
If we do a Git checkout, there is the chance that we also need to fetch
some private submodule we need credentials for.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>

# ------------------------ >8 ------------------------
# Do not modify or remove the line above.
# Everything below it will be ignored.
#
# Conflicts:
#	tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/.github/workflows/ci.yaml
@llucax llucax requested a review from a team as a code owner July 2, 2024 12:50
@github-actions github-actions bot added the part:template Affects the cookiecutter template files label Jul 2, 2024
@llucax llucax self-assigned this Jul 2, 2024
@llucax llucax added this to the v0.10.0 milestone Jul 2, 2024
@llucax
Copy link
Contributor Author

llucax commented Jul 2, 2024

FYI @cwasicki

@llucax llucax enabled auto-merge July 2, 2024 12:51
@llucax llucax requested a review from Marenz July 2, 2024 12:51
@llucax llucax force-pushed the fix-278 branch 2 times, most recently from 4f4b42d to 2a37fa2 Compare July 2, 2024 13:36
@llucax llucax removed this from the v0.10.0 milestone Jul 2, 2024
@@ -302,14 +302,18 @@ jobs:
if: github.event_name != 'push'
runs-on: ubuntu-20.04
steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@v0.x.x
# TODO(cookiecutter): Uncomment this for projects with private dependencies
Copy link
Contributor

Choose a reason for hiding this comment

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

Any disadvantage if we just always set this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just am very paranoid about passing around credentials where they are not really needed. 🤷

@llucax
Copy link
Contributor Author

llucax commented Jul 2, 2024

Oh, damn, this doesn't work if credentials are not passed because COPY in the Dockerfile fails. For now I will just do another hack and just touch` the file, but this is really a temporary super hacky solution. The proper solution is to run the tests in a container instead of making the docker image build process the test, but that's much more work.

Credentials were not being passed to the docker build process, and the
installation test runs as part of the image builting, so it fails when
some `pip` dependency needs git credentials to be fetched.

This commit fixes this by passing the `.git-credentials` file generated
by the `frequenz-floss/gh-action-setup-git` action to the docker build
process.

Even when the produced docker image doesn't leave the GitHub runner,
this is not ideal because we are storing credentials in the docker
image, so eventually this job should be changed so the tests is done
in a running container instead of a docker image building process, but
for now is a good-enough workaround.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
We'll remove the TODOs in the next commit.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax llucax changed the title Fix credentials not passed or configured the CI workflow. Fix credentials not passed or configured the CI workflow Jul 3, 2024
@llucax llucax requested a review from Marenz July 3, 2024 07:45
@llucax
Copy link
Contributor Author

llucax commented Jul 3, 2024

ping @Marenz

@llucax llucax added type:bug Something isn't working part:ci Affects the GitHub workflow and other parts for running CI labels Jul 3, 2024
@llucax llucax added this pull request to the merge queue Jul 3, 2024
Merged via the queue into frequenz-floss:v0.x.x with commit 327879b Jul 3, 2024
16 checks passed
@llucax llucax deleted the fix-278 branch July 3, 2024 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part:ci Affects the GitHub workflow and other parts for running CI part:template Affects the cookiecutter template files type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The test-installation job fails when pip dependencies need git credentials
3 participants