Skip to content

Commit e522f3e

Browse files
committed
chore: convert apache_maven_yaml_input_skip_deps
Signed-off-by: Nathan Nguyen <[email protected]>
1 parent 98b35c3 commit e522f3e

File tree

7 files changed

+96
-37
lines changed

7 files changed

+96
-37
lines changed

scripts/dev_scripts/integration_tests.sh

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -276,24 +276,6 @@ run_macaron_clean $ANALYZE -c $WORKSPACE/tests/dependency_analyzer/configuration
276276

277277
check_or_update_expected_output $COMPARE_DEPS $DEP_RESULT $DEP_EXPECTED || log_fail
278278

279-
echo -e "\n----------------------------------------------------------------------------------"
280-
echo "apache/maven: Check the e2e output JSON file with config and no dependency analyzing."
281-
echo -e "----------------------------------------------------------------------------------\n"
282-
EXPECT_DIR=$WORKSPACE/tests/e2e/expected_results/maven
283-
284-
declare -a COMPARE_FILES=(
285-
"maven.dl"
286-
"guava.dl"
287-
"mockito.dl"
288-
)
289-
290-
run_macaron_clean $ANALYZE -c $WORKSPACE/tests/e2e/configurations/maven_config.yaml --skip-deps || log_fail
291-
292-
for i in "${COMPARE_FILES[@]}"
293-
do
294-
$RUN_POLICY -d $DB -f $EXPECT_DIR/$i || log_fail
295-
done
296-
297279
echo -e "\n----------------------------------------------------------------------------------"
298280
echo "apache/maven: Check: Check the e2e status code of running with invalid branch or digest defined in the yaml configuration."
299281
echo -e "----------------------------------------------------------------------------------\n"

scripts/dev_scripts/integration_tests_docker.sh

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,6 @@ echo "Run unit tests for the run_macaron.sh script"
3737
python $UNIT_TEST_SCRIPT || log_fail
3838
echo -e "\n----------------------------------------------------------------------------------"
3939

40-
echo -e "\n----------------------------------------------------------------------------------"
41-
echo "apache/maven: Check the e2e output JSON file with config and no dependency analyzing."
42-
echo -e "----------------------------------------------------------------------------------\n"
43-
EXPECT_DIR=$WORKSPACE/tests/e2e/expected_results/maven
44-
45-
declare -a COMPARE_FILES=(
46-
"maven.dl"
47-
"guava.dl"
48-
"mockito.dl"
49-
)
50-
51-
run_macaron_clean analyze -c $WORKSPACE/tests/e2e/configurations/maven_config.yaml --skip-deps || log_fail
52-
53-
for i in "${COMPARE_FILES[@]}"
54-
do
55-
$RUN_POLICY -d $DB -f $EXPECT_DIR/$i || log_fail
56-
done
57-
5840
echo -e "\n----------------------------------------------------------------------------------"
5941
echo "apache/maven: Analyzing the repo path, the branch name and the commit digest with dependency resolution using a CycloneDx SBOM."
6042
echo -e "----------------------------------------------------------------------------------\n"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved. */
2+
/* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/. */
3+
4+
#include "prelude.dl"
5+
6+
Policy("test_policy", component_id, "") :-
7+
check_passed(component_id, "mcn_build_as_code_1"),
8+
check_passed(component_id, "mcn_build_script_1"),
9+
check_passed(component_id, "mcn_build_service_1"),
10+
check_passed(component_id, "mcn_version_control_system_1"),
11+
check_failed(component_id, "mcn_infer_artifact_pipeline_1"),
12+
check_failed(component_id, "mcn_provenance_available_1"),
13+
check_failed(component_id, "mcn_provenance_derived_commit_1"),
14+
check_failed(component_id, "mcn_provenance_derived_repo_1"),
15+
check_failed(component_id, "mcn_provenance_expectation_1"),
16+
check_failed(component_id, "mcn_provenance_level_three_1"),
17+
check_failed(component_id, "mcn_provenance_witness_level_one_1"),
18+
check_failed(component_id, "mcn_trusted_builder_level_three_1"),
19+
is_repo_url(component_id, "https://github.com/google/guava").
20+
21+
apply_policy_to("test_policy", component_id) :-
22+
is_component(component_id, "pkg:github.com/google/guava@d8633ac8539dae52c8361f79c7a0dbd9ad6dd2c4").
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved. */
2+
/* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/. */
3+
4+
#include "prelude.dl"
5+
6+
Policy("test_policy", component_id, "") :-
7+
check_passed(component_id, "mcn_build_script_1"),
8+
check_passed(component_id, "mcn_build_service_1"),
9+
check_passed(component_id, "mcn_version_control_system_1"),
10+
check_failed(component_id, "mcn_build_as_code_1"),
11+
check_failed(component_id, "mcn_infer_artifact_pipeline_1"),
12+
check_failed(component_id, "mcn_provenance_available_1"),
13+
check_failed(component_id, "mcn_provenance_derived_commit_1"),
14+
check_failed(component_id, "mcn_provenance_derived_repo_1"),
15+
check_failed(component_id, "mcn_provenance_expectation_1"),
16+
check_failed(component_id, "mcn_provenance_level_three_1"),
17+
check_failed(component_id, "mcn_provenance_witness_level_one_1"),
18+
check_failed(component_id, "mcn_trusted_builder_level_three_1"),
19+
is_repo_url(component_id, "https://github.com/apache/maven").
20+
21+
apply_policy_to("test_policy", component_id) :-
22+
is_component(component_id, "pkg:github.com/apache/maven@3fc399318edef0d5ba593723a24fff64291d6f9b").

