pipe-cd / pipecd

The One CD for All {applications, platforms, operations}
https://pipecd.dev
Apache License 2.0
1.09k stars 153 forks source link

Can't use the script file on the SCRIPT_RUN_ROLBACK stage #5214

Closed ffjlabo closed 1 month ago

ffjlabo commented 2 months ago

What happened:

When using the script file on the onRollback field in app.pipecd.yaml, can't execute it on the SCRIPT_RUN_ROLLBACK stage. PipeCD (We can use the script file on the SCRIPT_RUN stage when setting the run option of this stage)

file structure

- app.pipecd.yaml
- script.sh

app.pipecd.yaml

apiVersion: pipecd.dev/v1beta1
kind: KubernetesApp
spec:
  name: script-run-like-jenkins
  labels:
    env: example
    team: product
  pipeline:
    stages:
      - name: SCRIPT_RUN
        with:
          run: |
            sleep 10
            sh script.sh
          onRollback: |
            echo $SR_DEPLOYMENT_ID
            echo $SR_APPLICATION_ID
            echo $SR_APPLICATION_NAME
            echo $SR_TRIGGERED_AT
            echo $SR_TRIGGERED_COMMIT_HASH
            echo $SR_REPOSITORY_URL
            echo $SR_SUMMARY
            echo $SR_CONTEXT_RAW
            sh script.sh

What you expected to happen:

It would be nice to execute the script file when SCRIPT_RUN_ROLLBACK stage is executed.

How to reproduce it:

Environment: