CICD Jenkins 添加和使用凭证

pipeline {
    agent any

    environment {
        // 这里使用的是刚才创建的凭证
        ALIYUN_REGISTRY = credentials('ddfb71d4-20aa-4b62-bd11-bb2fc2093a85')
    }

    stages {
        stage('推送镜像'){
            steps {

                // 凭证用户名和密码
                sh "docker login --username=${ALIYUN_REGISTRY_USR} --password=${ALIYUN_REGISTRY_PSW} registry.cn-hangzhou.aliyuncs.com"
                sh "docker push registry.cn-hangzhou.aliyuncs.com/acp-ns/${DOKCER_IMAGE}"
            }
        }
    }
}