upgrade-telegraf

Met à niveau Telegraf vers une nouvelle version dans le dépôt dalec-build-defs. Crée un nouveau fichier spec, met à jour la version/commit/changelog, et prépare une branche pour une PR. Utilise…

npx skills add https://github.com/microsoft/docker-provider --skill upgrade-telegraf

Upgrade Telegraf Version

This skill creates a new DALEC spec file for a new Telegraf release in the dalec-build-defs repository.

Overview

Telegraf specs live at specs/telegraf-agent/telegraf-agent-<VERSION>.yml. Each version is a standalone file copied from the latest existing spec with updated version-specific fields.

Step-by-step procedure

Step 1: Determine the target version

If the user did NOT provide a specific version, fetch the latest release from GitHub:

curl -sL https://api.github.com/repos/influxdata/telegraf/releases/latest | jq -r '.tag_name'

The tag is in the format v1.XX.Y. Strip the leading v to get the VERSION (e.g. 1.38.0).

If the user provided a version, use that directly.

Step 2: Get the commit SHA for the release tag

curl -sL https://api.github.com/repos/influxdata/telegraf/git/refs/tags/v<VERSION> | jq -r '.object.sha'

IMPORTANT: If the tag object type is "tag" (annotated tag), you must dereference it to get the actual commit SHA:

