Skip to content

Return Status 400 Bad Request when AI provider config request payload validation fails #3137

Return Status 400 Bad Request when AI provider config request payload validation fails

Return Status 400 Bad Request when AI provider config request payload validation fails #3137

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
install:
name: Install Dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lookup node_modules cache
id: node-modules-cache
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-cache-${{ hashFiles('package-lock.json', '.npmrc') }}
lookup-only: true
save-always: true
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: npm ci --no-audit --no-fund
lint:
name: Lint
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Restore node_modules cache
id: node-modules-cache
uses: actions/cache/restore@v4
with:
path: node_modules
key: node-modules-cache-${{ hashFiles('package-lock.json', '.npmrc') }}
- name: Restore NX cache
uses: actions/cache@v4
with:
path: .nx/cache
key: nx-lint-${{ github.sha }}
restore-keys: nx-lint-
- name: Lint
if: steps.nx-lint-cache.outputs.cache-hit != 'true'
env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
run: |
npx nx run-many --target=lint --quiet
- name: Truncate NX cache
run: ./tools/truncate-nx-cache.sh
check-licenses:
name: Check Licenses
needs: install
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Restore node_modules cache
id: node-modules-cache
uses: actions/cache/restore@v4
with:
path: node_modules
key: node-modules-cache-${{ hashFiles('package-lock.json', '.npmrc') }}
fail-on-cache-miss: true
- name: Check licenses
run: |
npm run license-check
if ! git diff --exit-code THIRD_PARTY_LICENSES.txt; then
echo "Please update THIRD_PARTY_LICENSES.txt by running 'npm run license-check'" >> $GITHUB_STEP_SUMMARY
exit 1
fi
- name: Commit changes for dependabot
if: failure() && startsWith(github.head_ref, 'dependabot/')
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update THIRD_PARTY_LICENSES.txt
test:
strategy:
matrix:
test-suits:
- name: UI
include: ui-*,*-ui
- name: Blocks
include: blocks-*
- name: Server API
key: server-api
include: server-api
- name: Engine and Libraries
key: others
exclude: ui-*,*-ui,blocks-*,server-api
name: Test ${{ matrix.test-suits.name }}
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Restore node_modules cache
id: node-modules-cache
uses: actions/cache/restore@v4
with:
path: node_modules
key: node-modules-cache-${{ hashFiles('package-lock.json', '.npmrc') }}
- name: Restore NX cache
uses: actions/cache@v4
with:
path: .nx/cache
key: nx-test-${{ matrix.test-suits.key || matrix.test-suits.name }}-${{ github.sha }}
restore-keys: nx-test-${{ matrix.test-suits.key || matrix.test-suits.name }}-
save-always: true
- name: Test
if: steps.nx-test-cache.outputs.cache-hit != 'true'
continue-on-error: false
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
retry_on: error
command: npx nx run-many --target test --projects "${{ matrix.test-suits.include }}" --exclude "${{ matrix.test-suits.exclude }}" --quiet
env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
- name: Truncate NX cache
run: ./tools/truncate-nx-cache.sh
build:
name: Build Project
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Restore node_modules cache
id: node-modules-cache
uses: actions/cache/restore@v4
with:
path: node_modules
key: node-modules-cache-${{ hashFiles('package-lock.json', '.npmrc') }}
- name: Restore NX cache
uses: actions/cache@v4
with:
path: .nx/cache
key: nx-build-${{ github.sha }}
restore-keys: nx-build-
- name: Build project
env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
run: |
npm run prepare
npx nx run-many --target=build
./tools/truncate-nx-cache.sh
- name: Save build cache
uses: actions/cache/save@v4
with:
path: dist
key: dist-${{ github.sha }}
build-images:
strategy:
matrix:
target:
- name: App
file: Dockerfile
repository: openops-app
- name: Engine
file: engine.Dockerfile
repository: openops-engine
name: Build ${{ matrix.target.name }} Image
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Restore build cache
uses: actions/cache/restore@v4
with:
path: dist
key: dist-${{ github.sha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS credentials
if: vars.ECR_REGION
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ECR_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.ECR_REGION }}
- name: Login to Amazon ECR
id: login-ecr
if: vars.ECR_REGION
uses: aws-actions/amazon-ecr-login@v2
- name: Format image tag parts
env:
BRANCH: ${{ github.ref_name }}
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
echo SANITIZED_BRANCH=${BRANCH//[\/.:_]/-} >> "$GITHUB_ENV"
echo REPOSITORY_URI=${REGISTRY}/openops/${{ matrix.target.repository }} >> "$GITHUB_ENV"
echo SHORT_SHA=${SHA::8} >> "$GITHUB_ENV"
- name: Build image
if: vars.ECR_REGION
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ matrix.target.file }}
build-args: VERSION=${{ env.SHORT_SHA }}
platforms: linux/amd64,linux/arm64
provenance: false
push: true
tags: |
${{ env.REPOSITORY_URI }}:${{ env.SHORT_SHA }}
${{ env.REPOSITORY_URI }}:${{ env.SANITIZED_BRANCH }}-${{ env.SHORT_SHA }}
${{ env.REPOSITORY_URI }}:${{ env.SANITIZED_BRANCH }}
cache-from: |
type=registry,ref=${{ env.REPOSITORY_URI }}:${{ env.SANITIZED_BRANCH }}-cache
type=registry,ref=${{ env.REPOSITORY_URI }}:main-cache
cache-to: mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=${{ env.REPOSITORY_URI }}:${{ env.SANITIZED_BRANCH }}-cache
- name: Push single-arch manifest for the engine
if: vars.ECR_REGION && matrix.target.name == 'Engine'
env:
SHA_TAG: ${{ env.REPOSITORY_URI }}:${{ env.SHORT_SHA }}
BRANCH_TAG: ${{ env.REPOSITORY_URI }}:${{ env.SANITIZED_BRANCH }}
run: |
docker pull $SHA_TAG
docker tag $SHA_TAG ${SHA_TAG}-amd64 && docker push ${SHA_TAG}-amd64
docker tag $SHA_TAG ${BRANCH_TAG}-amd64 && docker push ${BRANCH_TAG}-amd64
- name: Build image
if: ${{ !vars.ECR_REGION }}
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ matrix.target.file }}
build-args: VERSION=${{ env.SHORT_SHA }}
provenance: false
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max