-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (101 loc) · 4.34 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Main - reports to https://app.kosli.com
on:
push:
branches:
- main
env:
KOSLI_DRY_RUN: "False" # "True"
KOSLI_CLI_VERSION: "2.6.12"
KOSLI_HOST: "https://app.kosli.com"
KOSLI_ORG: cyber-dojo
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
KOSLI_FLOW: shas
jobs:
setup-ci-vars:
runs-on: ubuntu-latest
outputs:
kosli_dry_run: ${{ steps.ci_vars.outputs.kosli_dry_run }}
kosli_cli_version: ${{ steps.ci_vars.outputs.kosli_cli_version }}
kosli_host: ${{ steps.ci_vars.outputs.kosli_host }}
kosli_org: ${{ steps.ci_vars.outputs.kosli_org }}
kosli_flow: ${{ steps.ci_vars.outputs.kosli_flow }}
image_tag: ${{ steps.ci_vars.outputs.image_tag }}
steps:
- uses: actions/checkout@v3
- name: Prepare
id: ci_vars
run: |
echo "kosli_dry_run=${{ env.KOSLI_DRY_RUN }}" >> ${GITHUB_OUTPUT}
echo "kosli_cli_version=${{ env.KOSLI_CLI_VERSION }}" >> ${GITHUB_OUTPUT}
echo "kosli_host=${{ env.KOSLI_HOST }}" >> ${GITHUB_OUTPUT}
echo "kosli_org=${{ env.KOSLI_ORG }}" >> ${GITHUB_OUTPUT}
echo "kosli_flow=${{ env.KOSLI_FLOW }}" >> ${GITHUB_OUTPUT}
echo "image_tag=$(echo $GITHUB_SHA | head -c7)" >> ${GITHUB_OUTPUT}
create-kosli-flow:
runs-on: ubuntu-latest
steps:
- name: Setup Kosli CLI
uses: kosli-dev/setup-cli-action@v2
with:
version: ${{ env.KOSLI_CLI_VERSION }}
- name: Create Kosli flow
run:
kosli create flow ${{ env.KOSLI_FLOW }}
--description="UX for git+image shas"
--template=artifact,branch-coverage,snyk-scan
build-image:
needs: [setup-ci-vars, create-kosli-flow]
uses: cyber-dojo/shas/.github/workflows/sub_build_image.yml@main
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
with:
KOSLI_DRY_RUN: ${{ needs.setup-ci-vars.outputs.kosli_dry_run }}
KOSLI_CLI_VERSION: ${{ needs.setup-ci-vars.outputs.kosli_cli_version }}
KOSLI_HOST: ${{ needs.setup-ci-vars.outputs.kosli_host }}
KOSLI_ORG: ${{ needs.setup-ci-vars.outputs.kosli_org }}
KOSLI_FLOW: ${{ needs.setup-ci-vars.outputs.kosli_flow }}
IMAGE_TAG: ${{ needs.setup-ci-vars.outputs.image_tag }}
test:
needs: [setup-ci-vars, build-image]
uses: cyber-dojo/shas/.github/workflows/sub_test.yml@main
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
KOSLI_DRY_RUN: ${{ needs.setup-ci-vars.outputs.kosli_dry_run }}
KOSLI_CLI_VERSION: ${{ needs.setup-ci-vars.outputs.kosli_cli_version }}
KOSLI_HOST: ${{ needs.setup-ci-vars.outputs.kosli_host }}
KOSLI_ORG: ${{ needs.setup-ci-vars.outputs.kosli_org }}
KOSLI_FLOW: ${{ needs.setup-ci-vars.outputs.kosli_flow }}
IMAGE_TAG: ${{ needs.setup-ci-vars.outputs.image_tag }}
sdlc-gate:
needs: [setup-ci-vars, test]
uses: cyber-dojo/shas/.github/workflows/sub_sdlc_gate.yml@main
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
with:
KOSLI_DRY_RUN: ${{ needs.setup-ci-vars.outputs.kosli_dry_run }}
KOSLI_CLI_VERSION: ${{ needs.setup-ci-vars.outputs.kosli_cli_version }}
KOSLI_HOST: ${{ needs.setup-ci-vars.outputs.kosli_host }}
KOSLI_ORG: ${{ needs.setup-ci-vars.outputs.kosli_org }}
KOSLI_FLOW: ${{ needs.setup-ci-vars.outputs.kosli_flow }}
IMAGE_TAG: ${{ needs.setup-ci-vars.outputs.image_tag }}
expect-deployment:
needs: [setup-ci-vars, sdlc-gate]
uses: cyber-dojo/shas/.github/workflows/sub_expect_deployment.yml@main
secrets:
KOSLI_API_TOKEN: ${{ secrets.KOSLI_API_TOKEN }}
with:
KOSLI_DRY_RUN: ${{ needs.setup-ci-vars.outputs.kosli_dry_run }}
KOSLI_CLI_VERSION: ${{ needs.setup-ci-vars.outputs.kosli_cli_version }}
KOSLI_HOST: ${{ needs.setup-ci-vars.outputs.kosli_host }}
KOSLI_ORG: ${{ needs.setup-ci-vars.outputs.kosli_org }}
KOSLI_FLOW: ${{ needs.setup-ci-vars.outputs.kosli_flow }}
IMAGE_TAG: ${{ needs.setup-ci-vars.outputs.image_tag }}
deploy:
needs: [setup-ci-vars, sdlc-gate]
uses: cyber-dojo/shas/.github/workflows/sub_deploy.yml@main
with:
IMAGE_TAG: ${{ needs.setup-ci-vars.outputs.image_tag }}