Skip to content
Merged
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
34 changes: 34 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,40 @@ jobs:
cp -r .workflow-actions/.github/scripts/. .github/scripts/
printf '.workflow-actions/\n.github/scripts/\n' >> .git/info/exclude

# The skills release that is the latest at build time becomes the
# binary's fallback for when the runtime lookup fails. The variable it
# sets, internal/build.agentSkillsFallbackVersion, comes with #8202.
# This reads the skills repo's latest GitHub release, authenticated, so
# a release whose version commit landed without its tag is skipped, and
# checks that the release's manifest is served. A rebuild of an older
# tag skips the step, so it keeps the fallback the release shipped with
# rather than a newer release the older CLI was never built against.
# Fail open: the binary then falls back to the compatibility manifest's
# pin.
- name: Resolve the latest skills release for the embedded fallback
if: ${{ !inputs.tag }}
env:
GH_TOKEN: ${{ github.token }}
run: |
# The linker ignores -X for a symbol that does not exist, so a typo in
# the flag would build green and embed nothing, and the binary records
# the flag's text in its build info either way, so the binary cannot
# show it. Check instead that the built source declares the variable
# that .goreleaser.yaml names.
target=$(grep -oE 'internal/build\.[A-Za-z]+=\{\{ envOrDefault "DATABRICKS_SKILLS_FALLBACK_VERSION"' .workflow-actions/.goreleaser.yaml | cut -d. -f2 | cut -d= -f1)
if [ -z "$target" ] || ! grep -qE "^var $target string" internal/build/*.go; then
echo "::warning::The built source does not declare internal/build.${target:-<missing>}; this build embeds no skills fallback"
exit 0
fi
v=$(gh api repos/databricks/databricks-agent-skills/releases/latest --jq '.tag_name' 2>/dev/null || true)
v=${v#v}
if [[ "$v" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && curl -sfL --max-time 15 -o /dev/null "https://raw.githubusercontent.com/databricks/databricks-agent-skills/v$v/manifest.json"; then
echo "Latest skills release: $v"
echo "DATABRICKS_SKILLS_FALLBACK_VERSION=$v" >> "$GITHUB_ENV"
else
echo "::warning::Could not resolve the latest skills release; this build embeds no skills fallback and falls back to the compatibility manifest's pin"
fi

# Use --snapshot for branch builds (non-tag refs).
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0
Expand Down
6 changes: 6 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ builds:
- '-s -w'
- -X github.com/databricks/cli/internal/build.buildProjectName={{ .ProjectName }}
- -X github.com/databricks/cli/internal/build.buildVersion={{ .Version }}
# The skills release that was the latest at build time, resolved by the
# release-build workflow; empty when it could not be resolved and for
# rebuilds of older tags. The variable comes with #8202. The linker
# ignores -X for a variable the built source does not declare, so this is
# a no-op before then; the workflow checks that the source declares it.
- -X github.com/databricks/cli/internal/build.agentSkillsFallbackVersion={{ envOrDefault "DATABRICKS_SKILLS_FALLBACK_VERSION" "" }}
Comment thread
simonfaltum marked this conversation as resolved.
Resolved
Comment thread
simonfaltum marked this conversation as resolved.
Resolved

# Git information
- -X github.com/databricks/cli/internal/build.buildBranch={{ .Branch }}
Expand Down
Loading