-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test for file provenance type
- Loading branch information
1 parent
8c78a6b
commit 71df7f7
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,16 @@ | ||
#!/bin/bash | ||
|
||
FIRST_ARTIFACT=$1 | ||
SECOND_ARTIFACT=$2 | ||
# Comma seperated line of text of attributes to skip, examples are: buildFinishedOn,sha1 | ||
# SKIP_LINES=$3 | ||
|
||
diff_artifacts() { | ||
diff -f $FIRST_ARTIFACT $SECOND_ARTIFACT > difference.txt | ||
grep -vF "buildFinishedOn" difference.txt > difference2.txt | ||
grep -vF "sha1" difference2.txt > difference3.txt | ||
cat difference3.txt | ||
# cat difference.txt | grep -vF "buildFinishedOn" | grep -vF "sha1" | grep -vF "buildInvocationId" | grep -vE "^c" | grep -vE "^." | ||
} | ||
|
||
diff_artifacts |
This file contains 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,45 @@ | ||
name: Integration test file provenance | ||
|
||
on: | ||
push: | ||
branches: | ||
- tests | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build artifact | ||
runs-on: ubuntu-latest | ||
steps: | ||
# traditionally you would build your code here and generate an artifact | ||
- name: Create first artifact | ||
run: echo "onion, tomato, jalapeno, cilantro, lime, salt" > salsa.txt | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: '*.txt' | ||
|
||
generate-provenance: | ||
needs: build | ||
name: Generate build provenance | ||
runs-on: ubuntu-latest | ||
steps: | ||
# checkout only required to run local action (defined in this repo) | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download build artifact | ||
uses: actions/download-artifact@v2 | ||
|
||
- name: Generate provenance | ||
# use action in the root directory | ||
uses: ./ | ||
with: | ||
artifact_path: artifact/ | ||
|
||
- name: Get example build.provenance | ||
run: curl https://gist.githubusercontent.com/Brend-Smits/f4cc4f6ccb140712796c23b75dbf70e0/raw/5040c0a727f9e2e6e337ac987fff36b5ff67757f/gistfile1.txt >> example-build.provance | ||
|
||
- name: Check and Match contents of provenance | ||
run: sh ../bin/diff-checker.sh artifact/build.provance example-build.provance |