Skip to content

Commit 7089eef

Browse files
authored
Pin skill installer to v0.1.0 release tag (#4580)
## Summary - Pin skills installer to the `v0.1.0` released tag instead of `main` branch - Rename `DATABRICKS_SKILLS_BRANCH` env var to `DATABRICKS_SKILLS_REF` (accepts any git ref) ## Test plan - [x] Verify `databricks experimental aitools skills list` fetches manifest from the tagged release - [x] Verify `DATABRICKS_SKILLS_REF` env var override still works
1 parent ad00e25 commit 7089eef

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

experimental/aitools/lib/installer/installer.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@ import (
1212

1313
"github.com/databricks/cli/experimental/aitools/lib/agents"
1414
"github.com/databricks/cli/libs/cmdio"
15+
"github.com/databricks/cli/libs/log"
1516
"github.com/fatih/color"
1617
)
1718

1819
const (
19-
skillsRepoOwner = "databricks"
20-
skillsRepoName = "databricks-agent-skills"
21-
skillsRepoPath = "skills"
22-
defaultSkillsRepoBranch = "main"
20+
skillsRepoOwner = "databricks"
21+
skillsRepoName = "databricks-agent-skills"
22+
skillsRepoPath = "skills"
23+
defaultSkillsRepoRef = "v0.1.0"
2324
)
2425

25-
func getSkillsBranch() string {
26-
if branch := os.Getenv("DATABRICKS_SKILLS_BRANCH"); branch != "" {
27-
return branch
26+
func getSkillsRef() string {
27+
if ref := os.Getenv("DATABRICKS_SKILLS_REF"); ref != "" {
28+
return ref
2829
}
29-
return defaultSkillsRepoBranch
30+
return defaultSkillsRepoRef
3031
}
3132

3233
// Manifest describes the skills manifest fetched from the skills repo.
@@ -45,8 +46,10 @@ type SkillMeta struct {
4546

4647
// FetchManifest fetches the skills manifest from the skills repo.
4748
func FetchManifest(ctx context.Context) (*Manifest, error) {
49+
ref := getSkillsRef()
50+
log.Infof(ctx, "Fetching skills manifest from %s/%s@%s", skillsRepoOwner, skillsRepoName, ref)
4851
url := fmt.Sprintf("https://raw.githubusercontent.com/%s/%s/%s/manifest.json",
49-
skillsRepoOwner, skillsRepoName, getSkillsBranch())
52+
skillsRepoOwner, skillsRepoName, ref)
5053
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
5154
if err != nil {
5255
return nil, fmt.Errorf("failed to create request: %w", err)
@@ -73,7 +76,7 @@ func FetchManifest(ctx context.Context) (*Manifest, error) {
7376

7477
func fetchSkillFile(ctx context.Context, skillName, filePath string) ([]byte, error) {
7578
url := fmt.Sprintf("https://raw.githubusercontent.com/%s/%s/%s/%s/%s/%s",
76-
skillsRepoOwner, skillsRepoName, getSkillsBranch(), skillsRepoPath, skillName, filePath)
79+
skillsRepoOwner, skillsRepoName, getSkillsRef(), skillsRepoPath, skillName, filePath)
7780

7881
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
7982
if err != nil {

0 commit comments

Comments
 (0)