From a5b2c9f6df603369670fc144d38c7de5a5cd6e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20W=C3=BCrbach?= Date: Fri, 26 Apr 2024 08:55:17 +0200 Subject: [PATCH] chore: validate score files in ci --- .github/workflows/ci.yaml | 32 ++++++++++++++++++- .github/workflows/deploy.yaml | 2 +- .../content/.github/workflows/close_pr.yaml | 2 +- .../content/.github/workflows/deploy.yaml | 2 +- .../.github/workflows/pull_request.yaml | 2 +- .../content/.github/workflows/close_pr.yaml | 2 +- .../content/.github/workflows/deploy.yaml | 2 +- .../.github/workflows/pull_request.yaml | 2 +- 8 files changed, 38 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f17f55c..8d31fb2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,7 +5,7 @@ on: pull_request: branches: [main] jobs: - job: + containers: runs-on: ubuntu-latest steps: - name: checkout code @@ -20,3 +20,33 @@ jobs: run: | mkdir credentials && touch credentials/github-app-backstage-humanitec-credentials.yaml docker image build -t backstage:latest . + + validate-score: + runs-on: ubuntu-latest + env: + HUMCTL_VERSION: '0.23.1' + steps: + - name: checkout code + uses: actions/checkout@v3 + - uses: humanitec/setup-cli-action@v1 + with: + version: ${{ env.HUMCTL_VERSION }} + - name: humctl score validate - backstage + run: | + humctl score validate --local --strict \ + score.yaml + - name: humctl score validate - node-service + run: | + score_file=templates/node-service/content/score.yaml + # Replace template string with actual values, sadly no better way yet + # https://github.com/backstage/backstage/issues/13668 + sed -i -e 's/${{ '${{ values.name | dump }}' }}/test-workload/g' "$score_file" + humctl score validate --local --strict \ + "$score_file" + - name: humctl score validate - podinfo + run: | + score_file=templates/podinfo-example/content/score.yaml + # Replace template string with actual values + sed -i -e 's/${{ '${{ values.name | dump }}' }}/test-workload/g' "$score_file" + humctl score validate --local --strict \ + "$score_file" diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index c976d6f..152e557 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -8,7 +8,7 @@ concurrency: ${{ github.ref }} env: IMAGE: backstage - HUMCTL_VERSION: '0.21.0' + HUMCTL_VERSION: '0.23.1' # CLOUD_PROVIDER: aws AWS_REGION: ${{ vars.AWS_REGION }} AWS_ROLE_ARN: ${{ vars.AWS_ROLE_ARN }} diff --git a/templates/node-service/content/.github/workflows/close_pr.yaml b/templates/node-service/content/.github/workflows/close_pr.yaml index c777a5a..267b842 100644 --- a/templates/node-service/content/.github/workflows/close_pr.yaml +++ b/templates/node-service/content/.github/workflows/close_pr.yaml @@ -7,7 +7,7 @@ on: env: APP_NAME: ${{ values.name }} ENVIRONMENT_ID: {% raw %}pr-${{ github.event.number }}{% endraw %} - HUMCTL_VERSION: '0.21.0' + HUMCTL_VERSION: '0.23.1' {% raw %} jobs: diff --git a/templates/node-service/content/.github/workflows/deploy.yaml b/templates/node-service/content/.github/workflows/deploy.yaml index 8908e62..9697acb 100644 --- a/templates/node-service/content/.github/workflows/deploy.yaml +++ b/templates/node-service/content/.github/workflows/deploy.yaml @@ -32,7 +32,7 @@ env: {%- else -%} # Unknown cloud provider: ${{ values.cloudProvider }} {% endif %} - HUMCTL_VERSION: '0.21.0' + HUMCTL_VERSION: '0.23.1' APP_NAME: ${{ values.name }} {% raw %} diff --git a/templates/node-service/content/.github/workflows/pull_request.yaml b/templates/node-service/content/.github/workflows/pull_request.yaml index 6a56902..2097a8f 100644 --- a/templates/node-service/content/.github/workflows/pull_request.yaml +++ b/templates/node-service/content/.github/workflows/pull_request.yaml @@ -32,7 +32,7 @@ env: {% endif %} BASE_ENVIRONMENT: 'development' ENVIRONMENT_TYPE: 'development' - HUMCTL_VERSION: '0.21.0' + HUMCTL_VERSION: '0.23.1' ENVIRONMENT_ID: {% raw %}pr-${{ github.event.number }}{% endraw %} ENVIRONMENT_NAME: {% raw %}PR-${{ github.event.number }}{% endraw %} diff --git a/templates/podinfo-example/content/.github/workflows/close_pr.yaml b/templates/podinfo-example/content/.github/workflows/close_pr.yaml index c777a5a..267b842 100644 --- a/templates/podinfo-example/content/.github/workflows/close_pr.yaml +++ b/templates/podinfo-example/content/.github/workflows/close_pr.yaml @@ -7,7 +7,7 @@ on: env: APP_NAME: ${{ values.name }} ENVIRONMENT_ID: {% raw %}pr-${{ github.event.number }}{% endraw %} - HUMCTL_VERSION: '0.21.0' + HUMCTL_VERSION: '0.23.1' {% raw %} jobs: diff --git a/templates/podinfo-example/content/.github/workflows/deploy.yaml b/templates/podinfo-example/content/.github/workflows/deploy.yaml index 8908e62..9697acb 100644 --- a/templates/podinfo-example/content/.github/workflows/deploy.yaml +++ b/templates/podinfo-example/content/.github/workflows/deploy.yaml @@ -32,7 +32,7 @@ env: {%- else -%} # Unknown cloud provider: ${{ values.cloudProvider }} {% endif %} - HUMCTL_VERSION: '0.21.0' + HUMCTL_VERSION: '0.23.1' APP_NAME: ${{ values.name }} {% raw %} diff --git a/templates/podinfo-example/content/.github/workflows/pull_request.yaml b/templates/podinfo-example/content/.github/workflows/pull_request.yaml index 6a56902..2097a8f 100644 --- a/templates/podinfo-example/content/.github/workflows/pull_request.yaml +++ b/templates/podinfo-example/content/.github/workflows/pull_request.yaml @@ -32,7 +32,7 @@ env: {% endif %} BASE_ENVIRONMENT: 'development' ENVIRONMENT_TYPE: 'development' - HUMCTL_VERSION: '0.21.0' + HUMCTL_VERSION: '0.23.1' ENVIRONMENT_ID: {% raw %}pr-${{ github.event.number }}{% endraw %} ENVIRONMENT_NAME: {% raw %}PR-${{ github.event.number }}{% endraw %}