-
Notifications
You must be signed in to change notification settings - Fork 9
feat(taskfiles): Add support for CHECKSUM_EXCLUDE_PATTERNS in remote tasks to exclude paths in checksum calculations (resolves #68). #69
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
base: main
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -83,6 +83,42 @@ tasks: | |
- "test -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_CODEOWNERS_PATH}}'" | ||
- "test -e '{{.OUTPUT_DIR}}/{{.G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH}}'" | ||
|
||
download-and-extract-zip-test-checksum-exclude: | ||
vars: | ||
OUTPUT_DIR: "{{.G_OUTPUT_DIR}}/{{.TASK | replace \":\" \"#\"}}" | ||
CHECKSUM_FILE: "{{.OUTPUT_DIR}}.md5" | ||
cmds: | ||
- task: "download-and-extract-zip-test-cleaner" | ||
vars: | ||
OUTPUT_DIR: "{{.OUTPUT_DIR}}" | ||
|
||
# Download the zip file, extract all files, and compute the checksum with some exclude | ||
# patterns. | ||
- task: "remote:download-and-extract-zip" | ||
vars: | ||
CHECKSUM_EXCLUDE_PATTERNS: &checksum_exclude_patterns | ||
- ".github/CODEOWNERS" | ||
- ".github/PULL_REQUEST_TEMPLATE.md" | ||
OUTPUT_DIR: "{{.OUTPUT_DIR}}" | ||
URL: "{{.G_TEST_ZIP_FILE_URL}}" | ||
FILE_SHA256: "{{.G_TEST_ZIP_FILE_SHA256}}" | ||
- "mv '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE}}.ref'" | ||
Comment on lines
+95
to
+105
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. ❓ Verification inconclusiveEnsure checksum exclude patterns align with extracted file paths. The anchored patterns vars:
- CHECKSUM_EXCLUDE_PATTERNS: &checksum_exclude_patterns
- - ".github/CODEOWNERS"
- - ".github/PULL_REQUEST_TEMPLATE.md"
+ CHECKSUM_EXCLUDE_PATTERNS: &checksum_exclude_patterns
+ - "*/.github/CODEOWNERS"
+ - "*/.github/PULL_REQUEST_TEMPLATE.md" Run a quick grep on the extracted directory name to confirm your anchors match: 🏁 Script executed: rg -A1 'yscope-dev-utils-main' -g '*.md' Length of output: 40 Ensure checksum exclude patterns align with extracted file paths. The anchored patterns vars:
- CHECKSUM_EXCLUDE_PATTERNS: &checksum_exclude_patterns
- - ".github/CODEOWNERS"
- - ".github/PULL_REQUEST_TEMPLATE.md"
+ CHECKSUM_EXCLUDE_PATTERNS: &checksum_exclude_patterns
+ - "*/.github/CODEOWNERS"
+ - "*/.github/PULL_REQUEST_TEMPLATE.md" Run a quick grep on the extracted directory name to confirm your anchors match: rg -A1 'yscope-dev-utils-main' -g '*.md' 🤖 Prompt for AI Agents
|
||
|
||
# Download the zip file again, extract files excluding some files, and compute the checksum | ||
# with the same exclude patterns. | ||
- task: "remote:download-and-extract-zip" | ||
vars: | ||
CHECKSUM_EXCLUDE_PATTERNS: *checksum_exclude_patterns | ||
EXCLUDE_PATTERNS: | ||
- "*/CODEOWNERS" | ||
- "{{.G_EXTRACTED_ZIP_PULL_REQUEST_TEMPLATE_PATH}}" | ||
OUTPUT_DIR: "{{.OUTPUT_DIR}}" | ||
URL: "{{.G_TEST_ZIP_FILE_URL}}" | ||
FILE_SHA256: "{{.G_TEST_ZIP_FILE_SHA256}}" | ||
|
||
# Test that the checksum file was created and matches the reference checksum file. | ||
- "diff -q '{{.CHECKSUM_FILE}}' '{{.CHECKSUM_FILE}}.ref'" | ||
|
||
# Cleans up the files output by download-and-extract-zip (assuming their default paths weren't | ||
# changed). | ||
# | ||
|
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.
Hm, are they relative to
OUTPUT_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.
Yes,
CHECKSUM_EXCLUDE_PATTERNS
is relative toOUTPUT_DIR
. By looking at thechecksum:validate
task's docstring:Since
OUTPUT_DIR
is passed as one of theINCLUDE_PATTERNS
to the checksum tasks, and the docstring states thatEXCLUDE_PATTERNS
are "relative to any INCLUDE_PATTERNS", theCHECKSUM_EXCLUDE_PATTERNS
are indeed relative toOUTPUT_DIR
.or are you saying that this can be better expressed?
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.
Sorry, no, I just got confused with INCLUDE_PATTERNS.