Multiple commands in the same build step in Google Cloud Builder

后端 未结 3 1383
礼貌的吻别
礼貌的吻别 2021-01-11 19:31

I want to run our automated backend test suite on Google Cloud Builder environment. However, naturally, I bumped into the need to install various dependencies and prerequisi

3条回答
  •  一整个雨季
    2021-01-11 19:53

    See:

    • https://cloud.google.com/cloud-build/docs/configuring-builds/configure-build-step-order
    • https://cloud.google.com/cloud-build/docs/configuring-builds/store-images-artifacts
    • https://github.com/GoogleCloudPlatform/cloud-builders-community
    • https://github.com/GoogleCloudPlatform/cloud-builders

    By default, build steps run sequentially, but you can configure them to run concurrently.

    The order of the build steps in the steps field relates to the order in which the steps are executed. Steps will run serially or concurrently based on the dependencies defined in their waitFor fields.

    A step is dependent on every id in its waitFor and will not launch until each dependency has completed successfully.

    So you only separate command as each step.

    Like this.

    steps:
      - name: 'ubuntu'
        args: ['bash', './scripts/install-prerequisites.sh']
        id: 'bash ./scripts/install-prerequisites.sh'
      - name: 'ubuntu'
        args: ['composer', 'install', '-n', '-q', '--prefer-dist']
        id: 'composer install -n -q --prefer-dist'
      - name: 'ubuntu'
        args: ['php', 'init', '--overwrite=y']
        id: 'php init --overwrite=y'
      - name: 'ubuntu'
        args: ['php', 'tests/run']
        id: 'php tests/run'
    

    By the way, Can using ubuntu image run php and composer command?

    I think that you should use or build docker image which can run php and composer command.

    The composer docker image is here.

    steps:
    - name: 'gcr.io/$PROJECT_ID/composer'
      args: ['install']
    
    
    

提交回复
热议问题