【问题标题】:Unable to push a docker image to Cloud Foundry using Jenkins CloudFoundryPlugin无法使用 Jenkins CloudFoundryPlugin 将 docker 映像推送到 Cloud Foundry
【发布时间】:2019-07-08 15:52:05
【问题描述】:

我正在尝试使用 Cloud Foundry 插件将 docker 注册表映像推送到 CloudFoundry。应用程序在暂存步骤中失败。

我在 manifest.yml 文件中添加了注册表 url 和用户名,并在 cf 文档中提到的环境变量中提供了密码。

Jenkinsfile sn-p:

stage ('Dev_Deployment') {
            steps{
                sh 'export CF_DOCKER_PASSWORD=$USER_CREDENTIALS_PSW'
                pushToCloudFoundry(
                  target: 'https://api.sys.dev.example.io',
                  credentialsId: 'pcfcreds',
                  organization: 'pcforg',
                  cloudSpace: 'pcfspace',
                  manifestChoice: [manifestFile: 'manifest.yml']
                )
              }
          }

manifest.yml 代码:

---
applications:
- name: App-1
  memory: 1G
  instances: 1
  host: App-1
  disk_quota: 1G
  docker:
    image: registry-dev.apps.dev.example.io/app-1
    username: user1

我希望将 docker 映像部署为 PCF 中的应用程序。

但我在应用程序暂存时遇到错误

java.lang.IllegalStateException: Application SpringDemo-3 failed during staging

它实际上并不认为它是一个 docker 部署。而是将其视为正常的应用程序部署并搜索 buildpack。

2019-07-08T19:23:14.80+0530 [STG/0] ERR None of the buildpacks detected a compatible application

是否有任何示例管道将安全注册表中的 docker 映像推送到 CloudFoundry?

【问题讨论】:

    标签: docker jenkins jenkins-plugins cloud-foundry


    【解决方案1】:

    我已经查看了Cloud Foundry Plugin Release Notes(直到版本 2.3.1),但我没有找到任何可以将 docker 映像推送到 Cloud Foundry 的功能。

    因此,我找到了以下代码 sn-p 作为解决方法,其中 CF CLI 已用于推送 docker 映像,而不是使用 Cloud Foundry 插件。

    stage ('Dev_Deployment') {
        steps{
            sh 'pwd'
            sh 'which cf'
            sh 'cf --version'
            sh 'cf login -a $CF_API_ENDPOINT -u $CF_CREDENTIALS_USER -p $CF_CREDENTIALS_PASSWORD'
            sh 'cf t -o $CF_ORG -s $CF_SPACE'
            sh 'CF_DOCKER_PASSWORD=$DOCKER_CREDENTIALS_PASSWORD cf push'
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-05
      • 1970-01-01
      • 2019-10-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多