mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
5bb6d59753
This step should serve as generic entry point in pipelines for building artifacts. Build principle: build once. Purpose of the step: - build using a defined build technology - store build result for future use in testing etc.
1.5 KiB
1.5 KiB
${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
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:
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 build docker image into the target registry (only possible when a Docker deamon is available on your Jenkins node):
containerPushToRegistry script: this,
dockerCredentialsId: 'myTargetRegistryCredentials',
dockerImage: 'path/to/myImageWith:tag',
dockerRegistryUrl: 'https://my.target.docker.registry:50000'