diff --git a/bitnami/harbor-adapter-trivy/2/debian-11/Dockerfile b/bitnami/harbor-adapter-trivy/2/debian-11/Dockerfile index fda02e791b70..31d5b201acc6 100644 --- a/bitnami/harbor-adapter-trivy/2/debian-11/Dockerfile +++ b/bitnami/harbor-adapter-trivy/2/debian-11/Dockerfile @@ -3,10 +3,10 @@ FROM docker.io/bitnami/minideb:bullseye ARG TARGETARCH LABEL org.opencontainers.image.base.name="docker.io/bitnami/minideb:bullseye" \ - org.opencontainers.image.created="2023-03-13T21:26:55Z" \ + org.opencontainers.image.created="2023-03-18T21:47:11Z" \ org.opencontainers.image.description="Application packaged by VMware, Inc" \ org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="2.7.1-debian-11-r7" \ + org.opencontainers.image.ref.name="2.7.1-debian-11-r8" \ org.opencontainers.image.title="harbor-adapter-trivy" \ org.opencontainers.image.vendor="VMware, Inc." \ org.opencontainers.image.version="2.7.1" @@ -22,8 +22,8 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN install_packages ca-certificates curl procps RUN mkdir -p /tmp/bitnami/pkg/cache/ && cd /tmp/bitnami/pkg/cache/ && \ COMPONENTS=( \ - "harbor-adapter-trivy-2.7.1-0-linux-${OS_ARCH}-debian-11" \ - "gosu-1.16.0-2-linux-${OS_ARCH}-debian-11" \ + "harbor-adapter-trivy-2.7.1-1-linux-${OS_ARCH}-debian-11" \ + "gosu-1.16.0-3-linux-${OS_ARCH}-debian-11" \ ) && \ for COMPONENT in "${COMPONENTS[@]}"; do \ if [ ! -f "${COMPONENT}.tar.gz" ]; then \ diff --git a/bitnami/harbor-adapter-trivy/2/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/harbor-adapter-trivy/2/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json index d100ad7a25b1..0b80dc465954 100644 --- a/bitnami/harbor-adapter-trivy/2/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json +++ b/bitnami/harbor-adapter-trivy/2/debian-11/prebuildfs/opt/bitnami/.bitnami_components.json @@ -1,16 +1,16 @@ { "gosu": { "arch": "amd64", - "digest": "f6056076afb745fd7d9d87d20f71e7248d63330352cf5ae0be2130b7f44a8cfa", + "digest": "bf2b90a31df691e3648c4a41190a926bb638c3a9fa1dfcde36623ce1bfaadc23", "distro": "debian-11", "type": "NAMI", - "version": "1.16.0-2" + "version": "1.16.0-3" }, "harbor-adapter-trivy": { "arch": "amd64", - "digest": "feab7f5c8441bf0046399b40a89242bfb2ad7a273ec703e2cbc15b3c7fa0a965", + "digest": "38b322d1e34ee4c5d69c4415a74334998e6d5a41eb0e1ae722c45f9b62f75b44", "distro": "debian-11", "type": "NAMI", - "version": "2.7.1-0" + "version": "2.7.1-1" } } \ No newline at end of file diff --git a/bitnami/harbor-adapter-trivy/2/debian-11/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/harbor-adapter-trivy/2/debian-11/prebuildfs/opt/bitnami/scripts/libservice.sh index 2d53aca9af84..2d4b7af6fd3a 100644 --- a/bitnami/harbor-adapter-trivy/2/debian-11/prebuildfs/opt/bitnami/scripts/libservice.sh +++ b/bitnami/harbor-adapter-trivy/2/debian-11/prebuildfs/opt/bitnami/scripts/libservice.sh @@ -281,6 +281,8 @@ remove_logrotate_conf() { # --environment - Environment variable to define (multiple --environment options may be passed) # --environment-file - Text file with environment variables # --exec-start - Start command (required) +# --exec-start-pre - Pre-start command (optional) +# --exec-start-post - Post-start command (optional) # --exec-stop - Stop command (optional) # --exec-reload - Reload command (optional) # --group - System group to start the service with @@ -292,6 +294,7 @@ remove_logrotate_conf() { # --success-exit-status - Exit code that indicates a successful shutdown # --type - Systemd unit type (defaults to forking) # --user - System user to start the service with +# --working-directory - Working directory at which to start the service # Returns: # None ######################### @@ -307,6 +310,8 @@ generate_systemd_conf() { local environment="" local environment_file="" local exec_start="" + local exec_start_pre="" + local exec_start_post="" local exec_stop="" local exec_reload="" local restart="always" @@ -316,6 +321,7 @@ generate_systemd_conf() { local limits_content="" local success_exit_status="" local custom_service_content="" + local working_directory="" # Parse CLI flags shift while [[ "$#" -gt 0 ]]; do @@ -334,6 +340,7 @@ generate_systemd_conf() { | --standard-error \ | --success-exit-status \ | --custom-service-content \ + | --working-directory \ ) var_name="$(echo "$1" | sed -e "s/^--//" -e "s/-/_/g")" shift @@ -345,11 +352,21 @@ generate_systemd_conf() { shift limits_content+="Limit${var_name^^}=${1:?"--limit-${var_name} value is missing"}" ;; + --exec-start-pre) + shift + [[ -n "$exec_start_pre" ]] && exec_start_pre+=$'\n' + exec_start_pre+="ExecStartPre=${1:?"--exec-start-pre value is missing"}" + ;; + --exec-start-post) + shift + [[ -n "$exec_start_post" ]] && exec_start_post+=$'\n' + exec_start_post+="ExecStartPost=${1:?"--exec-start-post value is missing"}" + ;; --environment) shift # It is possible to add multiple environment lines [[ -n "$environment" ]] && environment+=$'\n' - environment+="Environment=${1:?"environment" is missing}" + environment+="Environment=${1:?"--environment value is missing"}" ;; *) echo "Invalid command line flag ${1}" >&2 @@ -376,8 +393,21 @@ PartOf=bitnami.service [Service] Type=${type} -ExecStart=${exec_start} EOF + if [[ -n "$working_directory" ]]; then + cat >> "$service_file" <<< "WorkingDirectory=$working_directory" + fi + if [[ -n "$exec_start_pre" ]]; then + # This variable may contain multiple ExecStartPre= directives + cat >> "$service_file" <<< "$exec_start_pre" + fi + if [[ -n "$exec_start" ]]; then + cat >> "$service_file" <<< "ExecStart=${exec_start}" + fi + if [[ -n "$exec_start_post" ]]; then + # This variable may contain multiple ExecStartPost= directives + cat >> "$service_file" <<< "$exec_start_post" + fi # Optional stop and reload commands if [[ -n "$exec_stop" ]]; then cat >> "$service_file" <<< "ExecStop=${exec_stop}" @@ -399,8 +429,9 @@ EOF if [[ -n "$restart" ]]; then cat >> "$service_file" <<< "Restart=${restart}" fi - # Environment flags (may be specified multiple times in a unit) + # Environment flags if [[ -n "$environment" ]]; then + # This variable may contain multiple Environment= directives cat >> "$service_file" <<< "$environment" fi if [[ -n "$environment_file" ]]; then @@ -414,6 +445,7 @@ EOF cat >> "$service_file" <<< "StandardError=${standard_error}" fi if [[ -n "$custom_service_content" ]]; then + # This variable may contain multiple miscellaneous directives cat >> "$service_file" <<< "$custom_service_content" fi if [[ -n "$success_exit_status" ]]; then @@ -424,7 +456,8 @@ EOF fi cat >> "$service_file" <> /etc/ssl/certs/ca-certificates.crt - elif [[ "$OS_FLAVOUR" =~ ^(centos|photon)-.*$ ]]; then + elif [[ "$distro" =~ ^(centos|photon)$ ]]; then cat "$cert" >> /etc/pki/tls/certs/ca-bundle.crt else # Check the existence of generic ca-bundles when OS_FLAVOR does @@ -168,17 +172,21 @@ install_custom_certs() { # String ######################### harbor_generate_env_file_contents() { - local -r envvars_string="${1:?missing envvars}" - echo "#!/bin/bash" + local -r envvars_string="${1:-}" + [[ -z "$envvars_string" ]] && return + # For systemd, we will load it via EnvironmentFile=, so the shebang is not needed + [[ "$BITNAMI_SERVICE_MANAGER" != "systemd" ]] && echo "#!/bin/bash" while IFS= read -r ENV_VAR_LINE; do if [[ ! "$ENV_VAR_LINE" =~ ^[A-Z_] ]]; then continue fi ENV_VAR_NAME="${ENV_VAR_LINE/=*}" ENV_VAR_VALUE="${ENV_VAR_LINE#*=}" + # For systemd, we will load it via EnvironmentFile=, which does not allow 'export' + [[ "$BITNAMI_SERVICE_MANAGER" != "systemd" ]] && echo -n 'export ' # Use single quotes to avoid shell expansion, and escape to be parsed properly (even if it contains quotes) # Escape the value, so it can be parsed as a variable even with quotes set - echo "export ${ENV_VAR_NAME}='${ENV_VAR_VALUE//\'/\'\\\'\'}'" + echo "${ENV_VAR_NAME}='${ENV_VAR_VALUE//\'/\'\\\'\'}'" done <<< "$envvars_string" } diff --git a/bitnami/harbor-adapter-trivy/README.md b/bitnami/harbor-adapter-trivy/README.md index 4d8429c6d836..97ce04a404c6 100644 --- a/bitnami/harbor-adapter-trivy/README.md +++ b/bitnami/harbor-adapter-trivy/README.md @@ -5,7 +5,6 @@ > Harbor Adapter for Trivy translates the Harbor API into Trivy API calls and allows Harbor to provide vulnerability reports on images through Trivy as part of its vulnerability scan. [Overview of Harbor Adapter Trivy](https://github.com/aquasecurity/harbor-scanner-trivy) - Trademarks: This software listing is packaged by Bitnami. The respective trademarks mentioned in the offering are owned by the respective companies, and use of them does not imply any affiliation or endorsement. ## TL;DR