forked from SAP/jenkins-library
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added logic of fetching golang private packages for whitesource step (S…
…AP#4595) * added logic of fetching golang private packages for whitesource step and detectExecuteScan step * changed logic of checking by config.PrivateModulesGitToken * moved func prepareGolangPrivatePackages to golangBuild.go * fix (gitOpsUpdateDeployment) add CA bundle options to plain clone and commit to trust enterprise github instances (SAP#4602) * downloading ca cert bundle when added as config * adding logging statements * allowing bats test to handle ca cert * adding info message * hard coding file names * including correct http client util bundle * removing logging message not needed * adding cert bundle to commit and push * improving the condition to add ca cert in commit and push * fixing unit test * fixing unit test * fixing unit test * fixing unit test * fixing unit test * feat(kanikoExecute): add dockerfilePath param to multipleImages (SAP#4569) * add containerDockerfilePath param to multipleImages * rename ContainerDockerfilePath param to DockerfilePath * Fix trailing spaces --------- Co-authored-by: Egor Balakin <[email protected]> Co-authored-by: Vyacheslav Starostin <[email protected]> * fix(helm): forward sourceRepositoryCredentialsId from groovy to go layer (SAP#4604) forward sourceRepositoryCredentialsId from groovy to go layer in the same way how this is done for the targetRepositoryCredentialsId * feat(config): exporting generateConfig function and applying minor changes (SAP#4605) * exporting generateConfig function and applying minor changes * Added setConfigOptions to set configOptions variable. Added possibility to set format output, json or yaml for now. * Correcting mistake on cmd/getDefaults.go Co-authored-by: Jordi van Liempt <[email protected]> --------- Co-authored-by: Jordi van Liempt <[email protected]> * moved func prepareGolangPrivatePackages to pkg/golang --------- Co-authored-by: Akramdzhon Azamov <[email protected]> Co-authored-by: Andrei Kireev <[email protected]> Co-authored-by: Anil Keshav <[email protected]> Co-authored-by: Egor Balakin <[email protected]> Co-authored-by: Egor Balakin <[email protected]> Co-authored-by: Vyacheslav Starostin <[email protected]> Co-authored-by: Marcus Holl <[email protected]> Co-authored-by: Jk1484 <[email protected]> Co-authored-by: Jordi van Liempt <[email protected]>
- Loading branch information
Showing
11 changed files
with
195 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package golang | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"strings" | ||
|
||
"github.com/SAP/jenkins-library/pkg/command" | ||
) | ||
|
||
type utilsBundle struct { | ||
command.Command | ||
} | ||
|
||
// prepare golang private packages for whitesource and blackduck(detectExecuteScan) | ||
func PrepareGolangPrivatePackages(stepName, privateModules, privateModulesGitToken string) error { | ||
utils := &utilsBundle{ | ||
Command: command.Command{ | ||
StepName: stepName, | ||
}, | ||
} | ||
os.Setenv("GOPRIVATE", privateModules) | ||
err := gitConfigurationForPrivateModules(privateModules, privateModulesGitToken, utils) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func gitConfigurationForPrivateModules(privateMod string, token string, utils *utilsBundle) error { | ||
privateMod = strings.ReplaceAll(privateMod, "/*", "") | ||
privateMod = strings.ReplaceAll(privateMod, "*.", "") | ||
modules := strings.Split(privateMod, ",") | ||
for _, v := range modules { | ||
authenticatedRepoURL := fmt.Sprintf("https://%s@%s", token, v) | ||
repoBaseURL := fmt.Sprintf("https://%s", v) | ||
err := utils.RunExecutable("git", "config", "--global", fmt.Sprintf("url.%s.insteadOf", authenticatedRepoURL), repoBaseURL) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters