@@ -38,85 +38,6 @@ echo "Run unit tests for the run_macaron.sh script"
3838python $UNIT_TEST_SCRIPT || log_fail
3939echo -e " \n----------------------------------------------------------------------------------"
4040
41- echo -e " \n----------------------------------------------------------------------------------"
42- echo " timyarkov/multibuild_test: Analyzing Maven artifact with the repo path, the branch name and the commit digest"
43- echo " with dependency resolution using cyclonedx Maven plugins (defaults)."
44- echo -e " ----------------------------------------------------------------------------------\n"
45- DEP_EXPECTED=$WORKSPACE /tests/dependency_analyzer/expected_results/cyclonedx_timyarkov_multibuild_test_maven.json
46- DEP_RESULT=$WORKSPACE /output/reports/maven/org_example/mock_maven_proj/dependencies.json
47- OUTPUT_POLICY=$WORKSPACE /tests/e2e/expected_results/maven/org.example/mock_maven_proj/1.0-SNAPSHOT/multibuild_test.dl
48- run_macaron_clean analyze -purl pkg:maven/org.example/
[email protected] ? type=jar -rp https://github.com/timyarkov/multibuild_test -b main -d a8b0efe24298bc81f63217aaa84776c3d48976c5
|| log_fail
49-
50- python $COMPARE_DEPS $DEP_RESULT $DEP_EXPECTED || log_fail
51-
52- $RUN_POLICY -d $DB -f $OUTPUT_POLICY || log_fail
53-
54- echo -e " \n----------------------------------------------------------------------------------"
55- echo " timyarkov/multibuild_test: Analyzing Gradle artifact with the repo path, the branch name and the commit digest"
56- echo " with dependency resolution using cyclonedx Gradle plugins (defaults)."
57- echo -e " ----------------------------------------------------------------------------------\n"
58- DEP_EXPECTED=$WORKSPACE /tests/dependency_analyzer/expected_results/cyclonedx_timyarkov_multibuild_test_gradle.json
59- DEP_RESULT=$WORKSPACE /output/reports/maven/org_example/mock_gradle_proj/dependencies.json
60- $RUN_MACARON_SCRIPT analyze -purl pkg:maven/org.example/
[email protected] ? type=jar -rp https://github.com/timyarkov/multibuild_test -b main -d a8b0efe24298bc81f63217aaa84776c3d48976c5
|| log_fail
61-
62- python $COMPARE_DEPS $DEP_RESULT $DEP_EXPECTED || log_fail
63-
64- echo -e " \n----------------------------------------------------------------------------------"
65- echo " apache/maven: Check the resolved dependency output with config for cyclonedx maven plugin (default)."
66- echo -e " ----------------------------------------------------------------------------------\n"
67- DEP_RESULT=$WORKSPACE /output/reports/maven/org_apache_maven/maven/dependencies.json
68- DEP_EXPECTED=$WORKSPACE /tests/dependency_analyzer/expected_results/cyclonedx_apache_maven.json
69-
70- run_macaron_clean analyze -c $WORKSPACE /tests/dependency_analyzer/configurations/maven_config.yaml || log_fail
71- python $COMPARE_DEPS $DEP_RESULT $DEP_EXPECTED || log_fail
72-
73- echo -e " \n----------------------------------------------------------------------------------"
74- echo " apache/maven: e2e using the local repo path, the branch name and the commit digest without dependency resolution."
75- echo -e " ----------------------------------------------------------------------------------\n"
76- OUTPUT_POLICY=$WORKSPACE /tests/e2e/expected_results/maven/maven.dl
77-
78- run_macaron_clean -lr $WORKSPACE /output/git_repos/github_com analyze -r apache/maven -b master -d 3fc399318edef0d5ba593723a24fff64291d6f9b --skip-deps || log_fail
79-
80- $RUN_POLICY -d $DB -f $OUTPUT_POLICY || log_fail
81-
82- echo -e " \n----------------------------------------------------------------------------------"
83- echo " apache/maven: Check the e2e output JSON file with config and no dependency analyzing."
84- echo -e " ----------------------------------------------------------------------------------\n"
85- EXPECT_DIR=$WORKSPACE /tests/e2e/expected_results/maven
86-
87- declare -a COMPARE_FILES=(
88- " maven.dl"
89- " guava.dl"
90- " mockito.dl"
91- )
92-
93- run_macaron_clean analyze -c $WORKSPACE /tests/e2e/configurations/maven_config.yaml --skip-deps || log_fail
94-
95- for i in " ${COMPARE_FILES[@]} "
96- do
97- $RUN_POLICY -d $DB -f $EXPECT_DIR /$i || log_fail
98- done
99-
100- echo -e " \n----------------------------------------------------------------------------------"
101- echo " apache/maven: Analyzing using a CycloneDx SBOM with target repo path"
102- echo -e " ----------------------------------------------------------------------------------\n"
103- SBOM_FILE=$WORKSPACE /tests/dependency_analyzer/cyclonedx/resources/apache_maven_root_sbom.json
104- DEP_EXPECTED=$WORKSPACE /tests/dependency_analyzer/expected_results/apache_maven_with_sbom_provided.json
105- DEP_RESULT=$WORKSPACE /output/reports/maven/org_apache_maven/maven/dependencies.json
106-
107- run_macaron_clean analyze -purl pkg:maven/org.apache.maven/
[email protected] ? type=pom -rp https://github.com/apache/maven -b master -d 3fc399318edef0d5ba593723a24fff64291d6f9b -sbom
" $SBOM_FILE " || log_fail
108-
109- python $COMPARE_DEPS $DEP_RESULT $DEP_EXPECTED || log_fail
110-
111- echo -e " \n----------------------------------------------------------------------------------"
112- echo " apache/maven: Analyzing with PURL and repository path without dependency resolution."
113- echo -e " ----------------------------------------------------------------------------------\n"
114- OUTPUT_POLICY=$WORKSPACE /tests/e2e/expected_results/purl/maven/maven.dl
115-
116- run_macaron_clean analyze -purl pkg:maven/apache/maven -rp https://github.com/apache/maven -b master -d 3fc399318edef0d5ba593723a24fff64291d6f9b --skip-deps || log_fail
117-
118- $RUN_POLICY -d $DB -f $OUTPUT_POLICY || log_fail
119-
12041echo -e " \n----------------------------------------------------------------------------------"
12142echo " pkg:pypi/[email protected] : Analyzing the dependencies with virtual env provided as input." 12243echo -e " ----------------------------------------------------------------------------------\n"
@@ -137,130 +58,10 @@ python $COMPARE_POLICIES $POLICY_RESULT $POLICY_EXPECTED || log_fail
13758# Clean up and remove the virtual environment.
13859rm -rf " $VIRTUAL_ENV_PATH "
13960
140- echo -e " \n----------------------------------------------------------------------------------"
141- echo " urllib3/urllib3: Analyzing the repo path when automatic dependency resolution is skipped."
142- echo " The CUE expectation file is provided as a single file path."
143- echo -e " ----------------------------------------------------------------------------------\n"
144- OUTPUT_POLICY=$WORKSPACE /tests/e2e/expected_results/urllib3/urllib3.dl
145- EXPECTATION_FILE=$WORKSPACE /tests/slsa_analyzer/provenance/expectations/cue/resources/valid_expectations/urllib3_PASS.cue
146-
147- run_macaron_clean analyze -pe $EXPECTATION_FILE -rp https://github.com/urllib3/urllib3/urllib3 -b main -d 87a0ecee6e691fe5ff93cd000c0158deebef763b --skip-deps || log_fail
148-
149- $RUN_POLICY -d $DB -f $OUTPUT_POLICY || log_fail
150-
151- echo -e " \n----------------------------------------------------------------------------------"
152- echo " urllib3/urllib3: Analyzing the repo path when automatic dependency resolution is skipped."
153- echo " The CUE expectation file should be found via the directory path."
154- echo -e " ----------------------------------------------------------------------------------\n"
155- OUTPUT_POLICY=$WORKSPACE /tests/e2e/expected_results/urllib3/urllib3.dl
156- EXPECTATION_DIR=$WORKSPACE /tests/slsa_analyzer/provenance/expectations/cue/resources/valid_expectations/
157-
158- run_macaron_clean analyze -pe $EXPECTATION_DIR -rp https://github.com/urllib3/urllib3/urllib3 -b main -d 87a0ecee6e691fe5ff93cd000c0158deebef763b --skip-deps || log_fail
159-
160- $RUN_POLICY -d $DB -f $OUTPUT_POLICY || log_fail
161-
162- echo -e " \n----------------------------------------------------------------------------------"
163- echo " Test verifying CUE provenance expectation for ossf/scorecard"
164- echo -e " ----------------------------------------------------------------------------------\n"
165- OUTPUT_POLICY=$WORKSPACE /tests/e2e/expected_results/scorecard/scorecard.dl
166- DEFAULTS_FILE=$WORKSPACE /tests/e2e/defaults/scorecard.ini
167- EXPECTATION_FILE=$WORKSPACE /tests/slsa_analyzer/provenance/expectations/cue/resources/valid_expectations/scorecard_PASS.cue
168-
169- run_macaron_clean -dp
$DEFAULTS_FILE analyze -pe
$EXPECTATION_FILE -purl pkg:github/ossf/
[email protected] --skip-deps
|| log_fail
170-
171- $RUN_POLICY -d $DB -f $OUTPUT_POLICY || log_fail
172-
173- echo -e " \n----------------------------------------------------------------------------------"
174- echo " Run policy CLI with scorecard results."
175- echo -e " ----------------------------------------------------------------------------------\n"
176- POLICY_FILE=$WORKSPACE /tests/policy_engine/resources/policies/scorecard/scorecard.dl
177- POLICY_RESULT=$WORKSPACE /output/policy_report.json
178- POLICY_EXPECTED=$WORKSPACE /tests/policy_engine/expected_results/scorecard/scorecard_policy_report.json
179- VSA_RESULT=$WORKSPACE /output/vsa.intoto.jsonl
180- VSA_PAYLOAD_EXPECTED=$WORKSPACE /tests/vsa/integration/github_slsa-framework_scorecard/vsa_payload.json
181-
182- $RUN_POLICY -f " $POLICY_FILE " -d $DB || log_fail
183- python $COMPARE_POLICIES $POLICY_RESULT $POLICY_EXPECTED || log_fail
184- python " $COMPARE_VSA " " $VSA_RESULT " " $VSA_PAYLOAD_EXPECTED " || log_fail
185-
186- echo -e " \n----------------------------------------------------------------------------------"
187- echo " slsa-framework/slsa-verifier: Analyzing the repo path when automatic dependency resolution is skipped"
188- echo " and CUE file is provided as expectation."
189- echo -e " ----------------------------------------------------------------------------------\n"
190- OUTPUT_POLICY=$WORKSPACE /tests/e2e/expected_results/slsa-verifier/slsa-verifier_cue_PASS.dl
191- EXPECTATION_FILE=$WORKSPACE /tests/slsa_analyzer/provenance/expectations/cue/resources/valid_expectations/slsa_verifier_PASS.cue
192- DEFAULTS_FILE=$WORKSPACE /tests/e2e/defaults/slsa_verifier.ini
193-
194- run_macaron_clean -dp $DEFAULTS_FILE analyze -pe $EXPECTATION_FILE -rp https://github.com/slsa-framework/slsa-verifier -b main -d fc50b662fcfeeeb0e97243554b47d9b20b14efac --skip-deps || log_fail
195-
196- $RUN_POLICY -d $DB -f $OUTPUT_POLICY || log_fail
197-
198- echo -e " \n----------------------------------------------------------------------------------"
199- echo " behnazh-w/example-maven-app as a local and remote repository"
200- echo " Test the Witness and GitHub provenances as an input, Cue expectation validation, Policy CLI and VSA generation."
201- echo -e " ----------------------------------------------------------------------------------\n"
202- POLICY_FILE=$WORKSPACE /tests/policy_engine/resources/policies/example-maven-project/policy.dl
203- POLICY_RESULT=$WORKSPACE /output/policy_report.json
204- POLICY_EXPECTED=$WORKSPACE /tests/policy_engine/expected_results/example-maven-project/example_maven_project_policy_report.json
205- VSA_RESULT=$WORKSPACE /output/vsa.intoto.jsonl
206- VSA_PAYLOAD_EXPECTED=$WORKSPACE /tests/vsa/integration/example-maven-project/vsa_payload.json
207-
208- # Test the local repo with Witness provenance.
209- WITNESS_EXPECTATION_FILE=$WORKSPACE /tests/slsa_analyzer/provenance/expectations/cue/resources/valid_expectations/witness-example-maven-project.cue
210- WITNESS_PROVENANCE_FILE=$WORKSPACE /tests/slsa_analyzer/provenance/resources/valid_provenances/witness-example-maven-project.json
211-
212- # Cloning the repository locally
213- git clone https://github.com/behnazh-w/example-maven-app.git $WORKSPACE /output/git_repos/local_repos/example-maven-app || log_fail
214-
215- # Check the Witness provenance.
216- run_macaron_clean analyze -pf
$WITNESS_PROVENANCE_FILE -pe
$WITNESS_EXPECTATION_FILE -purl pkg:maven/io.github.behnazh-w.demo/
[email protected] ? type=jar --repo-path example-maven-app --skip-deps
|| log_fail
217-
218- # Test the remote repo with GitHub provenance.
219- GITHUB_EXPECTATION_FILE=$WORKSPACE /tests/slsa_analyzer/provenance/expectations/cue/resources/valid_expectations/github-example-maven-project.cue
220- GITHUB_PROVENANCE_FILE=$WORKSPACE /tests/slsa_analyzer/provenance/resources/valid_provenances/github-example-maven-project.json
221-
222- # Check the GitHub provenance.
223- $RUN_MACARON_SCRIPT analyze -pf
$GITHUB_PROVENANCE_FILE -pe
$GITHUB_EXPECTATION_FILE -purl pkg:maven/io.github.behnazh-w.demo/
[email protected] ? type=jar --skip-deps
|| log_fail
224-
225- # Verify the policy and VSA for all the software components generated from behnazh-w/example-maven-app repo.
226- $RUN_POLICY -f " $POLICY_FILE " -d $DB || log_fail
227-
228- python " $COMPARE_POLICIES " " $POLICY_RESULT " " $POLICY_EXPECTED " || log_fail
229- python " $COMPARE_VSA " " $VSA_RESULT " " $VSA_PAYLOAD_EXPECTED " || log_fail
230-
231- echo -e " \n----------------------------------------------------------------------------------"
232- echo " Test running the analysis without setting the GITHUB_TOKEN environment variables."
233- echo -e " ----------------------------------------------------------------------------------\n"
234- temp=" $GITHUB_TOKEN "
235- GITHUB_TOKEN=" " && $RUN_MACARON_SCRIPT analyze -rp https://github.com/slsa-framework/slsa-verifier --skip-deps
236- if [ $? -eq 0 ];
237- then
238- echo -e " Expect non-zero status code but got $? ."
239- log_fail
240- fi
241- GITHUB_TOKEN=" $temp "
242-
243- echo -e " \n----------------------------------------------------------------------------------"
244- echo " apache/maven: test analyzing with invalid PURL"
245- echo -e " ----------------------------------------------------------------------------------\n"
246- $RUN_MACARON_SCRIPT analyze -purl invalid-purl -rp https://github.com/apache/maven --skip-deps
247-
248- if [ $? -eq 0 ];
249- then
250- echo -e " Expect non-zero status code but got $? ."
251- log_fail
252- fi
253-
254- echo -e " \n----------------------------------------------------------------------------------"
255- echo " apache/maven: test analyzing with both PURL and repository path but no branch and digest are provided."
256- echo -e " ----------------------------------------------------------------------------------\n"
257- $RUN_MACARON_SCRIPT analyze -purl pkg:maven/apache/maven -rp https://github.com/apache/maven --skip-deps
258-
259- if [ $? -eq 0 ];
260- then
261- echo -e " Expect non-zero status code but got $? ."
262- log_fail
263- fi
61+ python3 ./tests/integration/run.py run \
62+ --macaron scripts/release_scripts/run_macaron.sh \
63+ --include-tag docker \
64+ ./tests/integration/cases/... || log_fail
26465
26566if [ $RESULT_CODE -ne 0 ];
26667then
0 commit comments