1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-03-31 22:05:11 +02:00
sap-jenkins-library/documentation/docs/steps/containerPushToRegistry.md
Hans Schulz d2f75044d0
Add option to tag artifact version to containerPushToRegistryStep (#2859)
* Add option to tag artifact version to containerPushToRegistryStep

* Update vars/containerPushToRegistry.groovy

Co-authored-by: breuerjo <36748317+breuerjo@users.noreply.github.com>

* commonPipelineEnvironment instead of globalPipelineEnvironment

Co-authored-by: breuerjo <36748317+breuerjo@users.noreply.github.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
2021-06-28 08:02:06 +02:00

45 lines
1.5 KiB
Markdown

# ${docGenStepName}
## ${docGenDescription}
## Prerequisites
You need to have a valid user with write permissions in the target docker registry.
Credentials for the target docker registry have been configured in Jenkins with a dedicated Id.
You can create the credentials in your Jenkins<br />
via _Jenkins_ -> _Credentials_ -> _System_ -> _Global credentials (unrestricted)_ -> _Add Credentials_ ->
* Kind: _Username with Password_
* ID: specify id which you then use for the configuration of `dockerCredentialsId` (see below)
## Example
Usage of pipeline step:
**OPTION A:** To pull a Docker image from an existing docker registry and push to a different docker registry:
```groovy
containerPushToRegistry script: this,
dockerCredentialsId: 'myTargetRegistryCredentials',
sourceRegistryUrl: 'https://mysourceRegistry.url',
sourceImage: 'path/to/mySourceImageWith:tag',
dockerRegistryUrl: 'https://my.target.docker.registry:50000'
```
**OPTION B:** To push a locally built docker image into the target registry (only possible when a Docker daemon is available on your Jenkins node):
```groovy
containerPushToRegistry script: this,
dockerCredentialsId: 'myTargetRegistryCredentials',
dockerImage: 'path/to/myImageWith:tag',
dockerRegistryUrl: 'https://my.target.docker.registry:50000'
```
## ${docGenParameters}
## ${docGenConfiguration}
## ${docJenkinsPluginDependencies}