diff --git a/.github/workflows/.deploy.yml b/.github/workflows/.deploy.yml deleted file mode 100644 index 885045197..000000000 --- a/.github/workflows/.deploy.yml +++ /dev/null @@ -1,111 +0,0 @@ -name: .Deploys - -on: - workflow_call: - inputs: - ### Required - release: - description: Deployment release; usually PR number, test or prod - required: true - type: string - - ### Typical / recommended - autoscaling: - description: Autoscaling enabled or not for the deployments - required: false - type: string - default: false - build_outputs: - description: Build outputs - required: false - type: string - default: 'true' - environment: - description: Environment name; omit for PRs - required: false - type: string - tag: - description: Container tag; usually PR number - required: false - type: string - default: ${{ github.event.number }} - test: - description: Run tests after deployment? - required: false - type: string - default: "true" - - ### Usually a bad idea / not recommended - directory: - description: 'Chart directory' - default: 'charts/${{ github.event.repository.name }}' - required: false - type: string - timeout-minutes: - description: 'Timeout minutes' - default: 10 - required: false - type: number - values: - description: 'Values file' - default: 'values.yaml' - required: false - type: string - params: - description: 'Extra parameters to pass to helm upgrade' - default: '' - required: false - type: string - -env: - repo_release: ${{ github.event.repository.name }}-${{ inputs.release }} - -jobs: - deploys: - name: Helm - if: ${{ inputs.build_outputs != '' }} - environment: ${{ inputs.environment }} - runs-on: ubuntu-22.04 - timeout-minutes: ${{ inputs.timeout-minutes }} - steps: - - uses: actions/checkout@v4 - - name: Deploy - working-directory: ${{ inputs.directory }} - shell: bash - run: | - oc login --token=${{ secrets.oc_token }} --server=${{ vars.oc_server }} - oc project ${{ vars.OC_NAMESPACE }} # Safeguard! - - # Interrupt any previous jobs (status = pending-upgrade) - PREVIOUS=$(helm status ${{ env.repo_release }} -o json | jq .info.status || true) - if [[ ${PREVIOUS} =~ pending ]]; then - echo "Rollback triggered" - helm rollback ${{ env.repo_release }} || \ - helm uninstall ${{ env.repo_release }} - fi - # Clean previous deployments for PR pipeline, if any - if [[ '${{inputs.environment}}' == '' ]]; then - helm uninstall ${{ env.repo_release }} || true - # Remove Bitnami Postgres PVCs - oc delete pvc data-${{ env.repo_release }}-bitnami-pg-0 || \ - echo "Not found: pvc data-${{ env.repo_release }}-bitnami-pg-0" - fi - # Deploy Helm Chart - helm dependency update - helm package --app-version="${{ inputs.tag }}" --version=${{ inputs.tag }} . - - helm upgrade \ - --set global.autoscaling=${{ inputs.autoscaling }} \ - --set-string global.repository=${{ github.repository }} \ - --set-string global.tag=${{ inputs.tag }} \ - ${{ inputs.params }} \ - --install --wait --atomic ${{ env.repo_release }} \ - --timeout ${{ inputs.timeout-minutes }}m \ - --values ${{ inputs.values }} \ - ./${{ github.event.repository.name }}-${{ inputs.tag }}.tgz - - # print history - helm history ${{ env.repo_release }} - - # Remove old build runs, build pods and deployment pods - oc delete po --field-selector=status.phase==Succeeded