upgrade-telegraf

작성자: microsoft

dalec-build-defs 저장소에서 Telegraf를 새 버전으로 업그레이드합니다. 새 spec 파일을 생성하고, 버전/커밋/변경 로그를 업데이트하며, PR을 위한 브랜치를 준비합니다. 사용…

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.

microsoft의 다른 스킬

oss-growth
microsoft
OSS 성장 해커 페르소나
agent-framework-azure-ai-py
microsoft
Microsoft Agent Framework Python SDK(agent-framework-azure-ai)를 사용하여 Azure AI Foundry 에이전트를 구축합니다. AzureAIAgentsProvider로 지속적 에이전트를 만들 때, 호스팅 도구(코드 인터프리터, 파일 검색, 웹 검색)를 사용할 때, MCP 서버를 통합할 때, 대화 스레드를 관리할 때, 또는 스트리밍 응답을 구현할 때 사용합니다. 함수 도구, 구조화된 출력, 다중 도구 에이전트를 다룹니다.
development
airunway-aks-setup
microsoft
AKS에서 AI Runway 설정 — 빈 클러스터에서 실행 중인 모델까지. 클러스터 검증, 컨트롤러 설치, GPU 평가, 공급자 설정, 첫 배포를 다룹니다. 시기: "AI Runway 설정", "AKS 클러스터 온보딩", "AI Runway 설치", "airunway 설정", "AKS에 모델 배포", "AKS에서 GPU 추론", "AKS에서 KAITO 설정", "AKS에서 LLM 실행", "AKS에서 vLLM", "AKS에서 모델 서빙 설정", "AI Runway 컨트롤러".
devops
appinsights-instrumentation
microsoft
Azure Application Insights로 웹앱을 계측하기 위한 지침입니다. 원격 분석 패턴, SDK 설정, 구성 참조를 제공합니다. WHEN: 앱 계측 방법, App Insights SDK, 원격 분석 패턴, App Insights란 무엇인가, Application Insights 지침, 계측 예시, APM 모범 사례.
devops
applicationinsights-web-ts
microsoft
브라우저/웹 앱을 Application Insights JavaScript SDK(@microsoft/applicationinsights-web)로 계측합니다. Real User Monitoring(RUM) — 페이지 뷰, 클릭, AJAX/fetch 종속성, 예외, 사용자 지정 이벤트, 백엔드 OpenTelemetry 트레이스와 상관관계가 있는 브라우저 측 GenAI 에이전트 트레이스에 사용합니다. SDK Loader Script 및 npm 설정, 프레임워크 확장(React, React Native, Angular), Click Analytics, 텔레메트리 이니셜라이저, 브라우저에서 생성된 에이전트/도구/모델 스팬에 대한 OTel GenAI 의미론적 규칙을 다룹니다.
devops
azure-ai-anomalydetector-java
microsoft
Azure AI Anomaly Detector SDK for Java로 이상 탐지 애플리케이션을 구축하세요. 단변량/다변량 이상 탐지, 시계열 분석 또는 AI 기반 모니터링을 구현할 때 사용하세요.
development
azure-ai-language-conversations-py
microsoft
azure-ai-language-conversations Python SDK를 사용하여 대화형 언어 이해(CLU)를 구현합니다. ConversationAnalysisClient로 대화 의도와 엔터티를 분석하거나, NLP 기능을 구축하거나, 애플리케이션에 언어 이해를 통합할 때 사용합니다.
development
azure-ai-ml-py
microsoft
Azure Machine Learning SDK v2 for Python. ML 작업 영역, 작업, 모델, 데이터 세트, 컴퓨팅 및 파이프라인에 사용합니다. 트리거: "azure-ai-ml", "MLClient", "workspace", "model registry", "training jobs", "datasets".
development