tests/e2e/configurations/maven_config.yaml renamed to tests/integration/cases/apache_maven_yaml_input_skip_deps/maven_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 - 2023, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2022 - 2024, Oracle and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
33

44
target:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved. */
2+
/* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/. */
3+
4+
#include "prelude.dl"
5+
6+
Policy("test_policy", component_id, "") :-
7+
check_passed(component_id, "mcn_build_as_code_1"),
8+
check_passed(component_id, "mcn_build_script_1"),
9+
check_passed(component_id, "mcn_build_service_1"),
10+
check_passed(component_id, "mcn_version_control_system_1"),
11+
check_failed(component_id, "mcn_infer_artifact_pipeline_1"),
12+
check_failed(component_id, "mcn_provenance_available_1"),
13+
check_failed(component_id, "mcn_provenance_derived_commit_1"),
14+
check_failed(component_id, "mcn_provenance_derived_repo_1"),
15+
check_failed(component_id, "mcn_provenance_expectation_1"),
16+
check_failed(component_id, "mcn_provenance_level_three_1"),
17+
check_failed(component_id, "mcn_provenance_witness_level_one_1"),
18+
check_failed(component_id, "mcn_trusted_builder_level_three_1"),
19+
is_repo_url(component_id, "https://github.com/mockito/mockito").
20+
21+
apply_policy_to("test_policy", component_id) :-
22+
is_component(component_id, "pkg:github.com/mockito/mockito@512ee3949484e4765038a0410cd7a7f1b73cc655").
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2024 - 2024, Oracle and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
3+
4+
description: |
5+
Check the e2e output JSON file with config and no dependency analyzing.
6+
7+
tags:
8+
- docker
9+
10+
steps:
11+
- name: Run macaron analyze
12+
kind: analyze
13+
options:
14+
command_args:
15+
- -c
16+
- maven_config.yaml
17+
- --skip-deps
18+
- name: Run macaron verify-policy for maven
19+
kind: verify
20+
options:
21+
policy: maven.dl
22+
- name: Run macaron verify-policy for guava
23+
kind: verify
24+
options:
25+
policy: guava.dl
26+
- name: Run macaron verify-policy for mockito
27+
kind: verify
28+
options:
29+
policy: mockito.dl

0 commit comments

Comments
 (0)