Skip to content
Open
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
9 changes: 9 additions & 0 deletions .ci/scripts/update-integration-testdata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say add an entry in the CODEOWNERS for this file, otherwise, robots-ci will be the codeowners and we don't own it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, added an entry with @elastic/elastic-agent-control-plane as owners (please, let me know if another team should own this). 4a53ad5

Also, I changed the backport to active-9 for now. Otel components dependencies are only being updated in 9.1 and 9.2, which makes the alignment with the latest kube-stack versions harder.

#
# This script is executed by the automation we are putting in place
# and it requires the git add/commit commands.
#
set -euo pipefail

echo "~~~ Running mage integration:buildKubernetesTestData"
mage integration:buildKubernetesTestData
62 changes: 62 additions & 0 deletions .ci/updatecli/updatecli-bump-kube-stack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: Bump OpenTelemetry Kube Stack Helm Chart to latest versions

scms:
elastic-agent:
kind: github
spec:
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
username: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: '{{ .scm.owner }}'
repository: '{{ .scm.repository }}'
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
commitusingapi: true
branch: '{{ .scm.branch }}'
force: false


actions:
elastic-agent:
kind: github/pullrequest
scmid: elastic-agent
spec:
automerge: false
labels:
- backport-active-9
- dependencies
- skip-changelog
- Team:Elastic-Agent-Control-Plane
title: '[otel/kube-stack] Update the OpenTelemetry Kube Stack Helm Chart to latest versions'
description: |
Update the versions of the OpenTelemetry Kube Stack Helm Chart being used in the OpenTelemetry Onboarding configuration.

sources:
opentelemetry-kube-stack-helm:
name: "Get latest OpenTelemetry Kube Stack Helm Chart release"
kind: helmchart
spec:
url: https://open-telemetry.github.io/opentelemetry-helm-charts
name: opentelemetry-kube-stack

targets:
update-tested-kube-stack:
name: "Update tested OpenTelemetry Kube Stack Helm Chart in k8s.go"
kind: file
scmid: elastic-agent
sourceid: opentelemetry-kube-stack-helm
spec:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest using regex groups, then you don't need to worry about the spaces.

If you go to https://www.updatecli.io/docs/plugins/resource/file/#_file_target, you can see an example:

e.g this example updates the year on the "Copyright" substrings to 2021 while keeping the existing content such as contributors).:

targets:
  updateCopyrightYear:
    kind: file
    sourceid: whateverSource # Will be ignored as `replacepattern` is specified
    spec:
      file: LICENSE
      matchpattern: 'Copyright \(c\) (\d*) (.*)'
      replacepattern: 'Copyright (c) 2021 $2'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, capturing groups approach 34a766b

file: "testing/integration/k8s/k8s.go"
matchpattern: '(KubeStackChartVersion\s*=\s)".*"'
replacepattern: '$1"{{ source "opentelemetry-kube-stack-helm" }}"'

update-testdata:
Copy link
Contributor Author

@rogercoll rogercoll Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elastic/observablt-ci Would you recommend any other way of running post-target commands? After the version has been updated in update-tested-kube-stack, we need to run mage integration:buildKubernetesTestData to update the local files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's possible, however you might need to configure the environment first:

  1. Install the tools as part of the script or the GitHub workflow, you choose
  2. Configure the env variables in the updatecli manifest. See https://www.updatecli.io/docs/plugins/resource/shell/#_environments

For instance, for the elastic/apm-server you can see the below snippets (it configures the environment in the GitHub workflow):


I recommend to run those steps locally first, so if it works locally it should work with GH actions or any other CI vendor.

$ GITHUB_TOKEN=$(gh auth token) \
   GITHUB_ACTOR=<your-user> \
   updatecli diff \
           --config ci/updatecli/updatecli-bump-kube-stack.yml \
           --values .ci/updatecli/values.d/scm.yml

Then you can modify .ci/updatecli/values.d/scm.yml and use your github-user in .scm.owner and run:

$ GITHUB_TOKEN=$(gh auth token) \
   GITHUB_ACTOR=<your-user> \
   updatecli apply \
           --config ci/updatecli/updatecli-bump-kube-stack.yml \
           --values .ci/updatecli/values.d/scm.yml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was really valuable, thanks! Sample execution #10629

name: 'Update local OpenTelemetry Kube Stack Helm Chart files'
dependson:
- update-tested-kube-stack
scmid: elastic-agent
kind: shell
spec:
command: /home/neck/Documents/github/rogercoll/elastic-agent/.ci/scripts/update-integration-testdata.sh
environments:
- name: PATH
- name: HOME
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ changelog/fragments/
/.buildkite @elastic/elastic-agent-control-plane @elastic/observablt-ci
/.ci @elastic/elastic-agent-control-plane @elastic/observablt-ci
/.ci/scripts/ecp-internal-release.sh @elastic/elastic-agent-control-plane
/.ci/scripts/update-integration-testdata.sh @elastic/elastic-agent-control-plane
/.ci/scripts/update-otel.sh @elastic/elastic-agent-control-plane
/.github @elastic/elastic-agent-control-plane @elastic/observablt-ci
/.github/CODEOWNERS @elastic/ingest-tech-lead
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/bump-kube-stack-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: bump-kube-stack-version

on:
workflow_dispatch:
schedule:
- cron: "0 20 * * 1-6"

permissions:
contents: read

env:
JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

jobs:
bump:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Install mage
uses: magefile/mage-action@6f50bbb8ea47d56e62dee92392788acbc8192d0b # v3.1.0
with:
version: v1.14.0
install-only: true

- uses: elastic/oblt-actions/updatecli/run@v1
with:
command: apply --config .ci/updatecli/updatecli-bump-kube-stack.yml --values .ci/updatecli/values.d/scm.yml
version-file: .updatecli-version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- if: ${{ failure() }}
uses: elastic/oblt-actions/slack/send@v1
with:
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
channel-id: "#ingest-notifications"
message: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, `@agent-team` please look what's going on <${{ env.JOB_URL }}|here>"