-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: updated ci that is faster and better #684
Conversation
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.x | ||
uses: actions/setup-python@v1 | ||
- name: Generate token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generate a token using our github app to do sensitive things like clone repos instead of a SSH key
# can use this filter to decide whether or not to run linters or tests. | ||
- uses: dorny/[email protected] | ||
token: {{`${{ steps.generate_token.outputs.token }}`}} | ||
- name: Cache Fogg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utilize ~/.fogg/cache
with: | ||
add: -A | ||
message: | | ||
commit from fogg_ci -- ran fogg apply and pushed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if fogg apply
has any changes, commit them back to the branch
- name: {{ $component.Dir }} | ||
if: {{ "${{ steps.filter.outputs.terraform == 'true' }}" }} | ||
changed: | ||
- added|modified: 'terraform/**' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
find all changed files in terraform/* in the last commit
changed: | ||
- added|modified: 'terraform/**' | ||
- uses: actions/github-script@v6 | ||
id: changedDirs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take the changed files and find the directories associated with their env/account/module folder
needs: find-changed-dirs | ||
strategy: | ||
matrix: | ||
tfmodule: {{`${{ fromJson(needs.find-changed-dirs.outputs.allChanges) }}`}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for each changed dir...
- uses: actions/checkout@v3 | ||
with: | ||
token: {{`${{ steps.generate_token.outputs.token }}`}} | ||
- name: fix terraform docs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix the terraform docs and commit it back to branch
ref: {{`${{ github.event.pull_request.head.ref }}`}} | ||
git-commit-message: | | ||
commit from fogg_ci -- ran terraform-docs and pushed | ||
- name: fix terraform fmt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix terraform fmt and commit it back to the branch
add: -A | ||
message: | | ||
commit from fogg_ci -- ran terraform fmt and pushed | ||
- name: tflint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also run tflint
Summary
This PR updates the code that is generated to
fogg_ci.yml
for github actions. It has been tested in a few iterations in shared-infra. The following new features include:fogg apply
. should be the samefogg_ci.yml
every timeTest Plan
References
In testing on shared-infra, this has been about 4 minutes faster than the previous iteration, per PR commit.