jenkins pipeline通过Image Tag Parameter插件获取Harbor镜像作为参数

作者: root007 分类: Linux 发布时间: 2020-01-03 17:03

插件 Image Tag Parameter

Image Selection

通过docker镜像实现pipeline回滚

node{
.....
if ("${env.DEPLOY_FLAG}" == 'Deploy'){ 
........
   }
 if ("${DEPLOY_FLAG}" == 'Rollback'){
    withKubeConfig(caCertificate: '', clusterName: '', contextName: '', credentialsId: 'k8s-kubectl', namespace: 'jenkins', serverUrl: 'https://kubernetes.default.svc.cluster.local') {
                           sh("kubectl set image deployment/${project} ${appName}=harbor.xxx.xxx/${DOCKER_IMAGE} -n ${namespace}")
                           sh ("kubectl rollout status -n $namespace  deployment/${project}")
                           sh("echo 请访问: http://`kubectl  get ingress -n ${namespace} ${appName}  -o  jsonpath='{.spec.rules[].host}'`") 
     
    }
 }
   
}

5条评论
  • ct

    2020年5月20日 下午2:10

    博主,镜像仓库地址一定要是https的么,我用http的一直显示未认证,用的harbor

    1. root007

      2020年5月26日 下午2:28

      可以是http 但是得在docker里面添加仓库日志为信任

  • dxg

    2020年7月14日 上午10:47

    楼主,我使用image tag parament获取不到镜像tag ,显示permanent redirect,是怎么回事呢,我用的是harbor仓库

    1. root007

      2020年8月9日 下午12:21

      检查一下配置对不对

  • dxg

    2020年7月15日 上午9:28

    博主,我使用image tag parament插件获取不到镜像的tag,docker添加了信任,是怎么回事呢

回复 dxg 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注