|
82 | 82 | echo "======================================================="
|
83 | 83 | echo
|
84 | 84 | echo "Log in to registries"
|
85 |
| - echo ${{inputs.prod_registry_password}} | docker login --username="${{inputs.prod_registry_user}}" --password-stdin ${{inputs.prod_registry}} |
86 |
| - echo ${{inputs.dev_registry_password}} | docker login --username="${{inputs.dev_registry_user}}" --password-stdin ${{inputs.dev_registry}} |
| 85 | + echo "${{inputs.prod_registry_password}}" | docker login --username="${{inputs.prod_registry_user}}" --password-stdin ${{inputs.prod_registry}} |
| 86 | + echo "${{inputs.dev_registry_password}}" | docker login --username="${{inputs.dev_registry_user}}" --password-stdin ${{inputs.dev_registry}} |
87 | 87 | echo
|
88 | 88 | echo "======================================================="
|
89 | 89 | echo
|
|
96 | 96 |
|
97 | 97 | echo "Updating Trivy Data Bases"
|
98 | 98 | mkdir -p "${workdir}/bin/trivy_cache"
|
99 |
| - ${workdir}/bin/trivy image --download-db-only --db-repository "${TRIVY_DB_URL}" --cache-dir "${workdir}/bin/trivy_cache" |
100 |
| - ${workdir}/bin/trivy image --download-java-db-only --java-db-repository "${TRIVY_JAVA_DB_URL}" --cache-dir "${workdir}/bin/trivy_cache" |
| 99 | + ${workdir}/bin/trivy image --username "${{inputs.prod_registry_user}}" --password "${{inputs.prod_registry_password}}" --download-db-only --db-repository "${TRIVY_DB_URL}" --cache-dir "${workdir}/bin/trivy_cache" |
| 100 | + ${workdir}/bin/trivy image --username "${{inputs.prod_registry_user}}" --password "${{inputs.prod_registry_password}}" --download-java-db-only --java-db-repository "${TRIVY_JAVA_DB_URL}" --cache-dir "${workdir}/bin/trivy_cache" |
101 | 101 | echo
|
102 | 102 | echo "======================================================="
|
103 | 103 | echo
|
@@ -140,9 +140,13 @@ runs:
|
140 | 140 | dd_full_release_tag=""
|
141 | 141 | dd_image_version="${module_tag}"
|
142 | 142 | module_image="${DEV_REGISTRY_MODULE_BASEDIR}/${MODULE_NAME}"
|
| 143 | + trivy_registry_user="${DEV_REGISTRY_USER}" |
| 144 | + trivy_registry_pass="${DEV_REGISTRY_PASSWORD}" |
143 | 145 | # If we are scanning release images - we need to redefine image path to prod registry
|
144 | 146 | if echo "${module_tag}" | grep -q "^v[0-9]*\.[0-9]*\.[0-9]*" && [[ "${{ github.event_name }}" != "pull_request" ]]; then
|
145 | 147 | module_image="${PROD_REGISTRY_MODULE_BASEDIR}/${MODULE_NAME}"
|
| 148 | + trivy_registry_user="${PROD_REGISTRY_USER}" |
| 149 | + trivy_registry_pass="${PROD_REGISTRY_PASSWORD}" |
146 | 150 | dd_short_release_tag="release:$(echo ${module_tag} | cut -d '.' -f -2 | sed 's/^v//')"
|
147 | 151 | dd_full_release_tag="image_release_tag:${module_tag}"
|
148 | 152 | dd_image_version="$(echo ${dd_short_release_tag} | sed 's/^release\://')"
|
@@ -183,14 +187,14 @@ runs:
|
183 | 187 |
|
184 | 188 | if [ "$additional_image_detected" == true ]; then
|
185 | 189 | if [ "${TRIVY_REPORTS_LOG_OUTPUT}" != "false" ]; then
|
186 |
| - ${workdir}/bin/trivy i --policy "${TRIVY_POLICY_URL}" --cache-dir "${workdir}/bin/trivy_cache" --skip-db-update --skip-java-db-update --exit-code 0 --severity "${SEVERITY}" --ignorefile "${module_workdir}/.trivyignore" --format table --scanners vuln --quiet "${module_image}:${module_tag}" |
| 190 | + ${workdir}/bin/trivy i --policy "${TRIVY_POLICY_URL}" --cache-dir "${workdir}/bin/trivy_cache" --skip-db-update --skip-java-db-update --exit-code 0 --severity "${SEVERITY}" --ignorefile "${module_workdir}/.trivyignore" --format table --scanners vuln --quiet "${module_image}:${module_tag}" --username "${trivy_registry_user}" --password "${trivy_registry_pass}" --image-src remote |
187 | 191 | fi
|
188 |
| - ${workdir}/bin/trivy i --policy "${TRIVY_POLICY_URL}" --cache-dir "${workdir}/bin/trivy_cache" --skip-db-update --skip-java-db-update --exit-code 0 --severity "${SEVERITY}" --ignorefile "${module_workdir}/.trivyignore" --format json --scanners vuln --output "${module_reports}/d8_${MODULE_NAME}_${IMAGE_NAME}_report.json" --quiet "${module_image}:${module_tag}" |
| 192 | + ${workdir}/bin/trivy i --policy "${TRIVY_POLICY_URL}" --cache-dir "${workdir}/bin/trivy_cache" --skip-db-update --skip-java-db-update --exit-code 0 --severity "${SEVERITY}" --ignorefile "${module_workdir}/.trivyignore" --format json --scanners vuln --output "${module_reports}/d8_${MODULE_NAME}_${IMAGE_NAME}_report.json" --quiet "${module_image}:${module_tag}" --username "${trivy_registry_user}" --password "${trivy_registry_pass}" --image-src remote |
189 | 193 | else
|
190 | 194 | if [ "${TRIVY_REPORTS_LOG_OUTPUT}" != "false" ]; then
|
191 |
| - ${workdir}/bin/trivy i --policy "${TRIVY_POLICY_URL}" --cache-dir "${workdir}/bin/trivy_cache" --skip-db-update --skip-java-db-update --exit-code 0 --severity "${SEVERITY}" --ignorefile "${module_workdir}/.trivyignore" --format table --scanners vuln --quiet "${module_image}@${IMAGE_HASH}" |
| 195 | + ${workdir}/bin/trivy i --policy "${TRIVY_POLICY_URL}" --cache-dir "${workdir}/bin/trivy_cache" --skip-db-update --skip-java-db-update --exit-code 0 --severity "${SEVERITY}" --ignorefile "${module_workdir}/.trivyignore" --format table --scanners vuln --quiet "${module_image}@${IMAGE_HASH}" --username "${trivy_registry_user}" --password "${trivy_registry_pass}" --image-src remote |
192 | 196 | fi
|
193 |
| - ${workdir}/bin/trivy i --policy "${TRIVY_POLICY_URL}" --cache-dir "${workdir}/bin/trivy_cache" --skip-db-update --skip-java-db-update --exit-code 0 --severity "${SEVERITY}" --ignorefile "${module_workdir}/.trivyignore" --format json --scanners vuln --output "${module_reports}/d8_${MODULE_NAME}_${IMAGE_NAME}_report.json" --quiet "${module_image}@${IMAGE_HASH}" |
| 197 | + ${workdir}/bin/trivy i --policy "${TRIVY_POLICY_URL}" --cache-dir "${workdir}/bin/trivy_cache" --skip-db-update --skip-java-db-update --exit-code 0 --severity "${SEVERITY}" --ignorefile "${module_workdir}/.trivyignore" --format json --scanners vuln --output "${module_reports}/d8_${MODULE_NAME}_${IMAGE_NAME}_report.json" --quiet "${module_image}@${IMAGE_HASH}" --username "${trivy_registry_user}" --password "${trivy_registry_pass}" --image-src remote |
194 | 198 | fi
|
195 | 199 | echo " Done"
|
196 | 200 | echo ""
|
|
0 commit comments