diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index 4b5bdc9..e21c769 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -54,71 +54,6 @@ jobs: uses: mikefarah/yq@v4.30.8 with: cmd: yq ".schemaVersion" ${{ inputs.configurationFilepath }} - # Deprecated - deployment_legacy: - runs-on: ${{ inputs.runner }} - needs: [read_schema_version] - if: needs.read_schema_version.outputs.version != 'v2' - steps: - - name: Checkout current git repository - uses: actions/checkout@v3 - - name: Load plconfig deployment values - id: deployment-yaml - uses: mikefarah/yq@v4.30.8 - with: - cmd: yq -o json -I 0 '.deployment' ${{ inputs.configurationFilepath }} - - name: Load k8s deployment variables - id: k8s - run: | - # shellcheck disable=SC2129,SC2086 - echo "namespace=${{ fromJSON(steps.deployment-yaml.outputs.result).namespace }}" >> $GITHUB_OUTPUT - # shellcheck disable=SC2086 - echo "chart=${{ fromJSON(steps.deployment-yaml.outputs.result).chart }}" >> $GITHUB_OUTPUT - # shellcheck disable=SC2086 - echo "containerContextPath=${{ fromJSON(steps.deployment-yaml.outputs.result).container.contextPath || '.' }}" >> $GITHUB_OUTPUT - # shellcheck disable=SC2086 - echo "containerFile=${{ fromJSON(steps.deployment-yaml.outputs.result).container.file || 'Containerfile' }}" >> $GITHUB_OUTPUT - if [[ "${{ inputs.env }}" == 'prod' ]] - then - URL="${{ fromJSON(steps.deployment-yaml.outputs.result).urls.prod[0] }}" - STATUS_URL="${{ fromJSON(steps.deployment-yaml.outputs.result).status_url.prod }}" - elif [[ "${{ inputs.env }}" == 'staging' ]] - then - URL="${{ fromJSON(steps.deployment-yaml.outputs.result).urls.staging[0] }}" - STATUS_URL="${{ fromJSON(steps.deployment-yaml.outputs.result).status_url.staging }}" - else - URL="${{ fromJSON(steps.deployment-yaml.outputs.result).urls.test[0] }}" - STATUS_URL="${{ fromJSON(steps.deployment-yaml.outputs.result).status_url.test }}" - fi - # shellcheck disable=SC2086 - echo "url=$URL" >> $GITHUB_OUTPUT - # shellcheck disable=SC2086 - echo "status-url=$STATUS_URL" >> $GITHUB_OUTPUT - - name: Create Github ${{ fromJSON(steps.deployment-yaml.outputs.result).name }} k8s deployment - uses: chrnorm/deployment-action@v2 - with: - auto-merge: false - environment: ${{ inputs.env }} - ref: ${{ inputs.ref }} - required-contexts: "" - payload: | - { - "author": ${{ toJSON(inputs.author) }}, - "chart": ${{ toJSON(steps.k8s.outputs.chart) }}, - "container": { - "context": ${{ toJSON(steps.k8s.outputs.containerContextPath) }}, - "file": ${{ toJSON(steps.k8s.outputs.containerFile) }} - }, - "description": ${{ toJSON(inputs.description) }}, - "env": ${{ toJSON(inputs.env) }}, - "name": ${{ toJSON(fromJSON(steps.deployment-yaml.outputs.result).name) }}, - "namespace": ${{ toJSON(steps.k8s.outputs.namespace) }}, - "statusUrl": ${{ toJSON(steps.k8s.outputs.status-url) }}, - "url": ${{ toJSON(steps.k8s.outputs.url) }} - } - production-environment: "${{ inputs.env == 'prod' }}" - transient-environment: "${{ inputs.env == 'test' }}" - token: ${{ secrets.repoAccessToken }} detect_declarations: runs-on: ${{ inputs.runner }} needs: [read_schema_version] diff --git a/.github/workflows/kubernetes.yaml b/.github/workflows/kubernetes.yaml index c7c90ef..76051a0 100644 --- a/.github/workflows/kubernetes.yaml +++ b/.github/workflows/kubernetes.yaml @@ -205,12 +205,6 @@ jobs: path: remote token: ${{ secrets.repoAccessToken }} ref: main - # Legacy - - if: github.event.deployment.payload.schemaVersion != 'v2' - name: Update ${{ github.event.deployment.payload.name }} version for ${{ github.event.deployment.environment }} values - uses: mikefarah/yq@v4.30.8 - with: - cmd: yq '(.${{ github.event.deployment.payload.chart }}.image.tag = "${{ needs.initialize.outputs.version }}")' -i remote/${{ inputs.deploymentRepoPath }}/${{ github.event.deployment.payload.namespace }}/${{ github.event.deployment.payload.env }}/${{ github.event.deployment.payload.name }}/${{ inputs.versionFilePath }} - if: github.event.deployment.payload.schemaVersion == 'v2' && github.event.deployment.payload.env != 'playground' name: Update ${{ github.event.deployment.payload.name }} version for ${{ github.event.deployment.environment }} values uses: mikefarah/yq@v4.30.8 diff --git a/.github/workflows/plconfig.yaml b/.github/workflows/plconfig.yaml index db6e07e..4378c7f 100644 --- a/.github/workflows/plconfig.yaml +++ b/.github/workflows/plconfig.yaml @@ -49,67 +49,6 @@ jobs: uses: mikefarah/yq@v4.30.8 with: cmd: yq ".schemaVersion" ${{ inputs.configurationFilepath }} - plconfig_legacy: - if: needs.read_schema_version.outputs.version != 'v2' - runs-on: ${{ inputs.runner }} - needs: [read_schema_version] - steps: - - name: Checkout current git repository - uses: actions/checkout@v3 - - name: Load name - id: name - uses: mikefarah/yq@v4.30.8 - with: - cmd: yq ".deployment.name" ${{ inputs.configurationFilepath }} - - name: Load namespace - id: namespace - uses: mikefarah/yq@v4.30.8 - with: - cmd: yq ".deployment.namespace" ${{ inputs.configurationFilepath }} - - name: Load chart - id: chart - uses: mikefarah/yq@v4.30.8 - with: - cmd: yq ".deployment.chart" ${{ inputs.configurationFilepath }} - - name: Checkout ${{ inputs.deploymentRepoURL }} git repository - uses: actions/checkout@v3 - with: - repository: ${{ inputs.deploymentRepoURL }} - path: remote - token: ${{ secrets.repoAccessToken }} - ref: main - - name: Load vars - id: vars - run: | - # shellcheck disable=SC2086 - echo "namespace-path=remote/${{ inputs.deploymentRepoPath }}/${{ steps.namespace.outputs.result }}" >> $GITHUB_OUTPUT - # shellcheck disable=SC2086 - echo "do-not-edit=DO NOT EDIT. Auto generated from ${{ steps.name.outputs.result }} ${{ inputs.configurationFilepath }} (replaces values.yaml instead)" >> $GITHUB_OUTPUT - # Load plconfig values scoping to a subchart - - name: Load external values for all environments - uses: mikefarah/yq@v4.30.8 - with: - cmd: >- - $(yq '.deployment.values | has("dev")' ${{ inputs.configurationFilepath }}) == 'true' && yq '{ "${{ steps.chart.outputs.result }}": .deployment.values.dev } | . head_comment="${{ steps.vars.outputs.do-not-edit }}"' ${{ inputs.configurationFilepath }} > ${{ steps.vars.outputs.namespace-path }}/dev/${{ steps.name.outputs.result }}/values-external.yaml || - $(yq '.deployment.values | has("prod")' ${{ inputs.configurationFilepath }}) == 'true' && yq '{ "${{ steps.chart.outputs.result }}": .deployment.values.prod } | . head_comment="${{ steps.vars.outputs.do-not-edit }}"' ${{ inputs.configurationFilepath }} > ${{ steps.vars.outputs.namespace-path }}/prod/${{ steps.name.outputs.result }}/values-external.yaml || - $(yq '.deployment.values | has("staging")' ${{ inputs.configurationFilepath }}) == 'true' && yq '{ "${{ steps.chart.outputs.result }}": .deployment.values.staging } | . head_comment="${{ steps.vars.outputs.do-not-edit }}"' ${{ inputs.configurationFilepath }} > ${{ steps.vars.outputs.namespace-path }}/staging/${{ steps.name.outputs.result }}/values-external.yaml || - $(yq '.deployment.values | has("test")' ${{ inputs.configurationFilepath }}) == 'true' && yq '{ "${{ steps.chart.outputs.result }}": .deployment.values.test } | . head_comment="${{ steps.vars.outputs.do-not-edit }}"' ${{ inputs.configurationFilepath }} > ${{ steps.vars.outputs.namespace-path }}/test/${{ steps.name.outputs.result }}/values-external.yaml || true - # Commit & Push - - name: Commit deployment files - run: | - cd remote - git config --global user.email "${{ inputs.botEmail }}" - git config --global user.name "${{ inputs.botName }}" - git add . - git commit --allow-empty -m "chore(${{ steps.name.outputs.result }}): set parcelLab config values" - - name: Push changes to main in ${{ inputs.deploymentRepoURL }} git repository - uses: ad-m/github-push-action@0fafdd62b84042d49ec0cb92d9cac7f7ce4ec79e - with: - repository: ${{ inputs.deploymentRepoURL }} - directory: remote - github_token: ${{ secrets.repoAccessToken }} - branch: main - force: true detect_declarations: if: needs.read_schema_version.outputs.version == 'v2' runs-on: ${{ inputs.runner }}