Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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: 7 additions & 3 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 All @@ -31,6 +32,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 Down Expand Up @@ -95,7 +100,6 @@ jobs:
echo "commit_message_finalize=$commit_finalize" >> $GITHUB_OUTPUT
echo "body_open=$body_open" >> $GITHUB_OUTPUT
echo "body_finalize=$body_finalize" >> $GITHUB_OUTPUT

[ "$NEED_UPDATE" = "1" ] && echo "chlog_note_chart=Bump ${NAME} to ${LATEST_VER} in ${YAML_PATH}" >> $GITHUB_OUTPUT
if [ "$CRDS_UPDATE" = "1" ]; then
CRDS_CHLOG="Bump subchart opentelemetry-operator-crds to ${CRDS_VER}. Refer to further [instructions](https://github.com/signalfx/splunk-otel-collector-chart/blob/main/helm-charts/splunk-otel-collector/charts/opentelemetry-operator-crds/README.md#upgrade-notes) for updating CRDs if using \`operatorcrds.install\` option."
Expand Down
50 changes: 50 additions & 0 deletions ci_scripts/update-chart-dependency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,54 @@ 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
local updated_file

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"
updated_file=$(mktemp "${values_file}.XXXXXX")
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:/, matches) {
in_image=1
image_indent=matches[1]
Comment thread
MrAlias marked this conversation as resolved.
Outdated
}
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"
mv "$updated_file" "$values_file"
Comment thread
MrAlias marked this conversation as resolved.
Outdated
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 Down Expand Up @@ -65,6 +113,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

echo "Current git diff:"
Expand Down
Loading