Skip to content

Commit

Permalink
Add include dependencies option to release bundle creation
Browse files Browse the repository at this point in the history
  • Loading branch information
RobiNino committed Feb 1, 2024
1 parent 1960731 commit 52dc127
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)

// replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.31.1-0.20240122141213-a1db3c179c7e
replace github.com/jfrog/jfrog-cli-core/v2 => github.com/RobiNino/jfrog-cli-core/v2 v2.0.0-20240201080739-11cd9aee47ce

// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20240122123649-74f725715bbe
replace github.com/jfrog/jfrog-client-go => github.com/RobiNino/jfrog-client-go v0.0.0-20240201080543-d101e97574cf

// replace github.com/jfrog/jfrog-cli-security => github.com/jfrog/jfrog-cli-security v0.0.0-20240122124933-edf9cb4ca3ac

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7
github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w=
github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78=
github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/RobiNino/jfrog-cli-core/v2 v2.0.0-20240201080739-11cd9aee47ce h1:mXhyXeCn1doQCGB9YM5kgQVIiwUakivaNqbAaIzUkBM=
github.com/RobiNino/jfrog-cli-core/v2 v2.0.0-20240201080739-11cd9aee47ce/go.mod h1:PoATGKONGFScfX2L6yGSAxgxQNA3N+Vc5YqLhCwhh38=
github.com/RobiNino/jfrog-client-go v0.0.0-20240201080543-d101e97574cf h1:ucZhlj1EN4Hfn/IQkiUaK1cosKuYF/V4XH0M1AkdkQI=
github.com/RobiNino/jfrog-client-go v0.0.0-20240201080543-d101e97574cf/go.mod h1:y1WF6eiZ7V2DortiwjpMEicEH6NIJH+hOXI5QI2W3NU=
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
Expand Down Expand Up @@ -140,12 +144,8 @@ github.com/jfrog/gofrog v1.5.1 h1:2AXL8hHu1jJFMIoCqTp2OyRUfEqEp4nC7J8fwn6KtwE=
github.com/jfrog/gofrog v1.5.1/go.mod h1:SZ1EPJUruxrVGndOzHd+LTiwWYKMlHqhKD+eu+v5Hqg=
github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYLipdsOFMY=
github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w=
github.com/jfrog/jfrog-cli-core/v2 v2.47.11 h1:2oHyITZjnjuuwU/LEVedlA3NkJz3PbaXdBT2Y1kt21o=
github.com/jfrog/jfrog-cli-core/v2 v2.47.11/go.mod h1:RVn4pIkR5fPUnr8gFXt61ou3pCNrrDdRQUpcolP4lhw=
github.com/jfrog/jfrog-cli-security v0.0.0-20240122124933-edf9cb4ca3ac h1:tNn3TQXaIJZ9Fu5jiVB9lWpJAKkEGWNjz/6WzHhHePI=
github.com/jfrog/jfrog-cli-security v0.0.0-20240122124933-edf9cb4ca3ac/go.mod h1:X4rz1639L8vWKJgpLxpO3ddkIW7KaCaQjbwani7FPf4=
github.com/jfrog/jfrog-client-go v1.36.0 h1:iODLDjYSlK7rLH8/lEmAFHwYsboeBfaqxXybz6waraE=
github.com/jfrog/jfrog-client-go v1.36.0/go.mod h1:y1WF6eiZ7V2DortiwjpMEicEH6NIJH+hOXI5QI2W3NU=
github.com/jszwec/csvutil v1.9.0 h1:iTmq9G1P0e+AUq/MkFg6tetJ+1BH3fOX8Xi0RAcwiGc=
github.com/jszwec/csvutil v1.9.0/go.mod h1:/E4ONrmGkwmWsk9ae9jpXnv9QT8pLHEPcCirMFhxG9I=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
Expand Down
32 changes: 24 additions & 8 deletions lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
clientUtils "github.com/jfrog/jfrog-client-go/utils"
"github.com/jfrog/jfrog-client-go/utils/distribution"
"github.com/jfrog/jfrog-client-go/utils/errorutils"
clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests"
"github.com/stretchr/testify/assert"
"net/http"
"os"
Expand All @@ -42,7 +43,8 @@ var (
)

func TestLifecycle(t *testing.T) {
initLifecycleTest(t)
cleanHomeDir := initLifecycleTest(t)
defer cleanHomeDir()
defer cleanLifecycleTests(t)
lcManager := getLcServiceManager(t)

Expand All @@ -54,7 +56,8 @@ func TestLifecycle(t *testing.T) {
createRb(t, buildsSpec12, cliutils.Builds, tests.LcRbName1, number1, true)
defer deleteReleaseBundle(t, lcManager, tests.LcRbName1, number1)

// Create release bundle from builds asynchronously and assert status.
// Create release bundle from a build asynchronously and assert status.
// This build has dependencies which are included in the release bundle.
createRb(t, buildsSpec3, cliutils.Builds, tests.LcRbName2, number2, false)
defer deleteReleaseBundle(t, lcManager, tests.LcRbName2, number2)
assertStatusCompleted(t, lcManager, tests.LcRbName2, number2, "")
Expand All @@ -81,9 +84,9 @@ func TestLifecycle(t *testing.T) {
}

func uploadBuilds(t *testing.T) func() {
uploadBuild(t, tests.UploadDevSpecA, tests.LcBuildName1, number1)
uploadBuild(t, tests.UploadDevSpecB, tests.LcBuildName2, number2)
uploadBuild(t, tests.UploadDevSpecC, tests.LcBuildName3, number3)
uploadBuild(t, tests.UploadDevSpecA, tests.LcBuildName1, number1, false)
uploadBuild(t, tests.UploadDevSpecB, tests.LcBuildName2, number2, false)
uploadBuild(t, tests.UploadDevSpecC, tests.LcBuildName3, number3, true)
return func() {
inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.LcBuildName1, artHttpDetails)
inttestutils.DeleteBuild(serverDetails.ArtifactoryUrl, tests.LcBuildName2, artHttpDetails)
Expand Down Expand Up @@ -211,14 +214,20 @@ func remoteDeleteReleaseBundle(t *testing.T, lcManager *lifecycle.LifecycleServi
time.Sleep(5 * time.Second)
}

func uploadBuild(t *testing.T, specFileName, buildName, buildNumber string) {
func uploadBuild(t *testing.T, specFileName, buildName, buildNumber string, uploadAsDependencies bool) {
specFile, err := tests.CreateSpec(specFileName)
assert.NoError(t, err)
runRt(t, "upload", "--spec="+specFile, "--build-name="+buildName, "--build-number="+buildNumber)

if uploadAsDependencies {
runRt(t, "upload", "--spec="+specFile)
assert.NoError(t, lcCli.WithoutCredentials().Exec("rt", "bad", buildName, buildNumber, tests.RtDevRepo+"/c*.in", "--from-rt"))
} else {
runRt(t, "upload", "--spec="+specFile, "--build-name="+buildName, "--build-number="+buildNumber)
}
runRt(t, "build-publish", buildName, buildNumber)
}

func initLifecycleTest(t *testing.T) {
func initLifecycleTest(t *testing.T) (cleanHomeDir func()) {
if !*tests.TestLifecycle {
t.Skip("Skipping lifecycle test. To run release bundle test add the '-test.lc=true' option.")
}
Expand All @@ -227,6 +236,13 @@ func initLifecycleTest(t *testing.T) {
if !isLifecycleSupported(t) {
t.Skip("Skipping lifecycle test because the functionality is not enabled on the provided JPD.")
}

// Populate cli config with 'default' server.
oldHomeDir, newHomeDir := prepareHomeDir(t)
return func() {
clientTestUtils.SetEnvAndAssert(t, coreutils.HomeDir, oldHomeDir)
clientTestUtils.RemoveAllAndAssert(t, newHomeDir)
}
}

func isLifecycleSupported(t *testing.T) (skip bool) {
Expand Down
3 changes: 2 additions & 1 deletion testdata/lifecycle/builds-spec-3.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"builds": [
{
"name": "${LC_BUILD_NAME3}",
"number": ""
"number": "",
"includeDependencies": true
}
]
}

0 comments on commit 52dc127

Please sign in to comment.