1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/resources/metadata/nexusUpload.yaml
Siarhei Pazdniakou 46bafc40a3
Improve validation of configuration (#3125)
* Implemented validation for the option possibleValues

* Has been added the option mandatoryIf to config with validation

* Fixed issues found during code review

* improved golang template

* Fixed tests. Added validation for mandatoryIf option

* Fix typo

* Fixed tests

* Validation was refactored. Added options

* Added default value for parameters with possibleValues option

* Validation was moved after the configuration resolution

* Canceled some default values

Co-authored-by: Sven Merk <33895725+nevskrem@users.noreply.github.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-10-01 12:49:05 +02:00

164 lines
5.9 KiB
YAML

metadata:
name: nexusUpload
aliases:
- name: mavenExecute
deprecated: false
description: Upload artifacts to Nexus Repository Manager
longDescription: |
Upload build artifacts to a Nexus Repository Manager.
Supports MTA, npm and (multi-module) Maven projects.
MTA files will be uploaded to a Maven repository.
The uploaded file-type depends on your project structure and step configuration.
To upload Maven projects, you need a pom.xml in the project root and set the mavenRepository option.
To upload MTA projects, you need a mta.yaml in the project root and set the mavenRepository option.
To upload npm projects, you need a package.json in the project root and set the npmRepository option.
If the 'format' option is set, the 'URL' can contain the full path including the repository ID. Providing the 'npmRepository' or the 'mavenRepository' parameter(s) is not necessary.
npm:
Publishing npm projects makes use of npm's "publish" command.
It requires a "package.json" file in the project's root directory which has "version" set and is not delared as "private".
To find out what will be published, run "npm publish --dry-run" in the project's root folder.
It will use your gitignore file to exclude the mached files from publishing.
Note: npm's gitignore parser might yield different results from your git client, to ignore a "foo" directory globally use the glob pattern "**/foo".
If an image for mavenExecute is configured, and npm packages are to be published, the image must have npm installed.
spec:
inputs:
secrets:
- name: nexusCredentialsId
description: Jenkins 'Username with password' credentials ID containing the technical username/password credential for accessing the nexus endpoint.
type: jenkins
aliases:
- name: nexus/credentialsId
params:
- name: version
type: string
description: The Nexus Repository Manager version. Currently supported are 'nexus2' and 'nexus3'.
scope:
- PARAMETERS
- STAGES
- STEPS
default: nexus3
possibleValues:
- nexus2
- nexus3
aliases:
- name: nexus/version
- name: format
type: string
description: The format/registry type. Currently supported are 'maven' and 'npm'.
scope:
- PARAMETERS
- STAGES
- STEPS
possibleValues:
- maven
- npm
resourceRef:
- name: commonPipelineEnvironment
param: custom/repositoryFormat
default: maven
- name: url
type: string
description: URL of the nexus. The scheme part of the URL will not be considered, because only http is supported. If the 'format' option is set, the 'URL' can contain the full path including the repository ID and providing the 'npmRepository' or the 'mavenRepository' parameter(s) is not necessary.
scope:
- PARAMETERS
- STAGES
- STEPS
mandatory: true
aliases:
- name: nexus/url
resourceRef:
- name: commonPipelineEnvironment
param: custom/repositoryUrl
- name: mavenRepository
type: string
description: Name of the nexus repository for Maven and MTA deployments. If this is not provided, Maven and MTA deployment is implicitly disabled.
scope:
- PARAMETERS
- STAGES
- STEPS
aliases:
- name: nexus/mavenRepository
- name: nexus/repository
deprecated: true
- name: npmRepository
type: string
description: Name of the nexus repository for npm deployments. If this is not provided, npm deployment is implicitly disabled.
scope:
- PARAMETERS
- STAGES
- STEPS
aliases:
- name: nexus/npmRepository
- name: groupId
type: string
description: Group ID of the artifacts. Only used in MTA projects, ignored for Maven.
scope:
- PARAMETERS
- STAGES
- STEPS
aliases:
- name: nexus/groupId
- name: artifactId
type: string
description: The artifact ID used for both the .mtar and mta.yaml files deployed for MTA projects, ignored for Maven.
scope:
- PARAMETERS
- name: globalSettingsFile
type: string
description: Path to the mvn settings file that should be used as global settings file.
scope:
- GENERAL
- PARAMETERS
- STAGES
- STEPS
aliases:
- name: maven/globalSettingsFile
- name: m2Path
type: string
description: The path to the local .m2 directory, only used for Maven projects.
scope:
- GENERAL
- PARAMETERS
- STAGES
- STEPS
aliases:
- name: maven/m2Path
- name: username
type: string
description: Username for accessing the Nexus endpoint.
scope:
- PARAMETERS
secret: true
resourceRef:
- name: nexusCredentialsId
type: secret
param: username
- name: commonPipelineEnvironment
param: custom/repositoryUsername
- name: password
type: string
description: Password for accessing the Nexus endpoint.
scope:
- PARAMETERS
secret: true
resourceRef:
- name: nexusCredentialsId
type: secret
param: password
- name: commonPipelineEnvironment
param: custom/repositoryPassword
resources:
- name: buildDescriptor
type: stash
- name: buildResult
type: stash
containers:
# To allow both maven and mta we require an image that contains both tools. If the user configures an image for mavenExecute that also needs to contain both.
- name: mvn-npm
image: devxci/mbtci:1.1.1