mirror of
https://github.com/harness/drone.git
synced 2025-05-21 11:29:52 +08:00
[feat]: [AH-147]: maven client setup api changes (#3312)
* [feat]: [AH-147]: maven client setup api * [feat]: [AH-147]: maven client setup api * [feat]: [AH-147]: API changes
This commit is contained in:
parent
c1b89607ce
commit
8342bf839a
@ -113,8 +113,9 @@ func (c *APIController) GenerateClientSetupDetails(
|
||||
loginUsernameValue := "<USERNAME>"
|
||||
loginPasswordLabel := "Password: *see step 2*"
|
||||
blankString := ""
|
||||
// Fixme: Use ENUMS
|
||||
if packageType == "HELM" {
|
||||
if packageType == string(artifact.PackageTypeMAVEN) {
|
||||
return c.generateMavenClientSetupDetail(ctx, image, tag, registryRef, username)
|
||||
} else if packageType == string(artifact.PackageTypeHELM) {
|
||||
header1 := "Login to Helm"
|
||||
section1step1Header := "Run this Helm command in your terminal to authenticate the client."
|
||||
helmLoginValue := "helm registry login <LOGIN_HOSTNAME>"
|
||||
@ -126,7 +127,7 @@ func (c *APIController) GenerateClientSetupDetails(
|
||||
section1step1Type := artifact.ClientSetupStepTypeStatic
|
||||
section1step2Header := "For the Password field above, generate an identity token"
|
||||
section1step2Type := artifact.ClientSetupStepTypeGenerateToken
|
||||
section1 := []artifact.ClientSetupStep{
|
||||
section1Steps := []artifact.ClientSetupStep{
|
||||
{
|
||||
Header: §ion1step1Header,
|
||||
Commands: §ion1step1Commands,
|
||||
@ -137,6 +138,12 @@ func (c *APIController) GenerateClientSetupDetails(
|
||||
Type: §ion1step2Type,
|
||||
},
|
||||
}
|
||||
section1 := artifact.ClientSetupSection{
|
||||
Header: &header1,
|
||||
}
|
||||
_ = section1.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: §ion1Steps,
|
||||
})
|
||||
|
||||
header2 := "Push a version"
|
||||
section2step1Header := "Run this Helm push command in your terminal to push a chart in OCI form." +
|
||||
@ -146,13 +153,19 @@ func (c *APIController) GenerateClientSetupDetails(
|
||||
{Label: &blankString, Value: &helmPushValue},
|
||||
}
|
||||
section2step1Type := artifact.ClientSetupStepTypeStatic
|
||||
section2 := []artifact.ClientSetupStep{
|
||||
section2Steps := []artifact.ClientSetupStep{
|
||||
{
|
||||
Header: §ion2step1Header,
|
||||
Commands: §ion2step1Commands,
|
||||
Type: §ion2step1Type,
|
||||
},
|
||||
}
|
||||
section2 := artifact.ClientSetupSection{
|
||||
Header: &header2,
|
||||
}
|
||||
_ = section2.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: §ion2Steps,
|
||||
})
|
||||
|
||||
header3 := "Pull a version"
|
||||
section3step1Header := "Run this Helm command in your terminal to pull a specific chart version."
|
||||
@ -161,33 +174,30 @@ func (c *APIController) GenerateClientSetupDetails(
|
||||
{Label: &blankString, Value: &helmPullValue},
|
||||
}
|
||||
section3step1Type := artifact.ClientSetupStepTypeStatic
|
||||
section3 := []artifact.ClientSetupStep{
|
||||
section3Steps := []artifact.ClientSetupStep{
|
||||
{
|
||||
Header: §ion3step1Header,
|
||||
Commands: §ion3step1Commands,
|
||||
Type: §ion3step1Type,
|
||||
},
|
||||
}
|
||||
section3 := artifact.ClientSetupSection{
|
||||
Header: &header3,
|
||||
}
|
||||
_ = section3.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: §ion3Steps,
|
||||
})
|
||||
clientSetupDetails := artifact.ClientSetupDetails{
|
||||
MainHeader: "Helm Client Setup",
|
||||
SecHeader: "Follow these instructions to install/use Helm artifacts or compatible packages.",
|
||||
Sections: []artifact.ClientSetupSection{
|
||||
{
|
||||
Header: &header1,
|
||||
Steps: §ion1,
|
||||
},
|
||||
{
|
||||
Header: &header2,
|
||||
Steps: §ion2,
|
||||
},
|
||||
{
|
||||
Header: &header3,
|
||||
Steps: §ion3,
|
||||
},
|
||||
section1,
|
||||
section2,
|
||||
section3,
|
||||
},
|
||||
}
|
||||
|
||||
c.replacePlaceholders(ctx, clientSetupDetails, username, registryRef, image, tag)
|
||||
c.replacePlaceholders(ctx, &clientSetupDetails.Sections, username, registryRef, image, tag, "", "")
|
||||
|
||||
return &artifact.ClientSetupDetailsResponseJSONResponse{
|
||||
Data: clientSetupDetails,
|
||||
@ -205,7 +215,7 @@ func (c *APIController) GenerateClientSetupDetails(
|
||||
section1step1Type := artifact.ClientSetupStepTypeStatic
|
||||
section1step2Header := "For the Password field above, generate an identity token"
|
||||
section1step2Type := artifact.ClientSetupStepTypeGenerateToken
|
||||
section1 := []artifact.ClientSetupStep{
|
||||
section1Steps := []artifact.ClientSetupStep{
|
||||
{
|
||||
Header: §ion1step1Header,
|
||||
Commands: §ion1step1Commands,
|
||||
@ -216,6 +226,12 @@ func (c *APIController) GenerateClientSetupDetails(
|
||||
Type: §ion1step2Type,
|
||||
},
|
||||
}
|
||||
section1 := artifact.ClientSetupSection{
|
||||
Header: &header1,
|
||||
}
|
||||
_ = section1.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: §ion1Steps,
|
||||
})
|
||||
header2 := "Pull an image"
|
||||
section2step1Header := "Run this Docker command in your terminal to pull image."
|
||||
dockerPullValue := "docker pull <HOSTNAME>/<REGISTRY_NAME>/<IMAGE_NAME>:<TAG>"
|
||||
@ -223,13 +239,19 @@ func (c *APIController) GenerateClientSetupDetails(
|
||||
{Label: &blankString, Value: &dockerPullValue},
|
||||
}
|
||||
section2step1Type := artifact.ClientSetupStepTypeStatic
|
||||
section2 := []artifact.ClientSetupStep{
|
||||
section2Steps := []artifact.ClientSetupStep{
|
||||
{
|
||||
Header: §ion2step1Header,
|
||||
Commands: §ion2step1Commands,
|
||||
Type: §ion2step1Type,
|
||||
},
|
||||
}
|
||||
section2 := artifact.ClientSetupSection{
|
||||
Header: &header2,
|
||||
}
|
||||
_ = section2.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: §ion2Steps,
|
||||
})
|
||||
header3 := "Retag and Push the image"
|
||||
section3step1Header := "Run this Docker command in your terminal to tag the image."
|
||||
dockerTagValue := "docker tag <IMAGE_NAME>:<TAG> <HOSTNAME>/<REGISTRY_NAME>/<IMAGE_NAME>:<TAG>"
|
||||
@ -243,7 +265,7 @@ func (c *APIController) GenerateClientSetupDetails(
|
||||
{Label: &blankString, Value: &dockerPushValue},
|
||||
}
|
||||
section3step2Type := artifact.ClientSetupStepTypeStatic
|
||||
section3 := []artifact.ClientSetupStep{
|
||||
section3Steps := []artifact.ClientSetupStep{
|
||||
{
|
||||
Header: §ion3step1Header,
|
||||
Commands: §ion3step1Commands,
|
||||
@ -255,26 +277,344 @@ func (c *APIController) GenerateClientSetupDetails(
|
||||
Type: §ion3step2Type,
|
||||
},
|
||||
}
|
||||
section3 := artifact.ClientSetupSection{
|
||||
Header: &header3,
|
||||
}
|
||||
_ = section3.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: §ion3Steps,
|
||||
})
|
||||
clientSetupDetails := artifact.ClientSetupDetails{
|
||||
MainHeader: "Docker Client Setup",
|
||||
SecHeader: "Follow these instructions to install/use Docker artifacts or compatible packages.",
|
||||
Sections: []artifact.ClientSetupSection{
|
||||
{
|
||||
Header: &header1,
|
||||
Steps: §ion1,
|
||||
},
|
||||
{
|
||||
Header: &header3,
|
||||
Steps: §ion3,
|
||||
},
|
||||
{
|
||||
Header: &header2,
|
||||
Steps: §ion2,
|
||||
},
|
||||
section1,
|
||||
section2,
|
||||
section3,
|
||||
},
|
||||
}
|
||||
|
||||
c.replacePlaceholders(ctx, clientSetupDetails, username, registryRef, image, tag)
|
||||
c.replacePlaceholders(ctx, &clientSetupDetails.Sections, username, registryRef, image, tag, "", "")
|
||||
|
||||
return &artifact.ClientSetupDetailsResponseJSONResponse{
|
||||
Data: clientSetupDetails,
|
||||
Status: artifact.StatusSUCCESS,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *APIController) generateMavenClientSetupDetail(
|
||||
ctx context.Context,
|
||||
artifactName *artifact.ArtifactParam,
|
||||
version *artifact.VersionParam,
|
||||
registryRef string,
|
||||
username string,
|
||||
) *artifact.ClientSetupDetailsResponseJSONResponse {
|
||||
staticStepType := artifact.ClientSetupStepTypeStatic
|
||||
generateTokenStepType := artifact.ClientSetupStepTypeGenerateToken
|
||||
|
||||
section1 := artifact.ClientSetupSection{
|
||||
Header: stringPtr("1. Generate Identity Token"),
|
||||
SecHeader: stringPtr("An identity token will serve as the password for uploading and downloading artifacts."),
|
||||
}
|
||||
_ = section1.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: &[]artifact.ClientSetupStep{
|
||||
{
|
||||
Header: stringPtr("Generate an identity token"),
|
||||
Type: &generateTokenStepType,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
mavenSection1 := artifact.ClientSetupSection{
|
||||
Header: stringPtr("2. Pull a Maven Package"),
|
||||
SecHeader: stringPtr("Set default repository in your pom.xml file."),
|
||||
}
|
||||
_ = mavenSection1.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: &[]artifact.ClientSetupStep{
|
||||
{
|
||||
Header: stringPtr("To set default registry in your pom.xml file by adding the following:"),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
//nolint:lll
|
||||
Value: stringPtr("<repositories>\n <repository>\n <id>maven-dev</id>\n <url><REGISTRY_URL>/<REGISTRY_NAME></url>\n <releases>\n <enabled>true</enabled>\n <updatePolicy>always</updatePolicy>\n </releases>\n <snapshots>\n <enabled>true</enabled>\n <updatePolicy>always</updatePolicy>\n </snapshots>\n </repository>\n</repositories>"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
//nolint:lll
|
||||
Header: stringPtr("Copy the following your ~/ .m2/setting.xml file for MacOs, or $USERPROFILE$\\ .m2\\settings.xml for Windows to authenticate with token to pull from your Maven registry."),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
//nolint:lll
|
||||
Value: stringPtr("<settings>\n <servers>\n <server>\n <id>maven-dev</id>\n <username><USERNAME></username>\n <password>identity-token</password>\n </server>\n </servers>\n</settings>"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
//nolint:lll
|
||||
Header: stringPtr("Add a dependency to the project's pom.xml (replace <GROUP_ID>, <ARTIFACT_ID> & <VERSION> with your own):"),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
//nolint:lll
|
||||
Value: stringPtr("<dependency>\n <groupId><GROUP_ID></groupId>\n <artifactId><ARTIFACT_ID></artifactId>\n <version><VERSION></version>\n</dependency>"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: stringPtr("Install dependencies in pom.xml file"),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
Value: stringPtr("mvn install"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
mavenSection2 := artifact.ClientSetupSection{
|
||||
Header: stringPtr("3. Push a Maven Package"),
|
||||
SecHeader: stringPtr("Set default repository in your pom.xml file."),
|
||||
}
|
||||
|
||||
_ = mavenSection2.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: &[]artifact.ClientSetupStep{
|
||||
{
|
||||
Header: stringPtr("To set default registry in your pom.xml file by adding the following:"),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
//nolint:lll
|
||||
Value: stringPtr("<distributionManagement>\n <snapshotRepository>\n <id>maven-dev</id>\n <url><REGISTRY_URL>/<REGISTRY_NAME></url>\n </snapshotRepository>\n <repository>\n <id>maven-dev</id>\n <url><REGISTRY_URL>/<REGISTRY_NAME></url>\n </repository>\n</distributionManagement>"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
//nolint:lll
|
||||
Header: stringPtr("Copy the following your ~/ .m2/setting.xml file for MacOs, or $USERPROFILE$\\ .m2\\settings.xml for Windows to authenticate with token to push to your Maven registry."),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
//nolint:lll
|
||||
Value: stringPtr("<settings>\n <servers>\n <server>\n <id>maven-dev</id>\n <username><USERNAME></username>\n <password>identity-token</password>\n </server>\n </servers>\n</settings>"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: stringPtr("Publish package to your Maven registry."),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
Value: stringPtr("mvn deploy"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
gradleSection1 := artifact.ClientSetupSection{
|
||||
Header: stringPtr("2. Pull a Gradle Package"),
|
||||
SecHeader: stringPtr("Set default repository in your build.gradle file."),
|
||||
}
|
||||
_ = gradleSection1.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: &[]artifact.ClientSetupStep{
|
||||
{
|
||||
Header: stringPtr("Set the default registry in your project’s build.gradle by adding the following:"),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
//nolint:lll
|
||||
Value: stringPtr("repositories{\n maven{\n url “<REGISTRY_URL>/<REGISTRY_NAME>”\n\n credentials {\n username “<USERNAME>”\n password “identity-token”\n }\n }\n}"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
//nolint:lll
|
||||
Header: stringPtr("As this is a private registry, you’ll need to authenticate. Create or add to the ~/.gradle/gradle.properties file with the following:"),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
Value: stringPtr("repositoryUser=<USERNAME>\nrepositoryPassword={{identity-token}}"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: stringPtr("Add a dependency to the project’s build.gradle"),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
Value: stringPtr("dependencies {\n implementation ‘<GROUP_ID>:<ARTIFACT_ID>:<VERSION>’\n}"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: stringPtr("Install dependencies in build.gradle file"),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
Value: stringPtr("gradlew build // Linux or OSX\n gradlew.bat build // Windows"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
gradleSection2 := artifact.ClientSetupSection{
|
||||
Header: stringPtr("3. Push a Gradle Package"),
|
||||
SecHeader: stringPtr("Set default repository in your build.gradle file."),
|
||||
}
|
||||
|
||||
_ = gradleSection2.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: &[]artifact.ClientSetupStep{
|
||||
{
|
||||
Header: stringPtr("Add a maven publish plugin configuration to the project’s build.gradle."),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
//nolint:lll
|
||||
Value: stringPtr("publishing {\n publications {\n maven(MavenPublication) {\n groupId = '<GROUP_ID>'\n artifactId = '<ARTIFACT_ID>'\n version = '<VERSION>'\n\n from components.java\n }\n }\n}"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: stringPtr("Publish package to your Maven registry."),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
Value: stringPtr("gradlew publish"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
sbtSection1 := artifact.ClientSetupSection{
|
||||
Header: stringPtr("2. Pull a Sbt/Scala Package"),
|
||||
SecHeader: stringPtr("Set default repository in your build.sbt file."),
|
||||
}
|
||||
_ = sbtSection1.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: &[]artifact.ClientSetupStep{
|
||||
{
|
||||
Header: stringPtr("Set the default registry in your project’s build.sbt by adding the following:"),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
//nolint:lll
|
||||
Value: stringPtr("resolver += “Harness Registry” at “<REGISTRY_URL>/<REGISTRY_NAME>”\ncredentials += Credentials(Path.userHome / “.sbt” / “.Credentials”)"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
//nolint:lll
|
||||
Header: stringPtr("As this is a private registry, you’ll need to authenticate. Create or add to the ~/.sbt/.credentials file with the following:"),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
//nolint:lll
|
||||
Value: stringPtr("realm=Harness Registry\nhost=<LOGIN_HOSTNAME>\nuser=<USERNAME>\npassword={{identity-token}}"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: stringPtr("Add a dependency to the project’s build.sbt"),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
Value: stringPtr("libraryDependencies += “<GROUP_ID>” % “<ARTIFACT_ID>” % “<VERSION>”"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: stringPtr("Install dependencies in build.sbt file"),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
Value: stringPtr("sbt update"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
sbtSection2 := artifact.ClientSetupSection{
|
||||
Header: stringPtr("3. Push a Sbt/Scala Package"),
|
||||
SecHeader: stringPtr("Set default repository in your build.sbt file."),
|
||||
}
|
||||
|
||||
_ = sbtSection2.FromClientSetupStepConfig(artifact.ClientSetupStepConfig{
|
||||
Steps: &[]artifact.ClientSetupStep{
|
||||
{
|
||||
Header: stringPtr("Add publish configuration to the project’s build.sbt."),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
Value: stringPtr("publishTo := Some(\"Harness Registry\" at \"<REGISTRY_URL>/<REGISTRY_NAME>\")"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: stringPtr("Publish package to your Maven registry."),
|
||||
Type: &staticStepType,
|
||||
Commands: &[]artifact.ClientSetupStepCommand{
|
||||
{
|
||||
Value: stringPtr("sbt publish"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
section2 := artifact.ClientSetupSection{}
|
||||
_ = section2.FromTabSetupStepConfig(artifact.TabSetupStepConfig{
|
||||
Tabs: &[]artifact.TabSetupStep{
|
||||
{
|
||||
Header: stringPtr("Maven"),
|
||||
Sections: &[]artifact.ClientSetupSection{
|
||||
mavenSection1,
|
||||
mavenSection2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: stringPtr("Gradle"),
|
||||
Sections: &[]artifact.ClientSetupSection{
|
||||
gradleSection1,
|
||||
gradleSection2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: stringPtr("Sbt/Scala"),
|
||||
Sections: &[]artifact.ClientSetupSection{
|
||||
sbtSection1,
|
||||
sbtSection2,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
clientSetupDetails := artifact.ClientSetupDetails{
|
||||
MainHeader: "Maven Client Setup",
|
||||
SecHeader: "Follow these instructions to install/use Maven artifacts or compatible packages.",
|
||||
Sections: []artifact.ClientSetupSection{
|
||||
section1,
|
||||
section2,
|
||||
},
|
||||
}
|
||||
groupID := ""
|
||||
if artifactName != nil {
|
||||
parts := strings.Split(string(*artifactName), ":")
|
||||
if len(parts) == 2 {
|
||||
groupID = parts[0]
|
||||
*artifactName = artifact.ArtifactParam(parts[1])
|
||||
}
|
||||
}
|
||||
|
||||
rootSpace, _, _ := paths.DisectRoot(registryRef)
|
||||
registryURL := c.URLProvider.RegistryURL(ctx, "maven", rootSpace)
|
||||
|
||||
//nolint:lll
|
||||
c.replacePlaceholders(ctx, &clientSetupDetails.Sections, username, registryRef, artifactName, version, registryURL, groupID)
|
||||
|
||||
return &artifact.ClientSetupDetailsResponseJSONResponse{
|
||||
Data: clientSetupDetails,
|
||||
@ -284,29 +624,54 @@ func (c *APIController) GenerateClientSetupDetails(
|
||||
|
||||
func (c *APIController) replacePlaceholders(
|
||||
ctx context.Context,
|
||||
clientSetupDetails artifact.ClientSetupDetails,
|
||||
clientSetupSections *[]artifact.ClientSetupSection,
|
||||
username string,
|
||||
regRef string,
|
||||
image *artifact.ArtifactParam,
|
||||
tag *artifact.VersionParam,
|
||||
registryURL string,
|
||||
groupID string,
|
||||
) {
|
||||
for i := range *clientSetupSections {
|
||||
tab, err := (*clientSetupSections)[i].AsTabSetupStepConfig()
|
||||
if err != nil || tab.Tabs == nil {
|
||||
c.replacePlaceholdersInSection(ctx, &(*clientSetupSections)[i], username, regRef, image, tag, groupID, registryURL)
|
||||
} else {
|
||||
for j := range *tab.Tabs {
|
||||
c.replacePlaceholders(ctx, (*tab.Tabs)[j].Sections, username, regRef, image, tag, groupID, registryURL)
|
||||
}
|
||||
_ = (*clientSetupSections)[i].FromTabSetupStepConfig(tab)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (c *APIController) replacePlaceholdersInSection(
|
||||
ctx context.Context,
|
||||
clientSetupSection *artifact.ClientSetupSection,
|
||||
username string,
|
||||
regRef string,
|
||||
image *artifact.ArtifactParam,
|
||||
tag *artifact.VersionParam,
|
||||
registryURL string,
|
||||
groupID string,
|
||||
) {
|
||||
rootSpace, _, _ := paths.DisectRoot(regRef)
|
||||
_, registryName, _ := paths.DisectLeaf(regRef)
|
||||
hostname := common.TrimURLScheme(c.URLProvider.RegistryURL(ctx, rootSpace))
|
||||
|
||||
for _, s := range clientSetupDetails.Sections {
|
||||
if s.Steps == nil {
|
||||
sec, err := clientSetupSection.AsClientSetupStepConfig()
|
||||
if err != nil || sec.Steps == nil {
|
||||
return
|
||||
}
|
||||
for _, st := range *sec.Steps {
|
||||
if st.Commands == nil {
|
||||
continue
|
||||
}
|
||||
for _, st := range *s.Steps {
|
||||
if st.Commands == nil {
|
||||
continue
|
||||
}
|
||||
for i := range *st.Commands {
|
||||
replaceText(username, st, i, hostname, registryName, image, tag)
|
||||
}
|
||||
for j := range *st.Commands {
|
||||
replaceText(username, st, j, hostname, registryName, image, tag, registryURL, groupID)
|
||||
}
|
||||
}
|
||||
_ = clientSetupSection.FromClientSetupStepConfig(sec)
|
||||
}
|
||||
|
||||
func replaceText(
|
||||
@ -317,10 +682,20 @@ func replaceText(
|
||||
repoName string,
|
||||
image *artifact.ArtifactParam,
|
||||
tag *artifact.VersionParam,
|
||||
registryURL string,
|
||||
groupID string,
|
||||
) {
|
||||
if username != "" {
|
||||
(*st.Commands)[i].Value = stringPtr(strings.ReplaceAll(*(*st.Commands)[i].Value, "<USERNAME>", username))
|
||||
(*st.Commands)[i].Label = stringPtr(strings.ReplaceAll(*(*st.Commands)[i].Label, "<USERNAME>", username))
|
||||
if (*st.Commands)[i].Label != nil {
|
||||
(*st.Commands)[i].Label = stringPtr(strings.ReplaceAll(*(*st.Commands)[i].Label, "<USERNAME>", username))
|
||||
}
|
||||
}
|
||||
if groupID != "" {
|
||||
(*st.Commands)[i].Value = stringPtr(strings.ReplaceAll(*(*st.Commands)[i].Value, "<GROUP_ID>", groupID))
|
||||
}
|
||||
if registryURL != "" {
|
||||
(*st.Commands)[i].Value = stringPtr(strings.ReplaceAll(*(*st.Commands)[i].Value, "<REGISTRY_URL>", registryURL))
|
||||
}
|
||||
if hostname != "" {
|
||||
(*st.Commands)[i].Value = stringPtr(strings.ReplaceAll(*(*st.Commands)[i].Value, "<HOSTNAME>", hostname))
|
||||
@ -334,9 +709,11 @@ func replaceText(
|
||||
}
|
||||
if image != nil {
|
||||
(*st.Commands)[i].Value = stringPtr(strings.ReplaceAll(*(*st.Commands)[i].Value, "<IMAGE_NAME>", string(*image)))
|
||||
(*st.Commands)[i].Value = stringPtr(strings.ReplaceAll(*(*st.Commands)[i].Value, "<ARTIFACT_ID>", string(*image)))
|
||||
}
|
||||
if tag != nil {
|
||||
(*st.Commands)[i].Value = stringPtr(strings.ReplaceAll(*(*st.Commands)[i].Value, "<TAG>", string(*tag)))
|
||||
(*st.Commands)[i].Value = stringPtr(strings.ReplaceAll(*(*st.Commands)[i].Value, "<VERSION>", string(*tag)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,7 @@ var validUpstreamSources = []string{
|
||||
string(a.UpstreamConfigSourceCustom),
|
||||
string(a.UpstreamConfigSourceDockerhub),
|
||||
string(a.UpstreamConfigSourceAwsEcr),
|
||||
string(a.UpstreamConfigSourceMavenCentral),
|
||||
}
|
||||
|
||||
func ValidatePackageTypes(packageTypes []string) error {
|
||||
@ -163,7 +164,8 @@ func ValidateUpstream(config *a.RegistryConfig) error {
|
||||
return err
|
||||
}
|
||||
if !commons.IsEmpty(config.Type) && config.Type == a.RegistryTypeUPSTREAM &&
|
||||
*upstreamConfig.Source != a.UpstreamConfigSourceDockerhub {
|
||||
*upstreamConfig.Source != a.UpstreamConfigSourceDockerhub &&
|
||||
*upstreamConfig.Source != a.UpstreamConfigSourceMavenCentral {
|
||||
if commons.IsEmpty(upstreamConfig.Url) {
|
||||
return errors.New("URL is required for upstream repository")
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ func CheckMavenAuth() func(http.Handler) http.Handler {
|
||||
}
|
||||
|
||||
func setMavenHeaders(w http.ResponseWriter) {
|
||||
w.Header().Set("WWW-Authenticate", "Basic realm=\"Maven API\"")
|
||||
w.Header().Set("WWW-Authenticate", "Basic realm=\"Harness Registry\"")
|
||||
}
|
||||
|
||||
func getRefsFromName(name string) (spaceRef, repoRef string) {
|
||||
|
@ -1535,10 +1535,46 @@ components:
|
||||
properties:
|
||||
header:
|
||||
type: string
|
||||
secHeader:
|
||||
type: string
|
||||
type:
|
||||
$ref: "#/components/schemas/SectionType"
|
||||
discriminator:
|
||||
propertyName: type
|
||||
mapping:
|
||||
INLINE: "#/components/schemas/ClientSetupStepConfig"
|
||||
TABS: "#/components/schemas/TabSetupStepConfig"
|
||||
oneOf:
|
||||
- $ref: "#/components/schemas/ClientSetupStepConfig"
|
||||
- $ref: "#/components/schemas/TabSetupStepConfig"
|
||||
required:
|
||||
- type
|
||||
TabSetupStepConfig:
|
||||
type: object
|
||||
description: Tab Setup step config
|
||||
properties:
|
||||
tabs:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/TabSetupStep"
|
||||
ClientSetupStepConfig:
|
||||
type: object
|
||||
description: Client Setup Step
|
||||
properties:
|
||||
steps:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/ClientSetupStep"
|
||||
TabSetupStep:
|
||||
type: object
|
||||
description: Tab Setup step
|
||||
properties:
|
||||
header:
|
||||
type: string
|
||||
sections:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/ClientSetupSection"
|
||||
ClientSetupStep:
|
||||
type: object
|
||||
description: Client Setup Step
|
||||
@ -2153,6 +2189,14 @@ components:
|
||||
- MAVEN
|
||||
- GENERIC
|
||||
- HELM
|
||||
SectionType:
|
||||
type: string
|
||||
description: refers to client setup section type
|
||||
enum:
|
||||
- INLINE
|
||||
- TABS
|
||||
discriminator:
|
||||
propertyName: type
|
||||
Status:
|
||||
type: string
|
||||
description: "Indicates if the request was successful or not"
|
||||
|
@ -5723,94 +5723,96 @@ func (sh *strictHandler) GetAllRegistries(w http.ResponseWriter, r *http.Request
|
||||
// Base64 encoded, gzipped, json marshaled Swagger object
|
||||
var swaggerSpec = []string{
|
||||
|
||||
"H4sIAAAAAAAC/+xdX3PbOJL/KizePTKWZzd3D35TZHmiGjvxyXa2pqZcLpiEJG4okgOAdrQpffcr/CNB",
|
||||
"EiBB/XfMpzhiA2g0ft1oAI3GT9dPlmkSw5hg9+KnmwIElpBAxP53DZ5hhG/pb/S/AcQ+ClMSJrF7wT+e",
|
||||
"uZ4b0v/9nUG0cj03BkvoXrgR/eh6LvYXcAlo4ZDAJauUrFJKgQkK47m79uQPACGwctdrz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T3koGFYskNr57rfN3wIfBqDT",
|
||||
"2uuW7+bwvr10+ZVPq0Hmz7dtI8KqQ0cvwV3vkjtILyqu2+zEt7ifM8lv+fWj/QtwHXL2Qt+p0q8v7gj6",
|
||||
"GcLhy9ay26f47Si7JaGpCy97uII2wMWoumXJvUb4Ew4DkIaDl9/Y/Im2ag9q307465PsjslzMnbK5jkR",
|
||||
"JQapxIhXJBQCKZD0rc0hEU0ARReJFgr11NiAfILfSWYOj0vUNVaL/bJucwGjpa7Fiuu1uT0ty16L+1zR",
|
||||
"Xm7jrx/X/x8AAP//M3nlRXDiAAA=",
|
||||
}
|
||||
|
||||
// GetSwagger returns the content of the embedded swagger specification file
|
||||
|
@ -38,6 +38,12 @@ const (
|
||||
RegistryTypeVIRTUAL RegistryType = "VIRTUAL"
|
||||
)
|
||||
|
||||
// Defines values for SectionType.
|
||||
const (
|
||||
SectionTypeINLINE SectionType = "INLINE"
|
||||
SectionTypeTABS SectionType = "TABS"
|
||||
)
|
||||
|
||||
// Defines values for Status.
|
||||
const (
|
||||
StatusERROR Status = "ERROR"
|
||||
@ -195,8 +201,12 @@ type ClientSetupDetails struct {
|
||||
|
||||
// ClientSetupSection Client Setup Section
|
||||
type ClientSetupSection struct {
|
||||
Header *string `json:"header,omitempty"`
|
||||
Steps *[]ClientSetupStep `json:"steps,omitempty"`
|
||||
Header *string `json:"header,omitempty"`
|
||||
SecHeader *string `json:"secHeader,omitempty"`
|
||||
|
||||
// Type refers to client setup section type
|
||||
Type SectionType `json:"type"`
|
||||
union json.RawMessage
|
||||
}
|
||||
|
||||
// ClientSetupStep Client Setup Step
|
||||
@ -214,6 +224,11 @@ type ClientSetupStepCommand struct {
|
||||
Value *string `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// ClientSetupStepConfig Client Setup Step
|
||||
type ClientSetupStepConfig struct {
|
||||
Steps *[]ClientSetupStep `json:"steps,omitempty"`
|
||||
}
|
||||
|
||||
// ClientSetupStepType ClientSetupStepType type
|
||||
type ClientSetupStepType string
|
||||
|
||||
@ -545,9 +560,23 @@ type RegistryRequest struct {
|
||||
// RegistryType refers to type of registry i.e virtual or upstream
|
||||
type RegistryType string
|
||||
|
||||
// SectionType refers to client setup section type
|
||||
type SectionType string
|
||||
|
||||
// Status Indicates if the request was successful or not
|
||||
type Status string
|
||||
|
||||
// TabSetupStep Tab Setup step
|
||||
type TabSetupStep struct {
|
||||
Header *string `json:"header,omitempty"`
|
||||
Sections *[]ClientSetupSection `json:"sections,omitempty"`
|
||||
}
|
||||
|
||||
// TabSetupStepConfig Tab Setup step config
|
||||
type TabSetupStepConfig struct {
|
||||
Tabs *[]TabSetupStep `json:"tabs,omitempty"`
|
||||
}
|
||||
|
||||
// Trigger refers to trigger
|
||||
type Trigger string
|
||||
|
||||
@ -1475,6 +1504,160 @@ func (t *ArtifactDetail) UnmarshalJSON(b []byte) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// AsClientSetupStepConfig returns the union data inside the ClientSetupSection as a ClientSetupStepConfig
|
||||
func (t ClientSetupSection) AsClientSetupStepConfig() (ClientSetupStepConfig, error) {
|
||||
var body ClientSetupStepConfig
|
||||
err := json.Unmarshal(t.union, &body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
// FromClientSetupStepConfig overwrites any union data inside the ClientSetupSection as the provided ClientSetupStepConfig
|
||||
func (t *ClientSetupSection) FromClientSetupStepConfig(v ClientSetupStepConfig) error {
|
||||
t.Type = "INLINE"
|
||||
|
||||
b, err := json.Marshal(v)
|
||||
t.union = b
|
||||
return err
|
||||
}
|
||||
|
||||
// MergeClientSetupStepConfig performs a merge with any union data inside the ClientSetupSection, using the provided ClientSetupStepConfig
|
||||
func (t *ClientSetupSection) MergeClientSetupStepConfig(v ClientSetupStepConfig) error {
|
||||
t.Type = "INLINE"
|
||||
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
merged, err := runtime.JSONMerge(t.union, b)
|
||||
t.union = merged
|
||||
return err
|
||||
}
|
||||
|
||||
// AsTabSetupStepConfig returns the union data inside the ClientSetupSection as a TabSetupStepConfig
|
||||
func (t ClientSetupSection) AsTabSetupStepConfig() (TabSetupStepConfig, error) {
|
||||
var body TabSetupStepConfig
|
||||
err := json.Unmarshal(t.union, &body)
|
||||
return body, err
|
||||
}
|
||||
|
||||
// FromTabSetupStepConfig overwrites any union data inside the ClientSetupSection as the provided TabSetupStepConfig
|
||||
func (t *ClientSetupSection) FromTabSetupStepConfig(v TabSetupStepConfig) error {
|
||||
t.Type = "TABS"
|
||||
|
||||
b, err := json.Marshal(v)
|
||||
t.union = b
|
||||
return err
|
||||
}
|
||||
|
||||
// MergeTabSetupStepConfig performs a merge with any union data inside the ClientSetupSection, using the provided TabSetupStepConfig
|
||||
func (t *ClientSetupSection) MergeTabSetupStepConfig(v TabSetupStepConfig) error {
|
||||
t.Type = "TABS"
|
||||
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
merged, err := runtime.JSONMerge(t.union, b)
|
||||
t.union = merged
|
||||
return err
|
||||
}
|
||||
|
||||
func (t ClientSetupSection) Discriminator() (string, error) {
|
||||
var discriminator struct {
|
||||
Discriminator string `json:"type"`
|
||||
}
|
||||
err := json.Unmarshal(t.union, &discriminator)
|
||||
return discriminator.Discriminator, err
|
||||
}
|
||||
|
||||
func (t ClientSetupSection) ValueByDiscriminator() (interface{}, error) {
|
||||
discriminator, err := t.Discriminator()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch discriminator {
|
||||
case "INLINE":
|
||||
return t.AsClientSetupStepConfig()
|
||||
case "TABS":
|
||||
return t.AsTabSetupStepConfig()
|
||||
default:
|
||||
return nil, errors.New("unknown discriminator value: " + discriminator)
|
||||
}
|
||||
}
|
||||
|
||||
func (t ClientSetupSection) MarshalJSON() ([]byte, error) {
|
||||
b, err := t.union.MarshalJSON()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
object := make(map[string]json.RawMessage)
|
||||
if t.union != nil {
|
||||
err = json.Unmarshal(b, &object)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if t.Header != nil {
|
||||
object["header"], err = json.Marshal(t.Header)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error marshaling 'header': %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if t.SecHeader != nil {
|
||||
object["secHeader"], err = json.Marshal(t.SecHeader)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error marshaling 'secHeader': %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
object["type"], err = json.Marshal(t.Type)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error marshaling 'type': %w", err)
|
||||
}
|
||||
|
||||
b, err = json.Marshal(object)
|
||||
return b, err
|
||||
}
|
||||
|
||||
func (t *ClientSetupSection) UnmarshalJSON(b []byte) error {
|
||||
err := t.union.UnmarshalJSON(b)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
object := make(map[string]json.RawMessage)
|
||||
err = json.Unmarshal(b, &object)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if raw, found := object["header"]; found {
|
||||
err = json.Unmarshal(raw, &t.Header)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading 'header': %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if raw, found := object["secHeader"]; found {
|
||||
err = json.Unmarshal(raw, &t.SecHeader)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading 'secHeader': %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if raw, found := object["type"]; found {
|
||||
err = json.Unmarshal(raw, &t.Type)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error reading 'type': %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// AsVirtualConfig returns the union data inside the RegistryConfig as a VirtualConfig
|
||||
func (t RegistryConfig) AsVirtualConfig() (VirtualConfig, error) {
|
||||
var body VirtualConfig
|
||||
|
@ -157,7 +157,9 @@ func (r *LocalRegistry) PutArtifact(ctx context.Context, info pkg.MavenArtifactI
|
||||
|
||||
func processError(err error) (
|
||||
responseHeaders *commons.ResponseHeaders, body *storage.FileReader, readCloser io.ReadCloser, errs []error) {
|
||||
if strings.Contains(err.Error(), sql.ErrNoRows.Error()) || strings.Contains(err.Error(), "resource not found") {
|
||||
if strings.Contains(err.Error(), sql.ErrNoRows.Error()) ||
|
||||
strings.Contains(err.Error(), "resource not found") ||
|
||||
strings.Contains(err.Error(), "http status code: 404") {
|
||||
return responseHeaders, nil, nil, []error{commons.NotFoundError(err.Error(), err)}
|
||||
}
|
||||
return responseHeaders, nil, nil, []error{errcode.ErrCodeUnknown.WithDetail(err)}
|
||||
|
@ -80,14 +80,13 @@ func (r *RemoteRegistry) FetchArtifact(ctx context.Context, info pkg.MavenArtifa
|
||||
|
||||
upstreamProxy, err := r.DBStore.UpstreamProxyDao.GetByRegistryIdentifier(ctx, info.ParentID, info.RegIdentifier)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
return processError(err)
|
||||
}
|
||||
|
||||
// This is start of proxy Code.
|
||||
responseHeaders, readCloser, err = r.proxyController.ProxyFile(ctx, info, *upstreamProxy, serveFile)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
return responseHeaders, nil, readCloser, errs
|
||||
return processError(err)
|
||||
}
|
||||
return responseHeaders, nil, readCloser, errs
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user