Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/update_chart_dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ name: Check for new chart dependency updates
# Specifically, it:
# 1. Checks for new versions of (subchart) dependencies listed in chart.yaml.
# 2. Updates chart.yaml with new versions where applicable.
# 3. If the 'opentelemetry-operator' subchart is updated in chart.yaml, it also updates related
# image tags in values.yaml.
# 3. Updates related values.yaml defaults when a subchart version bump requires it.
# 4. If the 'opentelemetry-operator' subchart is updated in chart.yaml, it also updates related
# image tags in values.yaml and CRD assets when needed.

on:
schedule:
Expand Down Expand Up @@ -35,6 +36,10 @@ jobs:
component: 'operator'
yaml_file_path: 'helm-charts/splunk-otel-collector/Chart.yaml'
dependency_name: 'opentelemetry-operator'
- name: 'obi'
component: 'chart'
yaml_file_path: 'helm-charts/splunk-otel-collector/Chart.yaml'
dependency_name: 'opentelemetry-ebpf-instrumentation'
Comment thread
MrAlias marked this conversation as resolved.
env:
DEBUG_MODE: ${{ github.event.inputs.DEBUG_MODE }}
steps:
Expand All @@ -59,6 +64,7 @@ jobs:
make update-operator-crds DEBUG_MODE="$DEBUG_MODE"

- name: Install Skopeo
if: ${{ matrix.name == 'operator' }}
run: |
sudo apt-get update
sudo apt-get install -y skopeo
Expand Down
62 changes: 62 additions & 0 deletions ci_scripts/update-chart-dependency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,66 @@ update_operator_images() {
$SCRIPT_DIR/update-images-operator-otel.sh
}

# Function: update_obi_image_tag
# Description: Keeps the parent chart's default OBI image tag aligned with the subchart version.
update_obi_image_tag() {
local values_file="$VALUES_FILE_PATH"
local normalized_ver="${LATEST_VER#v}" # Strip leading 'v' if present
local target_tag="v$normalized_ver"
local current_tag

current_tag=$(yq eval '.obi.image.tag' "$values_file")
echo "Current OBI image tag in values.yaml is $current_tag"

if [ "$current_tag" != "$target_tag" ]; then
echo "Updating OBI image tag to $target_tag in values.yaml"
if (
updated_file=$(mktemp "${values_file}.XXXXXX")
trap 'if [ -n "$updated_file" ] && [ -f "$updated_file" ]; then rm -f "$updated_file"; fi' EXIT

if awk -v target_tag="$target_tag" '
BEGIN {
in_obi=0
in_image=0
updated=0
image_indent=""
}
/^obi:/ { in_obi=1 }
in_obi && /^[^[:space:]][^:]*:/ && !/^obi:/ { in_obi=0; in_image=0 }
in_obi && match($0, /^[[:space:]]+image:/) {
in_image=1
image_indent=substr($0, RSTART, RLENGTH - length("image:"))
}
in_image && $0 ~ ("^" image_indent "[^[:space:]][^:]*:") && $0 !~ ("^" image_indent "image:") { in_image=0 }
in_image && $0 ~ ("^" image_indent "[[:space:]]+tag: ") {
print image_indent " tag: \"" target_tag "\""
updated=1
in_image=0
next
}
{ print }
END {
if (!updated) {
exit 1
}
}
' "$values_file" > "$updated_file"; then
mv "$updated_file" "$values_file"
updated_file=""
else
echo "Error: Failed to update obi.image.tag in $values_file; expected to find obi.image.tag and rewrite it to $target_tag." >&2
exit 1
fi
); then
:
else
Comment thread
MrAlias marked this conversation as resolved.
return 1
fi
else
echo "OBI image tag is already up to date in values.yaml"
fi
}

# Function: maybe_update_chart_dependency_version
# Description: Updates the chart dependency version if a newer version is available.
maybe_update_chart_dependency_version() {
Expand All @@ -61,6 +121,8 @@ maybe_update_chart_dependency_version() {

if [ "$SUBCHART_NAME" == "opentelemetry-operator" ]; then
update_operator_images
elif [ "$SUBCHART_NAME" == "opentelemetry-ebpf-instrumentation" ]; then
update_obi_image_tag
fi

emit_output "NEED_UPDATE"
Expand Down
Loading