Add default env for script run
What this PR does / why we need it:
Added default env value for the deployment information (such as deployment id, application id...)
example of app.pipecd.yaml
apiVersion: pipecd.dev/v1beta1
kind: KubernetesApp
spec:
name: script-run-like-jenkins
labels:
env: example
team: product
pipeline:
stages:
- name: K8S_CANARY_ROLLOUT
with:
replicas: 10%
- name: SCRIPT_RUN
with:
run: |
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_RAW
echo $
env:
REPOSITORY_URL: "https://github.com/pipecd/pipecd"
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_RAW
...
Which issue(s) this PR fixes:
Fixes #4814
Does this PR introduce a user-facing change?:
- How are users affected by this change:
- Is this breaking change:
- How to migrate (if breaking change):
Codecov Report
Attention: Patch coverage is 34.61538% with 34 lines in your changes missing coverage. Please review.
Project coverage is 22.28%. Comparing base (
ce9bc16) to head (980378d). Report is 1 commits behind head on master.
| Files | Patch % | Lines |
|---|---|---|
| pkg/app/piped/executor/scriptrun/scriptrun.go | 42.85% | 23 Missing and 1 partial :warning: |
| pkg/app/piped/executor/kubernetes/rollback.go | 0.00% | 10 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #5002 +/- ##
==========================================
+ Coverage 22.25% 22.28% +0.02%
==========================================
Files 519 519
Lines 57234 57284 +50
==========================================
+ Hits 12739 12766 +27
- Misses 43468 43492 +24
+ Partials 1027 1026 -1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
oops, I forgot to add the Summary value. will try to add it 🙏
https://github.com/pipe-cd/pipecd/issues/4814#issuecomment-2060583328
Added Summary value on 701bffa