1
votes

How can I add as part of my pipeline that it needs to grab the git repository , run npm install and npm build and then push to cloud foundry?.

So far i am able to make it so that it grabs the repository and pushes to cloud foundry. But not completely sure on how to make it so that it builds the npm tasks. I am using a BOSH director to handle all the concourse stuff.

Any direction or ideas will be very appreciated. I am following this tutorial here and based my pipeline on this: (where and how would i go about adding building npm tasks?)

---
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

1

1 Answers

2
votes

You need to write a task that runs a script that runs npm install and npm build prior to pushing to cloud foundry.

It is also important to note that in the below script concourse will look for the bits to push to cf in the directory resource-deploy-web-app, so make sure to put everything you want to push there in your script.

So your new job configuration is going to look something like:

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