Last active
October 24, 2021 04:32
-
-
Save Dispader/02a2141e3a8bfb35448c767c82c5d8be to your computer and use it in GitHub Desktop.
Jenkins Script Console code to configure a private Docker Registry (Hub)
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
import jenkins.model.Jenkins | |
import org.jenkinsci.plugins.docker.workflow.declarative.GlobalConfig | |
def global = Jenkins.instance.getDescriptorByType(GlobalConfig.class) | |
global.dockerLabel = 'A_LABEL_FOR_YOUR_REGISTRY' | |
import org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint | |
def registry = new DockerRegistryEndpoint('YOUR_DOCKER_REGISTRY', 'YOUR_JENKINS_CREDENTIAL_ID_FOR_THE_REGISTRY') | |
global.registry = registry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated for the new Jenkins Workflow configuration classes.