Skip to content
Merged
Changes from 2 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
116 changes: 116 additions & 0 deletions .github/workflows/nightly-serverless-init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Nightly serverless-init build
Comment thread
apiarian-datadog marked this conversation as resolved.

on:
schedule:
# 2 AM UTC (~9 PM ET), daily
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The timezone note is inaccurate during daylight saving time (2 AM UTC is ~10 PM ET during EDT and ~9 PM during EST). Consider updating the comment to avoid confusion (e.g., "~9–10 PM ET" or omit the ET conversion).

Suggested change
# 2 AM UTC (~9 PM ET), daily
# 2 AM UTC (~9–10 PM ET), daily

Copilot uses AI. Check for mistakes.
- cron: "0 2 * * *"
workflow_dispatch:

env:
IMAGE_NAME: datadog/datadog-lambda-extension/serverless-init
REGISTRY: ghcr.io

jobs:
build-nightly:
runs-on: ubuntu-22.04
permissions:
Comment thread
apiarian-datadog marked this conversation as resolved.
packages: write
strategy:
matrix:
arrays:
- { dockerFile: "Dockerfile.serverless-init.build", isAlpine: "false", tagSuffix: "" }
- { dockerFile: "Dockerfile.serverless-init.alpine.build", isAlpine: "true", tagSuffix: "-alpine" }
name: "Nightly Build (isAlpine: ${{ matrix.arrays.isAlpine }})"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: DataDog/datadog-agent
ref: main
path: datadog-agent

- name: Compute version tags
id: meta
run: |
STAMP=$(date -u +%Y%m%d)
SHORT_SHA=$(git -C datadog-agent rev-parse --short=8 HEAD)
echo "stamp=${STAMP}" >> "$GITHUB_OUTPUT"
echo "short_sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
echo "version=nightly-${STAMP}-${SHORT_SHA}" >> "$GITHUB_OUTPUT"

# Pin QEMU to a known-good version. See release-serverless-init.yml
# and test-qemu-versions.yml for context on QEMU breakage history.
- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
with:
image: tonistiigi/binfmt:qemu-v10.1.3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0

- name: Build binaries
working-directory: ./scripts
run: ./build_serverless_init.sh
env:
AGENT_PATH: datadog-agent
VERSION: ${{ steps.meta.outputs.version }}
SERVERLESS_INIT: "true"
Comment thread
apiarian-datadog marked this conversation as resolved.
ALPINE: ${{ matrix.arrays.isAlpine }}

- name: Set up build directory and copy binaries
run: cp -r .layers/. ./scripts/bin/

- name: Set up tracer installation script
run: cp ./scripts/serverless_init_dotnet.sh ./scripts/bin/

- name: Login to GHCR
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
context: ./scripts
file: ./scripts/${{ matrix.arrays.dockerFile }}
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-main${{ matrix.arrays.tagSuffix }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-${{ steps.meta.outputs.stamp }}-${{ steps.meta.outputs.short_sha }}${{ matrix.arrays.tagSuffix }}
provenance: false
platforms: linux/amd64,linux/arm64

retry:
needs: [build-nightly]
if: failure() && fromJSON(github.run_attempt) < 2
runs-on: ubuntu-22.04
permissions:
actions: write
steps:
- name: Retry failed action
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: gh workflow run retry-workflow.yml -F run_id=${{ github.run_id }}

notify:
needs: [build-nightly]
if: failure() && fromJSON(github.run_attempt) >= 2
runs-on: ubuntu-22.04
steps:
- name: Notify Slack
env:
SLACK_CHANNEL: "#serverless-agent"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
run: |
OPS_MESSAGE=":gh-check-failed: Nightly serverless-init build failed!

The nightly build from datadog-agent main did not succeed after retry.

See ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} for details."

curl -H "Content-type: application/json" -X POST "$SLACK_WEBHOOK" \
-d "$(jq -n --arg channel "$SLACK_CHANNEL" --arg text "$OPS_MESSAGE" '{channel: $channel, text: $text}')"
Loading