-
Notifications
You must be signed in to change notification settings - Fork 941
135 lines (129 loc) · 4.4 KB
/
test-feature-branch.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: test-feature-branch
on:
workflow_dispatch:
inputs:
octi_config:
type: string
default: '{}'
required: false
upgrade_from_58:
description: Whether to upgrade from 5.8
type: boolean
required: false
default: false
redis_cluster:
description: Redis cluster (sentinel) ?
type: boolean
required: false
default: false
jobs:
worker:
name: worker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: filigran/worker
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: opencti-worker
file: opencti-worker/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platform:
name: platform
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jirutka/setup-alpine@v1
with:
branch: v3.20
packages: >
nodejs npm git tini gcc g++ make musl-dev cargo python3 py3-pip python3-dev postfix postfix-pcre
- name: Setup Node.js & python
run: |
npm install -g node-gyp yarn
python -V
shell: alpine.sh --root {0}
- name: Build into Alpine
run: |
python3 -m venv .venv
source .venv/bin/activate
cd opencti-platform/opencti-front
yarn install
yarn build
cd ../opencti-graphql
yarn install
yarn build
shell: alpine.sh {0}
- run: mkdir -p opencti/{dependencies,src/python}
- run: cp -a ./opencti-platform/opencti-graphql/{config,build,static,public} opencti/
- run: cp ./opencti-platform/opencti-graphql/src/python/requirements.txt opencti/dependencies/
- run: cp -a ./opencti-platform/opencti-graphql/src/python/runtime opencti/src/python/
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: filigran/platform
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: opencti-platform/Dockerfile_ga
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy:
name: deploy
needs: [platform, worker]
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: filigran/platform
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- run: if [ "${{ inputs.upgrade_from_58 }}" == "true" ]; then ID=21; else ID=20; fi; echo "AWX_TPL_ID=$ID" >> "$GITHUB_ENV"
- name: deploy via awx
uses: certara/github-action-ansible-tower-awx@master
with:
ansible-tower-user: ${{ secrets.AWX_USER }}
ansible-tower-pass: ${{ secrets.AWX_PASSWORD }}
ansible-tower-url: ${{ secrets.AWX_URL }}
template-id: "${{ env.AWX_TPL_ID }}"
additional-vars: |
{ "octi_version": "${{steps.meta.outputs.version}}", "octi_config": ${{ inputs.octi_config }}, "redis_cluster": ${{ inputs.redis_cluster }} }
- name: display URL
run: echo "https://${{steps.meta.outputs.version}}.octi.dev.filigran.io"