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

upgraded packages.yml file #405

Merged
merged 3 commits into from
Oct 21, 2024
Merged

upgraded packages.yml file #405

merged 3 commits into from
Oct 21, 2024

Conversation

britt-allen
Copy link
Contributor

No description provided.

@britt-allen britt-allen self-assigned this Oct 16, 2024
@britt-allen
Copy link
Contributor Author

Can we discuss this new terraform validation check? It seems to be a recent add, but I don't recall us discussing as a team. @ian-r-rose

@ian-r-rose
Copy link
Member

ian-r-rose commented Oct 16, 2024

We discussed it in #319, which moved the terraform check from a pre-commit check to a regular CI check. @JamesSLogan can you take a look at this failure? I believe the issue is that CI does not have commit permissions on branches. I think it's okay to not have that permission set, so maybe it's enough to just run git diff --exit-code instead of trying to commit.

@britt-allen
Copy link
Contributor Author

If i understand correctly, you're saying to run git diff --exit code instead of committing files? I ask because I am creating a new branch for a separate PR soon. @ian-r-rose

@ian-r-rose
Copy link
Member

Yes, --exit-code means that it will fail if there are differences (I originally had a typo)

@JamesSLogan
Copy link
Contributor

Interesting...I'm not sure what is different about this PR/branch that would cause the job to fail. It was able to commit files here, for one example. Committing is part of the terraform-docs automation, so making the job simply fail if there are differences means the developer will have to have terraform installed locally to resolve the issue, which undoes the original intention of #319.

The code is ugly, doesn't add much value, and seems to be causing problems now. Maybe we drop the terraform-docs functionality after all?

@ian-r-rose
Copy link
Member

Interesting...I'm not sure what is different about this PR/branch that would cause the job to fail. It was able to commit files here, for one example. Committing is part of the terraform-docs automation, so making the job simply fail if there are differences means the developer will have to have terraform installed locally to resolve the issue, which undoes the original intention of #319.

To be honest, I'm not sure why it succeeded there! I was under the impression that for GitHub actions to have commit permissions, you had to explicitly mark it as such.

The code is ugly, doesn't add much value, and seems to be causing problems now. Maybe we drop the terraform-docs functionality after all?

I could go either way on this. @britt-allen if you wanted to remove the terraform docs here, all you would have to do is delete these lines:

- name: Document cloud infrastructure remote state in README
uses: terraform-docs/[email protected]
with:
working-dir: ./terraform/s3-remote-state
- name: Document cloud infrastructure in mkdocs
uses: terraform-docs/[email protected]
with:
working-dir: ./terraform/aws/modules/infra
output-file: ../../../../docs/code/terraform-local-setup.md
- name: Document Snowflake account infrastructure in mkdocs
uses: terraform-docs/[email protected]
with:
working-dir: ./terraform/snowflake/modules/elt
output-file: ../../../../docs/infra/snowflake.md
# This shouldn't be necessary but the terraform-docs action has a bug
# preventing it from git-adding files outside of 'working-dir'.
# See: https://github.com/terraform-docs/gh-actions/pull/108
- name: Commit any files changed by terraform-docs
run: |
git add docs/code/terraform-local-setup.md
git add docs/infra/snowflake.md
# Run git commit if changed files are detected
if git status --porcelain | grep -q '[AM ][AM ]\s\+\S\+'; then
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
set -x
git commit -m "Automated terraform-docs commit"
git push
set +x
fi

@JamesSLogan JamesSLogan mentioned this pull request Oct 21, 2024
@britt-allen
Copy link
Contributor Author

Interesting...I'm not sure what is different about this PR/branch that would cause the job to fail. It was able to commit files here, for one example. Committing is part of the terraform-docs automation, so making the job simply fail if there are differences means the developer will have to have terraform installed locally to resolve the issue, which undoes the original intention of #319.

To be honest, I'm not sure why it succeeded there! I was under the impression that for GitHub actions to have commit permissions, you had to explicitly mark it as such.

The code is ugly, doesn't add much value, and seems to be causing problems now. Maybe we drop the terraform-docs functionality after all?

I could go either way on this. @britt-allen if you wanted to remove the terraform docs here, all you would have to do is delete these lines:

- name: Document cloud infrastructure remote state in README
uses: terraform-docs/[email protected]
with:
working-dir: ./terraform/s3-remote-state
- name: Document cloud infrastructure in mkdocs
uses: terraform-docs/[email protected]
with:
working-dir: ./terraform/aws/modules/infra
output-file: ../../../../docs/code/terraform-local-setup.md
- name: Document Snowflake account infrastructure in mkdocs
uses: terraform-docs/[email protected]
with:
working-dir: ./terraform/snowflake/modules/elt
output-file: ../../../../docs/infra/snowflake.md
# This shouldn't be necessary but the terraform-docs action has a bug
# preventing it from git-adding files outside of 'working-dir'.
# See: https://github.com/terraform-docs/gh-actions/pull/108
- name: Commit any files changed by terraform-docs
run: |
git add docs/code/terraform-local-setup.md
git add docs/infra/snowflake.md
# Run git commit if changed files are detected
if git status --porcelain | grep -q '[AM ][AM ]\s\+\S\+'; then
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
set -x
git commit -m "Automated terraform-docs commit"
git push
set +x
fi

I somehow missed this comment, but still figured it out. Thank you Ian!

@ian-r-rose ian-r-rose merged commit 338282d into main Oct 21, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants