-
Notifications
You must be signed in to change notification settings - Fork 1.3k
56 lines (52 loc) · 1.92 KB
/
test-feature-branch.yml
File metadata and controls
56 lines (52 loc) · 1.92 KB
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
name: Deploy feature branch on staging
on:
workflow_dispatch:
inputs:
octi_config:
description: Env var to use in front deployment
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:
wf-build-image:
name: Build image
uses: ./.github/workflows/ci-docker-build.yml
with:
image_tag: ${{ github.ref_name }}
publish_to_registry: true
secrets: inherit
deploy:
name: deploy
needs: wf-build-image
runs-on: ubuntu-latest
steps:
- run: if [ "${{ inputs.upgrade_from_58 }}" == "true" ]; then ID=67; else ID=66; fi; echo "AWX_TPL_ID=$ID" >> "$GITHUB_ENV"
- name: Install AWX cli
run: pip install awxkit
- name: Deploy feature environment via AWX
run: |
awx --conf.host ${{ secrets.AWX_URL }} \
--conf.username ${{ secrets.AWX_USER }} \
--conf.password ${{ secrets.AWX_PASSWORD }} \
job_templates launch 'Deploy OpenCTI feature branch for testing' \
--wait \
--inventory eu-west-staging \
--extra_vars '{"octi_version":"${{ needs.wf-build-image.outputs.image-tag-version-cleaned }}","octi_config": ${{ inputs.octi_config }},"redis_cluster": ${{ inputs.redis_cluster }} }' \
-f human
- name: Forge URL to match playbook limitations
id: urlforge
run: |
url=$(echo "${{ needs.wf-build-image.outputs.image-tag-version-cleaned }}" | cut -c 1-15 | sed 's/[_.]/-/g' | sed 's/-*$//')
echo "url=$url" >> $GITHUB_OUTPUT
- name: display URL
run: echo "https://feat-${{steps.urlforge.outputs.url}}.octi.staging.filigran.io"