-
Notifications
You must be signed in to change notification settings - Fork 4
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 dbt production deploy problems #82
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,21 +33,35 @@ jobs: | |
- name: Configure dbt environment | ||
uses: ./.github/actions/configure_dbt_environment | ||
|
||
- name: Cache dbt state directory | ||
# We have to use the separate `restore`/`save` actions instead of the | ||
# unified `cache` action because only `restore` provides access to the | ||
# `cache-matched-key` and `cache-primary-key` outputs as of v3 | ||
- name: Restore dbt state cache | ||
id: cache | ||
uses: actions/cache@v3 | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: ${{ env.PROJECT_DIR }}/${{ env.STATE_DIR }} | ||
key: ${{ env.CACHE_NAME }}-${{ env.CACHE_KEY }} | ||
restore-keys: | | ||
${{ env.CACHE_NAME }}-master | ||
|
||
- if: ${{ steps.cache.outputs.cache-hit == 'true' }} | ||
# If we restore the cache from the `restore-keys` key, the `cache-hit` | ||
# output will be 'false' but the `cache-matched-key` output will be | ||
# the name of the `restore-keys` key; we want to count this case as a hit | ||
- if: | | ||
steps.cache.outputs.cache-hit == 'true' || | ||
steps.cache.outputs.cache-matched-key == format( | ||
'{0}-master', env.CACHE_NAME | ||
) | ||
Comment on lines
+48
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This workflow run has three attempts where I tested each of the possible cases:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: Sheesh, this is very confusing behavior. And weird that the actions maintainers don't provide access to the |
||
name: Set command args to build/test modified resources | ||
run: echo "MODIFIED_RESOURCES_ONLY=true" >> "$GITHUB_ENV" | ||
shell: bash | ||
|
||
- if: ${{ steps.cache.outputs.cache-hit != 'true' }} | ||
- if: | | ||
steps.cache.outputs.cache-hit != 'true' && | ||
steps.cache.outputs.cache-matched-key != format( | ||
'{0}-master', env.CACHE_NAME | ||
) | ||
name: Set command args to build/test all resources | ||
run: echo "MODIFIED_RESOURCES_ONLY=false" >> "$GITHUB_ENV" | ||
shell: bash | ||
|
@@ -81,7 +95,8 @@ jobs: | |
working-directory: ${{ env.PROJECT_DIR }} | ||
shell: bash | ||
|
||
- name: Move dbt manifest directory to update cache | ||
run: mv "$TARGET_DIR" "$STATE_DIR" | ||
working-directory: ${{ env.PROJECT_DIR }} | ||
shell: bash | ||
Comment on lines
-84
to
-87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Saving the cache explicitly with the |
||
- name: Update dbt state cache | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: ${{ env.PROJECT_DIR }}/${{ env.TARGET_DIR }} | ||
key: ${{ env.CACHE_NAME }}-${{ env.CACHE_KEY }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,9 @@ jobs: | |
role-to-assume: ${{ secrets.AWS_IAM_ROLE_TO_ASSUME_ARN }} | ||
aws-region: us-east-1 | ||
|
||
- name: Configure dbt environment | ||
uses: ./.github/actions/configure_dbt_environment | ||
Comment on lines
+34
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Previously we had been hardcoding the target There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, I should've caught this too. Tricky tricky |
||
|
||
- name: Generate docs | ||
run: dbt docs generate --target "$TARGET" | ||
working-directory: ${{ env.PROJECT_DIR }} | ||
|
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.
This is a frustrating difference! Note the outputs of the
restore
action vs. the outputs of thecache
action.