mirror of
https://github.com/SAP/jenkins-library.git
synced 2026-06-19 22:58:55 +02:00
feat (Documentation) documentation for mavenBuild and npmExecuteScripts that consume dependencies from a private repo. (#3484)
* build depdency docu for maven and npm * removing trailing white space in yaml * Update resources/metadata/mavenBuild.yaml * relative url for vault and mta docu * running go generate * keeping vault relative path * go generate * reverting to global paths * go generate * wild card for a higher level dir * searching on top folder only * relative level above * pointing to infrastructure * correcting links Co-authored-by: anilkeshav27 <you@example.com> Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
This commit is contained in:
co-authored by
anilkeshav27
Oliver Nocon
parent
1ca60f56ab
commit
1546ca293a
@@ -124,7 +124,40 @@ func MavenBuildCommand() *cobra.Command {
|
||||
Short: "This step will install the maven project into the local maven repository.",
|
||||
Long: `This step will install the maven project into the local maven repository.
|
||||
It will also prepare jacoco to record the code coverage and
|
||||
supports ci friendly versioning by flattening the pom before installing.`,
|
||||
supports ci friendly versioning by flattening the pom before installing.
|
||||
|
||||
### build with depedencies from a private repository
|
||||
if your build has depdencies from a private repository you can include a project settings xml into the source code respository as below (replace the ` + "`" + `<url>` + "`" + `
|
||||
tag with a valid private repo url).
|
||||
` + "`" + `` + "`" + `` + "`" + `xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||
<servers>
|
||||
<server>
|
||||
<id>private.repo.id</id>
|
||||
<username>${env.PIPER_CREDENTIAL_USERNAME}</username>
|
||||
<password>${env.PIPER_CREDENTIAL_PASSWORD}</password>
|
||||
</server>
|
||||
</servers>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>private.repo.id</id>
|
||||
<url>https://private.repo.com/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</settings>
|
||||
` + "`" + `` + "`" + `` + "`" + `
|
||||
` + "`" + `PIPER_CREDENTIAL_USERNAME` + "`" + ` and ` + "`" + `PIPER_CREDENTIAL_PASSWORD` + "`" + ` are the username and password for the private repository and are exposed as environment variables that must be present
|
||||
in the environment where the Piper step runs or alternatively can be created using :
|
||||
[vault general purpose credentials](../infrastructure/vault.md#using-vault-for-general-purpose-and-test-credentials)
|
||||
|
||||
Ensure the following configuration in the Piper config yaml to ensure the above settings xml is included during mavenBuild:
|
||||
|
||||
` + "`" + `` + "`" + `` + "`" + `yaml
|
||||
mavenBuild:
|
||||
projectSettingsFile: <path to the above settings.xml>
|
||||
` + "`" + `` + "`" + `` + "`" + ``,
|
||||
PreRunE: func(cmd *cobra.Command, _ []string) error {
|
||||
startTime = time.Now()
|
||||
log.SetStepName(STEP_NAME)
|
||||
|
||||
@@ -131,7 +131,10 @@ func MtaBuildCommand() *cobra.Command {
|
||||
var createMtaBuildCmd = &cobra.Command{
|
||||
Use: STEP_NAME,
|
||||
Short: "Performs an mta build",
|
||||
Long: `Executes the SAP Multitarget Application Archive Builder to create an mtar archive of the application.`,
|
||||
Long: `Executes the SAP Multitarget Application Archive Builder to create an mtar archive of the application.
|
||||
### build with depedencies from a private repository
|
||||
For maven related settings refer [maven build dependencies](./mavenBuild.md#build-with-depedencies-from-a-private-repository)
|
||||
For NPM related settings refer [NPM build dependencies](./npmExecuteScripts.md#build-with-depedencies-from-a-private-repository)`,
|
||||
PreRunE: func(cmd *cobra.Command, _ []string) error {
|
||||
startTime = time.Now()
|
||||
log.SetStepName(STEP_NAME)
|
||||
|
||||
@@ -77,7 +77,22 @@ func NpmExecuteScriptsCommand() *cobra.Command {
|
||||
var createNpmExecuteScriptsCmd = &cobra.Command{
|
||||
Use: STEP_NAME,
|
||||
Short: "Execute npm run scripts on all npm packages in a project",
|
||||
Long: `Execute npm run scripts in all package json files, if they implement the scripts.`,
|
||||
Long: `Execute npm run scripts in all package json files, if they implement the scripts.
|
||||
|
||||
### build with depedencies from a private repository
|
||||
if your build has scoped/unscoped depdencies from a private repository you can include a .npmrc into the source code
|
||||
respository as below (replace the registry value(s) with a valid private repo url) :
|
||||
|
||||
` + "`" + `` + "`" + `` + "`" + `
|
||||
@privateScope:registry=https://private.repository.com/
|
||||
//private.repository.com/:username=${PIPER_CREDENTIAL_USER}
|
||||
//private.repository.com/:_password=${PIPER_CREDENTIAL_PASSWORD_BASE64}
|
||||
//private.repository.com/:always-auth=true
|
||||
registry=https://registry.npmjs.org
|
||||
` + "`" + `` + "`" + `` + "`" + `
|
||||
` + "`" + `PIPER_CREDENTIAL_USER` + "`" + ` and ` + "`" + `PIPER_CREDENTIAL_PASSWORD_BASE64` + "`" + ` (Base64 encoded password) are the username and password for the private repository
|
||||
and are exposed are environment variables that must be present in the environment where the Piper step runs or alternatively can be created using :
|
||||
[vault general purpose credentials](../infrastructure/vault.md#using-vault-for-general-purpose-and-test-credentials)`,
|
||||
PreRunE: func(cmd *cobra.Command, _ []string) error {
|
||||
startTime = time.Now()
|
||||
log.SetStepName(STEP_NAME)
|
||||
|
||||
@@ -8,6 +8,39 @@ metadata:
|
||||
This step will install the maven project into the local maven repository.
|
||||
It will also prepare jacoco to record the code coverage and
|
||||
supports ci friendly versioning by flattening the pom before installing.
|
||||
|
||||
### build with depedencies from a private repository
|
||||
if your build has depdencies from a private repository you can include a project settings xml into the source code respository as below (replace the `<url>`
|
||||
tag with a valid private repo url).
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||
<servers>
|
||||
<server>
|
||||
<id>private.repo.id</id>
|
||||
<username>${env.PIPER_CREDENTIAL_USERNAME}</username>
|
||||
<password>${env.PIPER_CREDENTIAL_PASSWORD}</password>
|
||||
</server>
|
||||
</servers>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>private.repo.id</id>
|
||||
<url>https://private.repo.com/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</settings>
|
||||
```
|
||||
`PIPER_CREDENTIAL_USERNAME` and `PIPER_CREDENTIAL_PASSWORD` are the username and password for the private repository and are exposed as environment variables that must be present
|
||||
in the environment where the Piper step runs or alternatively can be created using :
|
||||
[vault general purpose credentials](../infrastructure/vault.md#using-vault-for-general-purpose-and-test-credentials)
|
||||
|
||||
Ensure the following configuration in the Piper config yaml to ensure the above settings xml is included during mavenBuild:
|
||||
|
||||
```yaml
|
||||
mavenBuild:
|
||||
projectSettingsFile: <path to the above settings.xml>
|
||||
```
|
||||
spec:
|
||||
inputs:
|
||||
secrets:
|
||||
|
||||
@@ -3,6 +3,9 @@ metadata:
|
||||
description: Performs an mta build
|
||||
longDescription: |
|
||||
Executes the SAP Multitarget Application Archive Builder to create an mtar archive of the application.
|
||||
### build with depedencies from a private repository
|
||||
For maven related settings refer [maven build dependencies](./mavenBuild.md#build-with-depedencies-from-a-private-repository)
|
||||
For NPM related settings refer [NPM build dependencies](./npmExecuteScripts.md#build-with-depedencies-from-a-private-repository)
|
||||
spec:
|
||||
inputs:
|
||||
params:
|
||||
|
||||
@@ -5,6 +5,21 @@ metadata:
|
||||
description: Execute npm run scripts on all npm packages in a project
|
||||
longDescription: |
|
||||
Execute npm run scripts in all package json files, if they implement the scripts.
|
||||
|
||||
### build with depedencies from a private repository
|
||||
if your build has scoped/unscoped depdencies from a private repository you can include a .npmrc into the source code
|
||||
respository as below (replace the registry value(s) with a valid private repo url) :
|
||||
|
||||
```
|
||||
@privateScope:registry=https://private.repository.com/
|
||||
//private.repository.com/:username=${PIPER_CREDENTIAL_USER}
|
||||
//private.repository.com/:_password=${PIPER_CREDENTIAL_PASSWORD_BASE64}
|
||||
//private.repository.com/:always-auth=true
|
||||
registry=https://registry.npmjs.org
|
||||
```
|
||||
`PIPER_CREDENTIAL_USER` and `PIPER_CREDENTIAL_PASSWORD_BASE64` (Base64 encoded password) are the username and password for the private repository
|
||||
and are exposed are environment variables that must be present in the environment where the Piper step runs or alternatively can be created using :
|
||||
[vault general purpose credentials](../infrastructure/vault.md#using-vault-for-general-purpose-and-test-credentials)
|
||||
spec:
|
||||
inputs:
|
||||
resources:
|
||||
|
||||
Reference in New Issue
Block a user