-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Use Windows compatible file name for downloaded attestations when running gh attestation download
#10051
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
Merged
malancas
merged 17 commits into
cli:trunk
from
malancas:gh-attestation-download-windows-bug
Dec 16, 2024
Merged
Use Windows compatible file name for downloaded attestations when running gh attestation download
#10051
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e97d01f
use different file name for attestation files on windows
malancas 351592d
run all attestation cmd integration tests automatically
malancas fb7f2bf
Merge branch 'trunk' into gh-attestation-download-windows-bug
malancas 9f6d18c
run integration tests with windows specific syntax
malancas 98a81ff
update expected file path on windows
malancas 9ff3370
use replaceAll
malancas 0e15557
windows for loop syntax
malancas 050f295
run all tests in a single script
malancas b6c2b4f
try nesting scripts
malancas 2ced59f
update integration test scripts
malancas 91edde1
simplify var creation
malancas 5ebfa26
use bash shell with integration tests
malancas 35b5606
fix download test
malancas 2393725
hard code expected digest
malancas d42b076
wording
malancas 2418eda
fix file name creation on windows
malancas 6574327
Merge branch 'trunk' into gh-attestation-download-windows-bug
malancas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if [ "$#" -ne 1 ]; then | ||
| echo "Usage: $0 <matrix-os>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| os=$1 | ||
|
|
||
| # Get the root directory of the repository | ||
| rootDir="$(git rev-parse --show-toplevel)" | ||
|
|
||
| ghBuildPath="$rootDir/bin/gh" | ||
|
|
||
| artifactPath="$rootDir/pkg/cmd/attestation/test/data/gh_2.60.1_windows_arm64.zip" | ||
|
|
||
| # Download attestations for the package | ||
| if ! $ghBuildPath attestation download "$artifactPath" --owner=cli; then | ||
| # cleanup test data | ||
| echo "Failed to download attestations" | ||
| exit 1 | ||
| fi | ||
|
|
||
| digest="5ddb1d4d013a44c2e5df027867c0d4161383eb7c16e569a86384af52bfe09a65" | ||
| attestation_filename="sha256:$digest.jsonl" | ||
| if [ "$os" == "windows-latest" ]; then | ||
| echo "Running the test on Windows." | ||
| echo "Build the expected filename accordingly" | ||
| attestation_filename="sha256-$digest.jsonl" | ||
| fi | ||
|
|
||
| if [ ! -f "$attestation_filename" ]; then | ||
| echo "Expected attestation file $attestation_filename not found" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -s "$attestation_filename" ]; then | ||
| echo "Attestation file $attestation_filename is empty" | ||
| rm "$attestation_filename" | ||
| exit 1 | ||
| fi | ||
|
|
||
| cat "$attestation_filename" | ||
|
|
||
| # Clean up the downloaded attestation file | ||
| rm "$attestation_filename" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if [ "$#" -ne 1 ]; then | ||
| echo "Usage: $0 <matrix-os>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| os=$1 | ||
|
|
||
| # Get the root directory of the repository | ||
| rootDir="$(git rev-parse --show-toplevel)" | ||
|
|
||
| verify_test_dir="$rootDir/test/integration/attestation-cmd/verify" | ||
| echo "Running all \"gh attestation verify\" tests" | ||
| for script in "$verify_test_dir"/*.sh; do | ||
| if [ -f "$script" ]; then | ||
| echo "Running $script..." | ||
| bash "$script" | ||
| fi | ||
| done | ||
|
|
||
| download_test_dir="$rootDir/test/integration/attestation-cmd/download" | ||
| echo "Running all \"gh attestation download\" tests" | ||
| for script in "$download_test_dir"/*.sh; do | ||
| if [ -f "$script" ]; then | ||
| echo "Running $script..." | ||
| bash "$script" "$os" | ||
| fi | ||
| done |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
We can revisit running tests on Windows with powershell as well, but to resolve this bug we can just start with bash for now. The colon special character issue is not specific to a given shell on Windows.