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: Catch git error and consider /github/workspace as safe #15

Merged
merged 1 commit into from
May 2, 2023

Conversation

gmuloc
Copy link
Contributor

@gmuloc gmuloc commented May 2, 2023

Two Changes

1) Adding /github/workspace as a safe repo

Curent error in AVD pipeline

Molecule eos_designs_unit_tests_v4.0 > idempotence
fatal: not in a git directory
  * Run Git Verifier because CHECK_GIT is set to true
fatal: detected dubious ownership in repository at '/github/workspace'
To add an exception for this directory, call:

	git config --global --add safe.directory /github/workspace
    - No change found after running Molecule

RCA



actions/checkout#760

Verification

docker run -it --entrypoint /bin/bash action-molecule-avd:test                                                                                     
root@617f69473711:/projects#
root@617f69473711:/projects#
root@617f69473711:/projects# ls
root@617f69473711:/projects# cat ~/.github
cat: /root/.github: No such file or directory
root@617f69473711:/projects# cat ~/.gitconfig
[safe]
        directory = /github/workspace

2) Erroring if any git issue happens again

Right now 1) is a problem but more importantly when 1) fails - the action finishes as if everything is ok which is bad.

The fix to the script is able to catch if an issue occurs

Verification

local verification of the test

pstibbons@guillaumemulocher ansible-avd % sh molecule-runner.sh
Script running from /Users/gmuloc/ansible-avd
fatal: not in a git directory
  * Run Git Verifier because CHECK_GIT is set to
fatal: detected dubious ownership in repository at '/gmuloc/ansible-avd'
To add an exception for this directory, call:

        git config --global --add safe.directory /gmuloc/ansible-avd
'git status --porcelain' failed to run - something is wrong

Copy link
Contributor

@carlbuchmann carlbuchmann left a comment

Choose a reason for hiding this comment

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

LGTM!

@carlbuchmann carlbuchmann merged commit 4b7651c into master May 2, 2023
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.

2 participants