Search code examples
ibm-clouddevopsdevops-services

How to copy build artifacts from frontend to backend in IBM BlueMix DevOps


I am developing two separated projects: frontend and backend. I just want to do some steps:

  1. Build frontend with webpack, build artifacts to build archive directory (/build folder)
  2. Copy all of files/folders in build artifacts (/build folder) from frontend to www/public folder in the backend.

Here is my IBM DevOps Toolchains

Toolchains

And here is my Delivery Pipeline

Pipeline

Q1: In the DEPLOY FRONTEND stage, how can I copy the build artifacts to the BUILD BACKEND or DEPLOY BACKEND stage? Please note that I already set the input for DEPLOY FRONTEND stage to be the build artifacts from the BUILD FRONTEND stage.

Q2: How can I get the input build artifacts path in the shell script?


Solution

  • If you want to use the build artifacts from the "BUILD FRONTEND" in the "BUILD BACKEND" job, you have two options.

    1.) As Philippe said, if you aren't using a git input in the "BUILD BACKEND" stage, then simply set the "BUILD BACKEND" input to the stage type and select the "BUILD FRONTEND" stage.

    2.) If the "BUILD BACKEND" stage has a git input, then you still need to follow the steps in the first option. After doing this you must configure the build script in the "BUILD BACKEND" to manually pull the git repository you were previously using as input. This usually involves generating oauth2 tokens or personal access tokens depending on the git provider used, for Github see this link. You can store your git credentials or your access tokens as secure properties on your pipeline stage and access them in your script as necessary.