Skip to content
Open
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
36 changes: 36 additions & 0 deletions agent_plugins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,42 @@ func TestAgentPluginsPublishWithBuildInfo(t *testing.T) {
assert.NotEmpty(t, module.Artifacts[0].Sha256, "artifact sha256 should be non-empty in build info")
}

// TestAgentPluginsPublishWithProjectFlag verifies that --project=<key> stores the
// build-info partials under the project-key-aware local directory (the build dir
// hash includes the project key), and that nothing is stored under the
// empty-project directory.
func TestAgentPluginsPublishWithProjectFlag(t *testing.T) {
initAgentPluginsTest(t)
defer cleanAgentPluginsTest()

slug := "project-flag-plugin"
Comment thread
udaykb2 marked this conversation as resolved.
buildName := tests.AgentPluginsBuildName + "-project"
buildNumber := "1"
projectKey := "testprj"
t.Cleanup(func() {
_ = coreBuild.RemoveBuildDir(buildName, buildNumber, projectKey)
_ = coreBuild.RemoveBuildDir(buildName, buildNumber, "")
})

require.NoError(t, runAgentPluginsCmd(t,
"publish", createTestPlugin(t, slug, "1.0.0"),
Comment thread
udaykb2 marked this conversation as resolved.
"--repo="+tests.AgentPluginsLocalRepo,
"--build-name="+buildName,
"--build-number="+buildNumber,
"--project="+projectKey,
))

partials, err := coreBuild.ReadPartialBuildInfoFiles(buildName, buildNumber, projectKey)
require.NoError(t, err)
require.Len(t, partials, 1, "expected 1 build-info partial stored with project key %q", projectKey)
assert.Equal(t, slug, partials[0].ModuleId)
assert.NotEmpty(t, partials[0].Artifacts, "published zip should be recorded as a build-info artifact")

partialsNoProject, err := coreBuild.ReadPartialBuildInfoFiles(buildName, buildNumber, "")
assert.NoError(t, err)
assert.Empty(t, partialsNoProject, "build info should NOT be stored under the empty project key directory")
}

// TestAgentPluginsNoBuildInfoWithoutFlags verifies that publishing without
// --build-name and --build-number does not create a build info entry.
func TestAgentPluginsNoBuildInfoWithoutFlags(t *testing.T) {
Expand Down
37 changes: 37 additions & 0 deletions agent_skills_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,43 @@ func TestAgentSkillsPublishBuildInfo(t *testing.T) {
assert.NotEmpty(t, props.Properties["build.timestamp"])
}

// TestAgentSkillsPublishWithProjectFlag verifies that --project=<key> stores the
// build-info partials under the project-key-aware local directory (the build dir
// hash includes the project key), and that nothing is stored under the
// empty-project directory.
func TestAgentSkillsPublishWithProjectFlag(t *testing.T) {
initAgentSkillsTest(t)
defer cleanAgentSkillsTest()

slug := "project-flag-skill"
buildName := tests.AgentSkillsBuildName + "-project"
buildNumber := "1"
projectKey := "testprj"
t.Cleanup(func() {
_ = coreBuild.RemoveBuildDir(buildName, buildNumber, projectKey)
_ = coreBuild.RemoveBuildDir(buildName, buildNumber, "")
})

require.NoError(t, runAgentSkillsCmd(t,
"publish", createTestSkill(t, slug, "1.0.0"),
"--repo="+tests.AgentSkillsLocalRepo,
"--skip-scan",
"--build-name="+buildName,
"--build-number="+buildNumber,
"--project="+projectKey,
))

partials, err := coreBuild.ReadPartialBuildInfoFiles(buildName, buildNumber, projectKey)
require.NoError(t, err)
require.Len(t, partials, 1, "expected 1 build-info partial stored with project key %q", projectKey)
assert.Equal(t, slug, partials[0].ModuleId)
assert.NotEmpty(t, partials[0].Artifacts, "published zip should be recorded as a build-info artifact")

partialsNoProject, err := coreBuild.ReadPartialBuildInfoFiles(buildName, buildNumber, "")
assert.NoError(t, err)
assert.Empty(t, partialsNoProject, "build info should NOT be stored under the empty project key directory")
}

// TestAgentSkillsPublishModuleOverride verifies --module overrides the default
// build-info module id (skill slug).
func TestAgentSkillsPublishModuleOverride(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/jfrog/build-info-go v1.13.1-0.20260811071930-3b99d4a6c84b
github.com/jfrog/gofrog v1.7.6
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260723152309-34eeb81e2847
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260804124646-1a5e6a2d3caf
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260810062257-afac3757dd37
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260809090751-06d8b791eb24
github.com/jfrog/jfrog-cli-evidence v0.9.5
github.com/jfrog/jfrog-cli-platform-services v1.10.1-0.20260618062042-6053ab368cab
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYL
github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w=
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260723152309-34eeb81e2847 h1:wahxu7URLrhdHtI3CVH3aE1Y3eeubDin13t+QVJBeW8=
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260723152309-34eeb81e2847/go.mod h1:p8yLtbmCxxQucIbLZKnWu0F+EDtj6NLXbRQCEK/nb6o=
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260804124646-1a5e6a2d3caf h1:HJob3Bsj6FtQ3nq72GGzBWXJ7ZXvUz6rKSGpYGAXwKI=
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260804124646-1a5e6a2d3caf/go.mod h1:UkVDiTbSgtk+7N2ePOsPvjPsgO8r8rJtUchjcnAk08w=
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260810062257-afac3757dd37 h1:YviOnKCh/OKV5dhPYp828KmighW5bZ2OKt78Xk4Fs3E=
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260810062257-afac3757dd37/go.mod h1:UkVDiTbSgtk+7N2ePOsPvjPsgO8r8rJtUchjcnAk08w=
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260809090751-06d8b791eb24 h1:boI4fGv/Sn+9z6sZOYRlpT45Y+nkYFL3nCK0MkQBV4w=
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260809090751-06d8b791eb24/go.mod h1:MygQx8pekgPCXyXnejIAVG9S4ImGcDFmcfRPUug/0d0=
github.com/jfrog/jfrog-cli-evidence v0.9.5 h1:YzkoYZtqChStPOxEj1odF7satpv1YPl1Zb/IZ/wZ9kc=
Expand Down
Loading