bedrock icon indicating copy to clipboard operation
bedrock copied to clipboard

SPK generated pipelines should be easier to debug locally.

Open andrebriggs opened this issue 5 years ago • 0 comments

Right now we generate pipelines with spk like the app repo build pipeline. In that pipeline we inline bash commands to build and push Docker images. This makes it difficult to run the same version locally.

We should consider wrapping the inline bash in a shell script to make local debugging easier.

The current structure of pipeline yaml files spk creates looks like:

trigger:
  branches:
    include:
      - master
variables:
  - group: fabrikam-vg
pool:
  vmImage: ubuntu-latest
steps:
  - script: |-
      # Inline bash scripting with business logic
      # ...
      # ...
    displayName: 'Download Fabrikate and SPK, Update HLD, Push changes, Open PR'
    env:
      ACCESS_TOKEN_SECRET: $(PAT)
      AZURE_DEVOPS_EXT_PAT: $(PAT)
      REPO: $(HLD_REPO)

Having pipelines in this form makes it difficult to replication the business logic section on a developers local machine. This means a developers must wait for an Azure pipeline to run in order to see results when debugging an issue.

An alternative approach would be

trigger:
  branches:
    include:
      - master
variables:
  - group: fabrikam-vg
pool:
  vmImage: ubuntu-latest
steps:
  - script: |-
      # Download business logic scripts in previous "step"
      executeBusinessLogic.sh $ACCESS_TOKEN_SECRET
      executeMoreBusinessLogic.sh $REPO
    displayName: 'Download Fabrikate and SPK, Update HLD, Push changes, Open PR'
    env:
      ACCESS_TOKEN_SECRET: $(PAT)
      AZURE_DEVOPS_EXT_PAT: $(PAT)
      REPO: $(HLD_REPO)

We already take this approach with the build.sh script. It might be useful to apply this method throughout the pipelines

andrebriggs avatar Feb 20 '20 03:02 andrebriggs