From 79e730cc3abe25240a6c4cc45e84b62801a860ed Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 9 May 2025 13:08:00 +0000 Subject: [PATCH 1/3] Add changes to accomodate pulling fluentbit image from public.ecr.aws and fallback to docker.io --- main.sh | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/main.sh b/main.sh index fb73059..a3f47cb 100755 --- a/main.sh +++ b/main.sh @@ -22,7 +22,7 @@ readonly LOG_FILE="/tmp/sg_runner.log" readonly COMMANDS=( "jq" "crontab" ) # readonly CONTAINER_ORCHESTRATORS=( "docker" "podman" ) readonly CONTAINER_ORCHESTRATORS=( "docker" ) -readonly FLUENTBIT_IMAGE="fluent/fluent-bit:2.2.0" +FLUENTBIT_IMAGE="fluent/fluent-bit:2.2.0" # source .env if exists # overrides [main] environment variables @@ -1095,16 +1095,42 @@ fetch_organization_info() { #{{{ # This portion checks whether the STORAGE_BACKEND_TYPE is # aws_s3 or azure_blob and runs the container accordingly. ######################################## +pull_fluentbit_image(){ + images=("public.ecr.aws/d4h1t0h5/private-runner/fluentbit:2.2.0" "fluent/fluent-bit:2.2.0") + + for image in "${images}"; do + image_exists="$($CONTAINER_ORCHESTRATOR images -q -f reference="$FLUENTBIT_IMAGE")" + + # return true if image is found + if [[ -n "$image_exists" ]]; then + FLUENTBIT_IMAGE="${image}" + return 0 + fi + done + + $CONTAINER_ORCHESTRATOR pull "${images[0]}" >> "$LOG_FILE" 2>&1 + image_pulled=$? + + FLUENTBIT_IMAGE="${images[0]}" + + if [[ $image_pulled -gt 0 ]]; then + debug "failed to pull from public.ecr.aws" + $CONTAINER_ORCHESTRATOR pull "${images[1]}" >> "$LOG_FILE" 2>&1 + image_pulled=$? + fi + FLUENTBIT_IMAGE="${images[1]}" + + return $image_pulled +} + configure_fluentbit() { #{{{ local running local exists local image - image="$($CONTAINER_ORCHESTRATOR images -q -f reference="$FLUENTBIT_IMAGE")" - if [[ -z "$image" ]]; then - info "Fluentbit image:" "$FLUENTBIT_IMAGE" - $CONTAINER_ORCHESTRATOR pull "$FLUENTBIT_IMAGE" >> "$LOG_FILE" 2>&1 & - spinner "$!" "Pulling image" + if ! pull_fluentbit_image; then + err "Failed to pull fluentbit image. Check if public.ecr.aws or *.docker.io is accessible" + exit 1 fi spinner_wait "Configuring fluentbit agent for workflow log collection.." From 1d71c0591bc768a4103b2ea484cd34581fb16e59 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 12 May 2025 16:06:13 +0000 Subject: [PATCH 2/3] add some info messages --- main.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.sh b/main.sh index a3f47cb..667283c 100755 --- a/main.sh +++ b/main.sh @@ -1128,12 +1128,13 @@ configure_fluentbit() { #{{{ local exists local image + spinner_wait "Configuring fluentbit agent for workflow log collection.." if ! pull_fluentbit_image; then err "Failed to pull fluentbit image. Check if public.ecr.aws or *.docker.io is accessible" exit 1 fi + spinner_msg "Configuring fluentbit agent for workflow log collection.." 0 - spinner_wait "Configuring fluentbit agent for workflow log collection.." # TODO: Identify --network host use-case docker_run_command="$CONTAINER_ORCHESTRATOR run -d \ --name fluentbit-agent \ From 59ea4662c157f4f128188d9b52bdd0b9710fc3e2 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 15 May 2025 15:57:30 +0000 Subject: [PATCH 3/3] Add warning message if docker hub is being used for fluentbit image --- main.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.sh b/main.sh index 667283c..06bf79a 100755 --- a/main.sh +++ b/main.sh @@ -1134,6 +1134,9 @@ configure_fluentbit() { #{{{ exit 1 fi spinner_msg "Configuring fluentbit agent for workflow log collection.." 0 + if [[ "${FLUENTBIT_IMAGE}" == "fluent/fluent-bit:2.2.0" ]]; then + info "WARNING: pulling from docker hub will be deprecated in the future" + fi # TODO: Identify --network host use-case docker_run_command="$CONTAINER_ORCHESTRATOR run -d \