DRAFT: add jsonb support #7264
Workflow file for this run
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
# This runs checks to verify if code is properly formated and that tests (unit and integration against a mocked environment) are passing. | |
name: Lint & Test | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '*.md' | |
- '.github/*.md' | |
- '.openapi-generator-ignore' | |
- 'docs/**' | |
- 'pkg/api/openapi/docs/**' | |
- 'pkg/api/openapi/.openapi-generator-ignore' | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
paths-ignore: | |
- '*.md' | |
- '.github/*.md' | |
- '.openapi-generator-ignore' | |
- 'docs/**' | |
- 'pkg/api/openapi/docs/**' | |
- 'pkg/api/openapi/.openapi-generator-ignore' | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: ${{ github.event_name == 'pull_request'}} | |
env: | |
# set ocm env to integration | |
OCM_ENV: integration | |
# GORM env variables. These values are defined in the postgres service definition above | |
GORM_DIALECT: postgres | |
GORM_HOST: 127.0.0.1 | |
GORM_PORT: 5432 | |
GORM_NAME: serviceapitests | |
GORM_USERNAME: kas_fleet_manager | |
GORM_PASSWORD: foobar-bizz-buzz | |
GORM_SSLMODE: disable | |
GORM_DEBUG: false | |
# Dummy MAS SSO variables | |
MAS_SSO_CLIENT_ID: kas-fleet-manager | |
MAS_SSO_CLIENT_SECRET: kas-fleet-manager | |
OSD_IDP_MAS_SSO_CLIENT_ID: kas-fleet-manager | |
OSD_IDP_MAS_SSO_CLIENT_SECRET: kas-fleet-manager | |
# Dummy AWS credentials | |
AWS_ACCOUNT_ID: aws_accountid | |
AWS_ACCESS_KEY: aws_accesskey | |
AWS_SECRET_ACCESS_KEY: aws_secretaccesskey | |
ROUTE53_ACCESS_KEY: aws_route53_access_key | |
ROUTE53_SECRET_ACCESS_KEY: aws_route53_secret_access_key | |
# Dummy Kafka TLS env variables | |
KAFKA_TLS_CERT: kafka_tls_cert | |
KAFKA_TLS_KEY: kafka_tls_key | |
# So that OCM secrets are initialised | |
DOCKER_PR_CHECK: true | |
TEST_TIMEOUT: 30m | |
jobs: | |
lint-test: | |
if: "github.event_name != 'pull_request' || github.event.pull_request.draft == false" | |
name: "Lint & Test" | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:12.13 | |
env: | |
POSTGRES_PASSWORD: foobar-bizz-buzz | |
POSTGRES_USER: kas_fleet_manager | |
POSTGRES_DB: serviceapitests | |
ports: | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
--name kas-fleet-manager-db | |
keycloak: | |
image: quay.io/keycloak/keycloak:17.0.1-legacy | |
env: | |
DB_VENDOR: h2 | |
KEYCLOAK_USER: admin | |
KEYCLOAK_PASSWORD: admin | |
ports: | |
- 8180:8080 | |
options: --health-cmd "curl -f http://localhost:8080/auth/realms/master" --health-interval 40s --health-retries 8 --health-timeout 60s | |
steps: | |
- name: Check out code under the $GITHUB_WORKSPACE directory | |
uses: actions/checkout@v3 | |
- name: Set up Go 1.19.6 | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.19.6" | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
base: main | |
list-files: json | |
filters: | | |
openapi: | |
- 'openapi/*.yaml' | |
- name: Increase Postgres max_connections limit | |
run: docker exec -i kas-fleet-manager-db /bin/bash docker-entrypoint.sh psql -U kas_fleet_manager -d serviceapitests -c 'alter system set max_connections=200;' | |
- name: Restart Postgres container | |
run: docker restart --time 0 kas-fleet-manager-db | |
- name: Setup Keycloak realm config | |
run: make sso/config | |
- name: Run Golang-ci linters | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.51.1 | |
skip-cache: true | |
only-new-issues: false | |
- name: Make sure there is no uncommited autogenerated code | |
run: ./.github/check_for_uncommitted_generated_code.sh | |
# Validate OpenAPI spec only when there are changes to the corresponding files | |
- if: contains(steps.filter.outputs.openapi_files, 'openapi/kas-fleet-manager.yaml') || contains(steps.filter.outputs.openapi_files, 'openapi/kas-fleet-manager-private-admin.yaml') || contains(steps.filter.outputs.openapi_files, 'openapi/connector_mgmt.yaml') | |
name: Validate KAS Fleet Manager OpenAPI changes | |
run: make openapi/spec/validate | |
- name: Run Migration Script | |
run: make db/migrate | |
- name: Setup tests secrets | |
run: | | |
make ocm/setup aws/setup keycloak/setup redhatsso/setup kafkacert/setup | |
- name: Lint & Test | |
run: | | |
export GOPATH=$(go env GOPATH) | |
export PATH=${PATH}:$GOPATH/bin | |
make verify lint/templates binary test test/integration | |
timeout-minutes: 14 | |
- name: Upload unit tests code coverage to codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage.out | |
flags: unittests # optional | |
name: codecov-kas-fleet-manager # optional | |
fail_ci_if_error: true # optional (default = false) | |
verbose: true # optional (default = false) | |
- name: Validate that kas-fleet-manager images can be built successful. | |
if: github.event_name == 'pull_request' | |
run: make image/build | |
- name: Build and publish image to quay.io | |
if: github.event_name == 'push' | |
env: | |
QUAY_USER_NAME: ${{ secrets.QUAY_BF2_USERNAME }} | |
QUAY_USER_PASSWORD: ${{ secrets.QUAY_BF2_PASSWORD }} | |
QUAY_ORG_NAME: "bf2fc6cc711aee1a0c2a82e312df7f2e6b37baa12bd9b1f2fd752e260d93a6f8144ac730947f25caa2bfe6ad0f410da360940ee6d28d6c1688d3822c4055650e" | |
run: | | |
chmod +x ./build_deploy.sh | |
./build_deploy.sh |