From e9e37a6f3b4d670ccc475f9d049386bbc44e401e Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 10 Dec 2024 09:18:52 +0100 Subject: [PATCH] Diff between Active Resources in PR (#160) * Add redis and change message * Update open-pr.yml - Active Resources diff * Update open-pr.yml - .status.resource * Update open-pr.yml - diff || true * Update open-pr.yml - Fix diff || true * Update score.yaml --- .github/workflows/open-pr.yml | 23 +++++++++++++++++++++++ score/score.yaml | 2 ++ 2 files changed, 25 insertions(+) diff --git a/.github/workflows/open-pr.yml b/.github/workflows/open-pr.yml index 6be8a42..d54de3b 100644 --- a/.github/workflows/open-pr.yml +++ b/.github/workflows/open-pr.yml @@ -266,6 +266,29 @@ jobs: echo "" >> pr_message.txt fi + echo "
Active Resources diff" >> pr_message.txt + echo "" >> pr_message.txt + echo "### Active Resources diff:" >> pr_message.txt + echo '```json' >> pr_message.txt + echo "" >> pr_message.txt + humctl get active-resource \ + --env ${{ env.ENVIRONMENT_ID }} \ + --token ${{ secrets.HUMANITEC_TOKEN }} \ + --org ${{ secrets.HUMANITEC_ORG }} \ + --app ${{ vars.APP_NAME }} \ + -o json | jq '.[] | [.metadata.type, .metadata.res_id, .status.class, .status.driver_type, .status.def_id, .status.resource]' > res-usage-${{ env.ENVIRONMENT_ID }}.txt + humctl get active-resource \ + --env ${{ env.BASE_ENVIRONMENT }} \ + --token ${{ secrets.HUMANITEC_TOKEN }} \ + --org ${{ secrets.HUMANITEC_ORG }} \ + --app ${{ vars.APP_NAME }} \ + -o json | jq '.[] | [.metadata.type, .metadata.res_id, .status.class, .status.driver_type, .status.def_id, .status.resource]' > res-usage-${{ env.BASE_ENVIRONMENT }}.txt + diff res-usage-${{ env.BASE_ENVIRONMENT }}.txt res-usage-${{ env.ENVIRONMENT_ID }}.txt >> pr_message.txt || true + echo "" >> pr_message.txt + echo '```' >> pr_message.txt + echo "" >> pr_message.txt + echo "
" >> pr_message.txt + if [ "$DEPLOYMENT_ERRORS" = "[]" ]; then echo "
Resources Graph" >> pr_message.txt echo "" >> pr_message.txt diff --git a/score/score.yaml b/score/score.yaml index bbb98b3..9bc5da2 100644 --- a/score/score.yaml +++ b/score/score.yaml @@ -14,6 +14,8 @@ containers: variables: MESSAGE: "Hello, World!" resources: + my-redis: + type: redis dns: type: dns route: