feat: Initial re-try #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- 'main' | |
paths-ignore: | |
- 'workspaces/**' | |
- 'mesh-demo/**' | |
- '.github/**' | |
jobs: | |
deploy_to_clouds: | |
runs-on: ubuntu-latest | |
name: Deploying Kong Configuration | |
environment: play | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup node | |
uses: actions/[email protected] | |
with: | |
node-version: "12" | |
- name: Install DecK | |
run: | | |
curl -sL https://github.com/kong/deck/releases/download/v1.24.0/deck_1.24.0_linux_amd64.tar.gz -o deck.tar.gz | |
tar -xf deck.tar.gz -C /tmp | |
cp /tmp/deck /usr/local/bin/ | |
- name: Install Insomnia | |
run: | | |
curl -sL https://github.com/Kong/insomnia/releases/download/lib%403.6.0/inso-linux-3.6.0.tar.xz -o inso.tar.xz | |
sudo tar -xf inso.tar.xz -C /tmp/ | |
cp /tmp/inso /usr/local/bin/ | |
- run: inso -w $GITHUB_WORKSPACE export spec blog -o blog.yaml --ci | |
name: Export blog spec | |
- name: Substitute secrets | |
uses: bluwy/substitute-string-action@v1 | |
id: blog-yaml | |
with: | |
_input-file: blog.yaml | |
OIDC_CLIENT_ID: ${{ secrets.OIDC_CLIENT_ID }} | |
OIDC_CLIENT_SECRET: ${{ secrets.OIDC_CLIENT_SECRET }} | |
- name: Output OAS to file | |
run: echo "${{ steps.blog-yaml.outputs.result }}" > blog-new.yaml | |
- name: Generate new gateway configuration | |
run: deck file openapi2kong --spec blog-new.yaml --output-file ./deck/kong-new.yaml | |
- name: Substitute plugin secrets | |
uses: bluwy/substitute-string-action@v1 | |
id: plugins-deck | |
with: | |
_input-file: ./deck/plugins.yaml | |
OIDC_CLIENT_ID: ${{ secrets.OIDC_CLIENT_ID }} | |
OIDC_CLIENT_SECRET: ${{ secrets.OIDC_CLIENT_SECRET }} | |
- name: Output Plugins to file | |
run: echo "${{ steps.plugins-deck.outputs.result }}" > ./deck/plugins.yaml | |
- name: Backup existing configuration | |
run: deck dump --workspace default -o kong-default.yaml --select-tag gitops --tls-skip-verify | |
env: | |
DECK_KONG_ADDR: ${{ secrets.ADMIN_API_URL }} | |
DECK_HEADERS: ${{ secrets.KONG_DECK_HEADERS }} | |
- name: Convert Config | |
run: deck convert --input-file ./deck --from kong-gateway-2.x --to kong-gateway-3.x --output-file kong-new.yaml | |
- name: Apply new configuration | |
run: deck sync --workspace default --select-tag gitops -s kong-new.yaml --tls-skip-verify | |
env: | |
DECK_KONG_ADDR: ${{ secrets.ADMIN_API_URL }} | |
DECK_HEADERS: ${{ secrets.KONG_DECK_HEADERS }} | |
- name: Run API Tests | |
run: | | |
inso -w $GITHUB_WORKSPACE run test -e Development "Policy Guardrails" --ci --disableCertValidation | |
- name: Back out changes on failure | |
if: ${{ failure() }} | |
run: deck sync --workspace default -s kong-default.yaml --select-tag gitops --tls-skip-verify | |
env: | |
DECK_KONG_ADDR: ${{ secrets.ADMIN_API_URL }} | |
DECK_HEADERS: ${{ secrets.KONG_DECK_HEADERS }} | |