Skip to content

add linter to global and each service folder #11

add linter to global and each service folder

add linter to global and each service folder #11

name: Onboard APIs
on:
push:
branches:
- main
paths-ignore:
- '**/README.md'
jobs:
build-matrix:
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
- id: get-folders
run: echo "folder_matrix=$(find services/* -maxdepth 0 -type d | cut -d"/" -f2 | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
outputs:
folder_matrix: ${{ steps.get-folders.outputs.folder_matrix }}
check-global-configs:
name: Check global kong configs
runs-on: ubuntu-latest
strategy:
matrix:
env: [dev]
include:
- env: dev
ADMIN_API_URL: ${{ secrets.DEV_ADMIN_API_URL }}

Check failure on line 29 in .github/workflows/onboarding_push.yaml

View workflow run for this annotation

GitHub Actions / Onboard APIs

Invalid workflow file

The workflow is not valid. .github/workflows/onboarding_push.yaml (Line: 29, Col: 28): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DEV_ADMIN_API_URL .github/workflows/onboarding_push.yaml (Line: 30, Col: 36): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.DEV_ADMIN_API_AUTH_HEADER
ADMIN_API_AUTH_HEADER: ${{ secrets.DEV_ADMIN_API_AUTH_HEADER }}
env:
DECK_VERSION: ${{ env.DECK_VERSION }}
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Install Deck
run: |
curl -sL https://github.com/Kong/deck/releases/download/v${DECK_VERSION}/deck_${DECK_VERSION}_linux_amd64.tar.gz -o deck.tar.gz
tar -xf deck.tar.gz -C /tmp
sudo cp /tmp/deck /usr/local/bin/
- name: Check Control plane is reachable
run: |
deck gateway ping \
--headers "${{ matrix.ADMIN_API_AUTH_HEADER }}" \
--kong-addr "${{ matrix.ADMIN_API_URL }}" \
- name: Validate Global Plugins
run: |
deck gateway validate \
--headers "${{ matrix.ADMIN_API_AUTH_HEADER }}" \
--kong-addr "${{ matrix.ADMIN_API_URL }}" \
plugin-conf/ \
global-plugins/
- name: Validate Consumers
run: |
deck gateway validate \
--headers "${{ matrix.ADMIN_API_AUTH_HEADER }}" \
--kong-addr "${{ matrix.ADMIN_API_URL }}" \
plugin-conf/ \
consumers/
- name: Check differences for Global Plugins
run: |
deck gateway diff \
--headers "${{ matrix.ADMIN_API_AUTH_HEADER }}" \
--kong-addr "${{ matrix.ADMIN_API_URL }}" \
plugin-conf/ \
global-plugins/
- name: Check differences for Consumers
run: |
deck gateway diff \
--headers "${{ matrix.ADMIN_API_AUTH_HEADER }}" \
--kong-addr "${{ matrix.ADMIN_API_URL }}" \
plugin-conf/ \
consumers/
- name: Sync Global Plugins
run: |
deck gateway sync \
--headers "${{ matrix.ADMIN_API_AUTH_HEADER }}" \
--kong-addr "${{ matrix.ADMIN_API_URL }}" \
plugin-conf/ \
global-plugins/
- name: Sync Consumers
run: |
deck gateway sync \
--headers "${{ matrix.ADMIN_API_AUTH_HEADER }}" \
--kong-addr "${{ matrix.ADMIN_API_URL }}" \
plugin-conf/ \
consumers/
check-services-configs:
needs: build-matrix
name: Check Kong configs
runs-on: ubuntu-latest
strategy:
matrix:
env: [dev]
include:
- env: dev
ADMIN_API_URL: ${{ secrets.DEV_ADMIN_API_URL }}
ADMIN_API_AUTH_HEADER: ${{ secrets.DEV_ADMIN_API_AUTH_HEADER }}
exclude:
- env: dev
folders: acme
- env: dev
folders: catch-all
folders: ${{ fromJson(needs.build-matrix.outputs.folder_matrix) }}
env:
DECK_VERSION: ${{ env.DECK_VERSION }}
DECK_SERVICE_TAG: ${{ matrix.folders }}
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Install Deck
run: |
curl -sL https://github.com/Kong/deck/releases/download/v${DECK_VERSION}/deck_${DECK_VERSION}_linux_amd64.tar.gz -o deck.tar.gz
tar -xf deck.tar.gz -C /tmp
sudo cp /tmp/deck /usr/local/bin/
- name: Check Control plane is reachable
run: |
deck gateway ping \
--headers "${{ matrix.ADMIN_API_AUTH_HEADER }}" \
--kong-addr "${{ matrix.ADMIN_API_URL }}" \
- name: Validate configs
run: |
deck file validate \
--headers "${{ matrix.ADMIN_API_AUTH_HEADER }}" \
--kong-addr "${{ matrix.ADMIN_API_URL }}" \
meta.yaml \
plugin-conf/ \
services/${{ matrix.folders }}/configs.yaml \
services/${{ matrix.folders }}/plugins/
- name: Global lint service and route
run: |
deck file render \
meta.yaml \
services/${{ matrix.folders }}/configs.yaml \
| deck file lint -s - global-linter.yaml
- name: Global lint plugins
run: |
deck file merge \
services/${{ matrix.folders }}/plugins/* \
| deck file lint -s - global-linter.yaml
- name: Check local linter existence
id: check_files
uses: andstor/file-existence-action@v3
with:
files: "services/${{ matrix.folders }}/linter.yaml"
- name: Local lint service and route
if: steps.check_files.outputs.files_exists == 'true'
run: |
deck file render \
meta.yaml \
services/${{ matrix.folders }}/configs.yaml \
| deck file lint -s - services/${{ matrix.folders }}/linter.yaml
- name: Local lint plugins
if: steps.check_files.outputs.files_exists == 'true'
run: |
deck file merge \
services/${{ matrix.folders }}/plugins/* \
| deck file lint -s - services/${{ matrix.folders }}/linter.yaml
- name: Check difference between current and new configs
run: |
deck gateway diff \
--headers "${{ matrix.ADMIN_API_AUTH_HEADER }}" \
--kong-addr "${{ matrix.ADMIN_API_URL }}" \
meta.yaml \
plugin-conf/ \
services/${{ matrix.folders }}/configs.yaml \
services/${{ matrix.folders }}/plugins/
- name: Sync config to upstream
run: |
deck gateway sync \
--headers "${{ matrix.ADMIN_API_AUTH_HEADER }}" \
--kong-addr "${{ matrix.ADMIN_API_URL }}" \
meta.yaml \
plugin-conf/ \
services/${{ matrix.folders }}/configs.yaml \
services/${{ matrix.folders }}/plugins