Reverting back to earlier version.
This commit is contained in:
@@ -6,11 +6,12 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
# Job 1: Check if PR exists and create one if the branch is new
|
||||||
check-and-create-pr:
|
check-and-create-pr:
|
||||||
name: Check and Create PR
|
name: Check and Create PR
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
|
pr_created: ${{ steps.cc-pr.outputs.pr_created }}
|
||||||
pr_number: ${{ steps.cc-pr.outputs.pr_index }}
|
pr_number: ${{ steps.cc-pr.outputs.pr_index }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
@@ -52,14 +53,10 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sonarqube-analysis-dry-run:
|
sonarqube-analysis:
|
||||||
name: SonarQube Analysis & Compose Dry-Run
|
name: SonarQube Analysis
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: check-and-create-pr
|
needs: check-and-create-pr
|
||||||
outputs:
|
|
||||||
qg_status: ${{ steps.quality-gate.outputs.quality-gate-status }}
|
|
||||||
qg_results: ${{ steps.quality-gate-check.outputs.quality-gate-result }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -85,40 +82,13 @@ jobs:
|
|||||||
sonar-host-url: ${{ secrets.SONARQUBE_HOST }}
|
sonar-host-url: ${{ secrets.SONARQUBE_HOST }}
|
||||||
sonar-token: ${{ secrets.SONARQUBE_TOKEN }}
|
sonar-token: ${{ secrets.SONARQUBE_TOKEN }}
|
||||||
|
|
||||||
# - name: Generate Ephemeral .env for Dry Run
|
- name: JSON clean-up for proccessing...
|
||||||
# run: |
|
|
||||||
# echo "${{ secrets.RINOA_ENV }}" > .env
|
|
||||||
|
|
||||||
# - name: Docker Compose Lint
|
|
||||||
# id: docker-compose-lint
|
|
||||||
# uses: https://git.trez.wtf/Trez.One/spin-up-docker-compose-action@v1.3
|
|
||||||
# with:
|
|
||||||
# compose-file: "./docker-compose.yml"
|
|
||||||
# up-flags: --dry-run -d
|
|
||||||
# pull: true
|
|
||||||
# pull-opts: --dry-run
|
|
||||||
# env:
|
|
||||||
# DOCKER_HOST: tcp://dockerproxy:2375
|
|
||||||
|
|
||||||
scan-json-merge-pr:
|
|
||||||
name: Merge PR if checks pass
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: sonarqube-analysis-dry-run
|
|
||||||
steps:
|
|
||||||
- name: Checkout Code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: JSON clean-up for Custom Quality Gate Check...
|
|
||||||
id: json-cleanup
|
id: json-cleanup
|
||||||
env:
|
|
||||||
QG_RESULTS: ${{ needs.sonarqube-analysis-dry-run.outputs.qg_results }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "Cleaning up quality gate response..."
|
echo "Cleaning up quality gate response..."
|
||||||
echo '${QG_RESULTS}' > qg_input.txt
|
echo '${{ steps.quality-gate-check.outputs.quality-gate-result }}' > qg_input.txt
|
||||||
sed -E 's/([a-zA-Z0-9_]+):/\\"\1\\":/g; s/:([^",{}\[\]]+)/:"\1"/g' qg_input.txt > qg_raw.json
|
sed -E 's/([a-zA-Z0-9_]+):/\\"\1\\":/g; s/:([^",{}\[\]]+)/:"\1"/g' qg_input.txt > qg_raw.json
|
||||||
jq -c '.' qg_raw.json > qg_fixed_json.json
|
jq -c '.' qg_raw.json > qg_fixed_json.json
|
||||||
echo "qgfixedjson=$(cat qg_fixed_json.json)" >> $GITHUB_OUTPUT
|
|
||||||
echo "JSON cleanup complete."
|
|
||||||
projstatus=$(jq -r '.projectStatus.status' qg_fixed_json.json)
|
projstatus=$(jq -r '.projectStatus.status' qg_fixed_json.json)
|
||||||
caycStatus=$(jq -r '.projectStatus.caycStatus' qg_fixed_json.json)
|
caycStatus=$(jq -r '.projectStatus.caycStatus' qg_fixed_json.json)
|
||||||
conditions=$(jq -c '.projectStatus.conditions' qg_fixed_json.json)
|
conditions=$(jq -c '.projectStatus.conditions' qg_fixed_json.json)
|
||||||
@@ -126,7 +96,6 @@ jobs:
|
|||||||
echo "caycStatus=${caycStatus}" >> $GITHUB_OUTPUT
|
echo "caycStatus=${caycStatus}" >> $GITHUB_OUTPUT
|
||||||
echo "conditions=${conditions}" >> $GITHUB_OUTPUT
|
echo "conditions=${conditions}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
|
||||||
- name: Convert JSON to Markdown Table
|
- name: Convert JSON to Markdown Table
|
||||||
id: convert-json-to-md
|
id: convert-json-to-md
|
||||||
uses: buildingcash/json-to-markdown-table-action@v1.1.0
|
uses: buildingcash/json-to-markdown-table-action@v1.1.0
|
||||||
@@ -137,8 +106,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
PR_NUMBER: ${{ needs.check-and-create-pr.outputs.pr_number }}
|
PR_NUMBER: ${{ needs.check-and-create-pr.outputs.pr_number }}
|
||||||
SQ_RESULTS: ${{ steps.convert-json-to-md.outputs.table }}
|
SQ_RESULTS: ${{ steps.convert-json-to-md.outputs.table }}
|
||||||
QG_STATUS: ${{ needs.quality-gate.outputs.qg_status }}
|
QG_STATUS: ${{ steps.quality-gate.outputs.quality-gate-status }}
|
||||||
QG_RESULTS: ${{ needs.sonarqube-analysis-dry-run.outputs.qg_results }}
|
|
||||||
RINOA_GITEA_URL: ${{ vars.RINOA_GITEA_URL }}
|
RINOA_GITEA_URL: ${{ vars.RINOA_GITEA_URL }}
|
||||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||||
BOT_GITEA_TOKEN: ${{ secrets.BOT_GITEA_TOKEN }}
|
BOT_GITEA_TOKEN: ${{ secrets.BOT_GITEA_TOKEN }}
|
||||||
@@ -159,19 +127,37 @@ jobs:
|
|||||||
-d "$payload" \
|
-d "$payload" \
|
||||||
"${RINOA_GITEA_URL}/api/v1/repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/reviews")
|
"${RINOA_GITEA_URL}/api/v1/repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/reviews")
|
||||||
|
|
||||||
# - name: Merge PR in Gitea
|
# Job 3: Merge PR if Quality Gate passes
|
||||||
# uses: prasiman/gocurl@v1
|
dry-run-merge-pr:
|
||||||
# with:
|
runs-on: ubuntu-latest
|
||||||
# url: "${{ secrets.GITEA_INSTANCE_URL }}/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls/${{ needs.check-and-create-pr.outputs.pr_index }}"
|
needs: [check-and-create-pr, sonarqube-analysis]
|
||||||
# method: "POST"
|
if: needs.sonarqube-analysis.outputs.quality_gate_status == 'PASSED'
|
||||||
# headers: '{ "Authorization": "token ${{ secrets.GITEA_API_TOKEN }}", "Content-Type": "application/json" }'
|
steps:
|
||||||
# params: >-
|
- name: Checkout Code
|
||||||
# {
|
uses: actions/checkout@v4
|
||||||
# "Do": "merge",
|
|
||||||
# "delete_branch_after_merge": true,
|
- name: Docker Compose Dry Run
|
||||||
# "force_merge": true,
|
uses: s3i7h/spin-up-docker-compose-action@v1.2
|
||||||
# "merge_when_checks_succeed": true
|
with:
|
||||||
# }
|
file: docker-compose.yml
|
||||||
|
pull: true
|
||||||
|
pull-opts: --dry-run
|
||||||
|
up: true
|
||||||
|
up-opts: -d --dry-run
|
||||||
|
|
||||||
# - name: Confirm Merge
|
- name: Merge PR in Gitea
|
||||||
# run: echo "PR has been successfully merged into main."
|
uses: prasiman/gocurl@v1
|
||||||
|
with:
|
||||||
|
url: "${{ secrets.GITEA_INSTANCE_URL }}/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls/${{ needs.check-and-create-pr.outputs.pr_index }}"
|
||||||
|
method: "POST"
|
||||||
|
headers: '{ "Authorization": "token ${{ secrets.GITEA_API_TOKEN }}", "Content-Type": "application/json" }'
|
||||||
|
params: >-
|
||||||
|
{
|
||||||
|
"Do": "merge",
|
||||||
|
"delete_branch_after_merge": true,
|
||||||
|
"force_merge": true,
|
||||||
|
"merge_when_checks_succeed": true
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: Confirm Merge
|
||||||
|
run: echo "PR has been successfully merged into main."
|
||||||
|
|||||||
Reference in New Issue
Block a user