# First get the tag object
TAG_SHA=$(curl -sL https://api.github.com/repos/influxdata/telegraf/git/refs/tags/v<VERSION> | jq -r '.object.sha')
TAG_TYPE=$(curl -sL https://api.github.com/repos/influxdata/telegraf/git/refs/tags/v<VERSION> | jq -r '.object.type')

# If it's an annotated tag, dereference to get the commit
if [ "$TAG_TYPE" = "tag" ]; then
  COMMIT=$(curl -sL https://api.github.com/repos/influxdata/telegraf/git/tags/$TAG_SHA | jq -r '.object.sha')
else
  COMMIT=$TAG_SHA
fi

Verify the commit SHA is a full 40-character hex string.

Step 3: Verify the version doesn't already exist

Check that the file specs/telegraf-agent/telegraf-agent-<VERSION>.yml does NOT already exist in the workspace. If it does, inform the user and stop.

Step 4: Identify the latest existing spec file

Find the latest (highest version) existing spec file in specs/telegraf-agent/:

ls specs/telegraf-agent/telegraf-agent-*.yml | sort -V | tail -1

Read this file — it will be used as the template for the new spec.

Step 5: Create the new spec file

Copy the latest spec and update these fields:

FieldOld valueNew value
args.VERSIONold version<VERSION> (e.g. 1.38.0)
args.COMMITold commit SHAnew commit SHA from Step 2
args.REVISIONany value"1" (always reset to 1 for new versions)
tests[].steps[].stdout.contains[]old version string"<VERSION>"
changelogold entriesReplace with a single new entry. Each spec file should only contain a changelog entry for its own version — do NOT carry forward changelog entries from the previous spec file.

Changelog entry format

changelog:
  - date: "<TODAY in YYYY-MM-DD format>"
    author: "<git user.name> <<git user.email>>"
    changes:
      - Upgrade telegraf package version to <VERSION>

Get the author info from git config:

GIT_NAME=$(git config user.name)
GIT_EMAIL=$(git config user.email)

Do NOT change any other fields — keep the same #syntax frontend version (copied from the latest existing spec file), build targets, dependencies, build steps, LDFLAGS pattern, artifact paths, test structure, etc.

NOTE on #syntax version: The #syntax=ghcr.io/azure/dalec/frontend:X.XX line changes over time. Do NOT hardcode it. Always copy it verbatim from the latest existing spec file found in Step 4.

Step 6: Pull latest main, create a git branch and commit

IMPORTANT: Always fetch and rebase onto the latest origin/main before creating the branch. This ensures the new spec is based on the current state of the repository and avoids conflicts with specs already merged to main.

git fetch origin main
git checkout main
git rebase origin/main
git checkout -b copilot/upgrade-telegraf-<VERSION>
git add specs/telegraf-agent/telegraf-agent-<VERSION>.yml
git commit -m "Upgrade telegraf package version to <VERSION>"

Step 7: Push branch, create PR

Push the branch and create the PR automatically — no user confirmation needed.

git push origin copilot/upgrade-telegraf-<VERSION>

Create the PR using the GitHub REST API via curl. Extract the auth token from the git credential helper:

TOKEN=$(echo "protocol=https
host=github.com" | git credential fill 2>/dev/null | grep password | cut -d= -f2)

Then create the PR:

curl -s -X POST \
  -H "Authorization: token $TOKEN" \
  -H "Accept: application/vnd.github+json" \
  https://api.github.com/repos/Azure/dalec-build-defs/pulls \
  -d '{
  "title": "Upgrade telegraf package version to <VERSION>",
  "head": "copilot/upgrade-telegraf-<VERSION>",
  "base": "main",
  "body": "<PR_BODY>"
}'

Why not gh CLI? In this environment, gh CLI installation requires sudo (which may not be available or may block on a password prompt), and even when installed, gh auth login fails because the git credential manager token typically lacks the read:org scope that gh requires. The curl approach works reliably with the existing git credentials.

Use the following PR body (with proper JSON escaping — \n for newlines, \\ for backslashes in shell):

**What this PR does / why we need it**:
Telegraf upgrade to resolve CVE

**Which issue(s) this PR fixes** *(optional, using `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when the PR gets merged)*:

Fixes #

**Checklist**:

- [x] Is this contribution for a third-party (non-Microsoft) open-source CNCF (Cloud Native Computing Foundation) or Kubernetes-related project.
- [x] You are willing to maintain the contributed DALEC specs and update it when necessary.
- [x] Have the corresponding test requirements been met?
  - [x] Are there baseline tests within the test section of the spec(s) that validate the artifact is being built?
  - [x] Is there a test.sh script that performs some level of E2E testing?
  - [x] Are there unit tests for any patches/code changes?
- [ ] In addition to a spec PR for this repo, you will have to submit corresponding PRs for MCR Onboarding for `oss/v2` repository.
  - [ ] [MCR](https://github.com/microsoft/mcr/blob/main/teams/oss/azurecontainerupstream-v2.yml) PR
  - [ ] [mcrdocs](https://github.com/microsoft/mcrdocs/tree/main/teams/oss) PR
- [x] Have you deconflicted the package name with existing packages?
  - [ ] [Azure Linux 3.0 packages](https://github.com/microsoft/azurelinux/tree/3.0/SPECS)
- [x] If these images already exist in [`mcr.microsoft.com/oss`](https://mcr.microsoft.com/en-us/catalog?search=/oss), have you checked the repository and image name is kept the same?
- [x] Have you updated the [CODEOWNERS file](https://github.com/Azure/dalec-build-defs/blob/main/.github/CODEOWNERS)?
- [ ] Have you updated the [upstream_mapping.yml file](https://github.com/Azure/dalec-build-defs/blob/main/upstream_mapping.yml)?

**Special notes for your reviewer**:

Parse the PR URL from the JSON response:

curl ... | jq -r '.html_url'

Step 8: Summary

After all steps, print a summary:

  • New file path
  • Version and commit SHA used
  • Branch name
  • PR URL (from gh pr create output)

Reference: Spec file template

Here is the general structure of a telegraf spec file for reference. The #syntax line below is an example only — always copy the actual value from the latest existing spec file (Step 4).

#syntax=ghcr.io/azure/dalec/frontend:<COPY_FROM_LATEST_SPEC>

args:
  VERSION: <VERSION>
  COMMIT: <COMMIT_SHA>
  REVISION: "1"

name: telegraf-agent
packager: Azure Container Upstream
vendor: Microsoft Corporation
license: MIT
website: https://github.com/influxdata/telegraf
description: telegraf
version: ${VERSION}
revision: ${REVISION}
x-build-extensions:
  build-targets:
    - azlinux3/rpm

sources:
  telegraf-agent:
    git:
      url: https://github.com/influxdata/telegraf.git
      commit: ${COMMIT}
    generate:
      - gomod: {}

dependencies:
  build:
    msft-golang:
  runtime:
    openssl-libs:

build:
  env:
    VERSION: ${VERSION}
    COMMIT: ${COMMIT}
    GOPROXY: direct
    GOEXPERIMENT: systemcrypto
    CGO_ENABLED: "1"
    INTERNAL_PKG: github.com/influxdata/telegraf/internal
  steps:
    - command: |
        cd telegraf-agent
        export LDFLAGS="-s -w -X ${INTERNAL_PKG}.Commit=${COMMIT} -X ${INTERNAL_PKG}.Version=${VERSION}-${COMMIT}"
        go build -o telegraf-agent -ldflags "${LDFLAGS}" ./cmd/telegraf

artifacts:
  binaries:
    telegraf-agent/telegraf-agent: {}
  licenses:
    telegraf-agent/LICENSE: {}

tests:
  - name: Check permissions
    files:
      /usr/bin/telegraf-agent:
        permissions: 0755
  - name: Validate telegraf version
    steps:
      - command: /usr/bin/telegraf-agent --version
        stdout:
          contains:
            - "<VERSION>"

changelog:
  - date: "<YYYY-MM-DD>"
    author: "Copilot on behalf of <Name> <<email>>"
    changes:
      - Upgrade telegraf package version to <VERSION>

Important rules

  • REVISION is always "1" for a new version file.
  • Dates must be ISO 8601 format: YYYY-MM-DD.
  • Do NOT modify any existing spec files.
  • Do NOT update index.yml or upstream_mapping.yml — telegraf-agent is not listed there.
  • Do NOT change build dependencies, build steps, or artifact paths unless the upstream project changed its structure.
  • Always dereference annotated tags to get the actual commit SHA.
  • The #syntax frontend version is NOT fixed — always copy it from the latest existing spec file (Step 4). Never hardcode a specific version.

Plus de skills de microsoft

oss-growth
microsoft
Persona de growth hacker OSS
agent-framework-azure-ai-py
microsoft
Créez des agents Azure AI Foundry à l’aide du SDK Python Microsoft Agent Framework (agent-framework-azure-ai). À utiliser lors de la création d’agents persistants avec AzureAIAgentsProvider, de l’utilisation d’outils hébergés (interpréteur de code, recherche de fichiers, recherche web), de l’intégration de serveurs MCP, de la gestion de fils de conversation ou de l’implémentation de réponses en streaming. Couvre les outils de fonction, les sorties structurées et les agents multi-outils.
development
airunway-aks-setup
microsoft
Configurez AI Runway sur AKS — du cluster nu au modèle en cours d'exécution. Couvre la vérification du cluster, l'installation du contrôleur, l'évaluation GPU, la configuration du fournisseur et le premier déploiement. QUAND : « configurer AI Runway », « intégrer un cluster AKS », « installer AI Runway », « configuration airunway », « déployer un modèle sur AKS », « inférence GPU sur AKS », « configuration KAITO sur AKS », « exécuter LLM sur AKS », « vLLM sur AKS », « configurer le service de modèles sur AKS », « contrôleur AI Runway ».
devops
appinsights-instrumentation
microsoft
Conseils pour instrumenter les applications web avec Azure Application Insights. Fournit des modèles de télémétrie, la configuration du SDK et des références de configuration. QUAND : comment instrumenter une application, SDK App Insights, modèles de télémétrie, qu'est-ce qu'App Insights, conseils sur Application Insights, exemples d'instrumentation, bonnes pratiques APM.
devops
applicationinsights-web-ts
microsoft
Instrumentez les applications navigateur/web avec le SDK JavaScript Application Insights (@microsoft/applicationinsights-web). Utilisez-le pour la surveillance des utilisateurs réels (RUM) — vues de page, clics, dépendances AJAX/fetch, exceptions, événements personnalisés et traces d’agents GenAI côté navigateur corrélées aux traces OpenTelemetry backend. Couvre le script de chargement du SDK et la configuration npm, les extensions de framework (React, React Native, Angular), Click Analytics, les initialiseurs de télémétrie et les conventions sémantiques OTel GenAI pour les spans d’agents/outils/modèles émises depuis le navigateur.
devops
azure-ai-anomalydetector-java
microsoft
Créez des applications de détection d'anomalies avec le SDK Azure AI Anomaly Detector pour Java. Utilisez-le lors de l'implémentation de la détection d'anomalies univariées/multivariées, de l'analyse de séries temporelles ou de la surveillance basée sur l'IA.
development
azure-ai-language-conversations-py
microsoft
Implémentez la compréhension du langage conversationnel (CLU) à l’aide du SDK Python azure-ai-language-conversations. Utilisez-le lorsque vous travaillez avec ConversationAnalysisClient pour analyser l’intention et les entités d’une conversation, créer des fonctionnalités de NLP ou intégrer la compréhension du langage dans des applications.
development
azure-ai-ml-py
microsoft
SDK v2 d’Azure Machine Learning pour Python. Utiliser pour les espaces de travail ML, les tâches, les modèles, les jeux de données, le calcul et les pipelines. Déclencheurs : « azure-ai-ml », « MLClient », « espace de travail », « registre de modèles », « tâches d’entraînement », « jeux de données ».
development