1

我如何将它添加为我的管道的一部分,它需要获取 git 存储库、运行 npm install 和 npm build,然后推送到 Cloud Foundry?

到目前为止,我能够做到这一点,以便它抓取存储库并推送到云代工厂。但不完全确定如何制作它以构建 npm 任务。我正在使用 BOSH 导演来处理所有大厅的事情。

任何方向或想法将不胜感激。我在这里关注本教程并以此为基础:(我将在哪里以及如何添加构建 npm 任务?)

---
resources:
- name: resource-web-app
  type: git
  source:
    uri: https://github.com/cloudfoundry-community/simple-go-web-app.git

- name: resource-deploy-web-app
  type: cf
  source:
    api: {{cf-api}}
    username: {{cf-username}}
    password: {{cf-password}}
    organization: {{cf-organization}}
    space: {{cf-space}}
    skip_cert_check: true

jobs:
- name: job-deploy-app
  serial: true
  plan:
  - {get: resource-web-app, trigger: true}
  - put: resource-deploy-web-app
    params:
      manifest: resource-web-app/manifest.yml
      path: resource-web-app

https://github.com/starkandwayne/concourse-tutorial/tree/master/15_deploy_cloudfoundry_app

4

1 回答 1

2

您需要编写一个运行脚本的任务npm install,该脚本npm build在推送到云代工厂之前运行。

同样重要的是要注意,在下面的脚本中,大厅将在目录中查找要推送到 cf 的位resource-deploy-web-app,因此请确保将要推送的所有内容都放在脚本中。

因此,您的新作业配置将如下所示:

jobs:
- name: job-deploy-app
  serial: true
  plan:
  - {get: resource-web-app, trigger: true}
  - task: build-npm
    config:
      platform: linux
      image_resource:
        type: docker-image
        source:
          repository: node

      inputs:
        - name: resource-web-app

      run:
        path: resource-web-app/scripts/script-that-does-npm-stuff.sh

      outputs:
        - name: resource-deploy-web-app

 - put: resource-deploy-web-app
   params:
      manifest: resource-web-app/manifest.yml
      path: resource-web-app
于 2017-02-26T02:10:45.610 回答