Skip to content

Add early exit to CI workflow until js/css assets are served correctly #7

Add early exit to CI workflow until js/css assets are served correctly

Add early exit to CI workflow until js/css assets are served correctly #7

Workflow file for this run

name: Main - reports to https://staging.app.kosli.com
on:
push:
branches:
- main
env:
KOSLI_DRY_RUN: ${{ vars.KOSLI_DRY_RUN }}
KOSLI_HOST: https://staging.app.kosli.com
KOSLI_ORG: ${{ vars.KOSLI_ORG }}
KOSLI_FLOW: ${{ vars.KOSLI_FLOW }}
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
jobs:
variables:
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.vars.outputs.image_tag }}
kosli_host: ${{ steps.vars.outputs.kosli_host }}
steps:
- name: Prepare
id: vars
run: |
echo "image_tag=$(echo $GITHUB_SHA | head -c7)" >> ${GITHUB_OUTPUT}
echo "kosli_host=${{ env.KOSLI_HOST }}" >> ${GITHUB_OUTPUT}
create-kosli-flow:
uses: ./.github/workflows/sub_create_kosli_flow.yml
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
with:
KOSLI_HOST: ${{ needs.variables.outputs.kosli_host }}
wait-for-image:
needs: [create-kosli-flow]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Wait for image to be built in main.yml
run:
./sh/wait_for_image.sh
- name: Setup Kosli CLI
uses: kosli-dev/setup-cli-action@v2
with:
version: ${{ vars.KOSLI_CLI_VERSION }}
- name: Report image to Kosli flow
run: |
IMAGE_TAG="$(echo $GITHUB_SHA | head -c7)"
IMAGE_NAME=cyberdojo/${{ env.KOSLI_FLOW }}:${IMAGE_TAG}
docker pull ${IMAGE_NAME}
kosli report artifact ${IMAGE_NAME} \
--artifact-type=docker
test:
needs: [variables, wait-for-image]
uses: ./.github/workflows/sub_test.yml
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
KOSLI_HOST: ${{ needs.variables.outputs.kosli_host }}
IMAGE_TAG: ${{ needs.variables.outputs.image_tag }}
sdlc-gate:
needs: [variables, test]
uses: ./.github/workflows/sub_sdlc_gate.yml
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
with:
KOSLI_HOST: ${{ needs.variables.outputs.kosli_host }}
IMAGE_TAG: ${{ needs.variables.outputs.image_tag }}
approve-deployment-to-beta:
needs: [variables, sdlc-gate]
uses: ./.github/workflows/sub_approve_deployment.yml
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
with:
KOSLI_HOST: ${{ needs.variables.outputs.kosli_host }}
KOSLI_ENVIRONMENT: aws-beta
IMAGE_TAG: ${{ needs.variables.outputs.image_tag }}
approve-deployment-to-prod:
needs: [variables, approve-deployment-to-beta]
uses: ./.github/workflows/sub_approve_deployment.yml
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
with:
KOSLI_HOST: ${{ needs.variables.outputs.kosli_host }}
KOSLI_ENVIRONMENT: aws-prod
IMAGE_TAG: ${{ needs.variables.outputs.image_tag }}
push-latest:
needs: [variables, approve-deployment-to-prod]
uses: ./.github/workflows/sub_push_latest.yml
secrets:
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
with:
IMAGE_TAG: ${{ needs.variables.outputs.image_tag }}