Skip to content

Commit

Permalink
Merge pull request #50 from scality/bugfix/HD-2909
Browse files Browse the repository at this point in the history
HD-2909 fix the success/failure condition
  • Loading branch information
bertranddemiddelaer authored Feb 17, 2023
2 parents 08d39cd + c5bff2f commit 66b8171
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 6 additions & 4 deletions upload_final_status/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ The action requires the artifact `usrename` and `password` in order to upload th

### Inputs

| Name | Description | Required |
|--------------------|------------------------|----------|
| ARTIFACTS_USER | The artifacts username ||
| ARTIFACTS_PASSWORD | The artifacts password ||
| Name | Description | Required |
|--------------------|-------------------------------|----------|
| ARTIFACTS_USER | The artifacts username ||
| ARTIFACTS_PASSWORD | The artifacts password ||
| JOBS_RESULTS | Concatenation of jobs results ||

**Note:** it is important to set the `always()` condition on the step
that calls this action so it's always called at the end.
Expand Down Expand Up @@ -57,5 +58,6 @@ jobs:
with:
ARTIFACTS_USER: ${{ secrets.ARTIFACTS_USER }}
ARTIFACTS_PASSWORD: ${{ secrets.ARTIFACTS_PASSWORD }}
JOBS_RESULTS: ${{ join(needs.*.result) }}

```
7 changes: 5 additions & 2 deletions upload_final_status/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
ARTIFACTS_PASSWORD:
description: The artifact password to upload the status
required: true
JOBS_RESULTS:
descript: Concatenation of jobs results
required: true

runs:
using: composite
Expand All @@ -21,12 +24,12 @@ runs:
echo "TEMP=$TEMP" >> $GITHUB_OUTPUT
- name: write failed result
shell: bash
if: failure()
if: ${{ contains(inputs.JOBS_RESULTS, 'failed') || contains(inputs.JOBS_RESULTS, 'cancelled') || contains(inputs.JOBS_RESULTS, 'skipped') }}
run: |
echo -n "FAILED" > ${{ steps.temp-dir.outputs.TEMP }}/.final_status
- name: write successful result
shell: bash
if: success()
if: ${{ !contains(inputs.JOBS_RESULTS, 'failed') && !contains(inputs.JOBS_RESULTS, 'cancelled') && !contains(inputs.JOBS_RESULTS, 'skipped') }}
run: |
echo -n "SUCCESSFUL" > ${{ steps.temp-dir.outputs.TEMP }}/.final_status
- name: upload file to artifacts
Expand Down

0 comments on commit 66b8171

Please sign in to comment.