Skip to content

Commit 6b76a17

Browse files
committed
Use shared docker build workflow to build feature branch image + simplify and remove useless step
1 parent 43def44 commit 6b76a17

File tree

2 files changed

+10
-84
lines changed

2 files changed

+10
-84
lines changed

.github/workflows/ci-docker-build.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ jobs:
2424
with:
2525
username: ${{ secrets.DOCKERHUB_USERNAME }}
2626
password: ${{ secrets.DOCKERHUB_TOKEN }}
27-
- name: Login to GHCR
28-
uses: docker/login-action@v3
29-
with:
30-
registry: ghcr.io
31-
username: ${{ github.actor }}
32-
password: ${{ secrets.GITHUB_TOKEN }}
3327

3428
- name: Docker meta
3529
id: meta
@@ -67,12 +61,6 @@ jobs:
6761
with:
6862
username: ${{ secrets.DOCKERHUB_USERNAME }}
6963
password: ${{ secrets.DOCKERHUB_TOKEN }}
70-
- name: Login to GHCR
71-
uses: docker/login-action@v3
72-
with:
73-
registry: ghcr.io
74-
username: ${{ github.actor }}
75-
password: ${{ secrets.GITHUB_TOKEN }}
7664

7765
- name: Docker meta
7866
id: meta
Lines changed: 10 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: test-feature-branch
1+
name: Deploy feature branch on staging
22
on:
33
workflow_dispatch:
44
inputs:
55
octi_config:
6+
description: Env var to use in front deployment
67
type: string
78
default: '{}'
89
required: false
@@ -18,81 +19,18 @@ on:
1819
default: false
1920

2021
jobs:
21-
worker:
22-
name: build-worker
23-
runs-on: ubuntu-latest
24-
steps:
25-
- uses: actions/checkout@v5
26-
- name: Docker meta
27-
id: meta
28-
uses: docker/metadata-action@v5
29-
with:
30-
images: filigran/worker
31-
tags: |
32-
type=ref,event=branch
33-
type=ref,event=pr
34-
type=semver,pattern={{version}}
35-
type=semver,pattern={{major}}.{{minor}}
36-
- name: Login to DockerHub
37-
if: github.event_name != 'pull_request'
38-
uses: docker/login-action@v3
39-
with:
40-
username: ${{ secrets.DOCKERHUB_USERNAME }}
41-
password: ${{ secrets.DOCKERHUB_TOKEN }}
42-
- name: Build and push
43-
uses: docker/build-push-action@v6
44-
with:
45-
context: opencti-worker
46-
file: opencti-worker/Dockerfile
47-
push: ${{ github.event_name != 'pull_request' }}
48-
tags: ${{ steps.meta.outputs.tags }}
49-
labels: ${{ steps.meta.outputs.labels }}
50-
platform:
51-
name: build-platform
52-
runs-on: ubuntu-latest
53-
steps:
54-
- uses: actions/checkout@v5
55-
56-
- name: Docker meta
57-
id: meta
58-
uses: docker/metadata-action@v5
59-
with:
60-
images: filigran/platform
61-
tags: |
62-
type=ref,event=branch
63-
type=ref,event=pr
64-
type=semver,pattern={{version}}
65-
type=semver,pattern={{major}}.{{minor}}
66-
- name: Login to DockerHub
67-
if: github.event_name != 'pull_request'
68-
uses: docker/login-action@v3
69-
with:
70-
username: ${{ secrets.DOCKERHUB_USERNAME }}
71-
password: ${{ secrets.DOCKERHUB_TOKEN }}
72-
- name: Build and push
73-
uses: docker/build-push-action@v6
74-
with:
75-
context: opencti-platform
76-
file: opencti-platform/Dockerfile_featurebranch
77-
push: ${{ github.event_name != 'pull_request' }}
78-
tags: ${{ steps.meta.outputs.tags }}
79-
labels: ${{ steps.meta.outputs.labels }}
22+
wf-build-image:
23+
name: Build image
24+
uses: ./.github/workflows/ci-docker-build.yml
25+
with:
26+
image_tag: ${{ github.ref_name }}
27+
secrets: inherit
8028

8129
deploy:
8230
name: deploy
8331
needs: [platform, worker]
8432
runs-on: ubuntu-latest
8533
steps:
86-
- name: Docker meta
87-
id: meta
88-
uses: docker/metadata-action@v5
89-
with:
90-
images: filigran/platform
91-
tags: |
92-
type=ref,event=branch
93-
type=ref,event=pr
94-
type=semver,pattern={{version}}
95-
type=semver,pattern={{major}}.{{minor}}
9634
- run: if [ "${{ inputs.upgrade_from_58 }}" == "true" ]; then ID=67; else ID=66; fi; echo "AWX_TPL_ID=$ID" >> "$GITHUB_ENV"
9735

9836
- name: Install AWX cli
@@ -106,12 +44,12 @@ jobs:
10644
job_templates launch 'Deploy OpenCTI feature branch for testing' \
10745
--wait \
10846
--inventory eu-west-staging \
109-
--extra_vars '{"octi_version":"${{steps.meta.outputs.version}}","octi_config": ${{ inputs.octi_config }},"redis_cluster":"${{ inputs.redis_cluster }}"}' \
47+
--extra_vars '{"octi_version":"${{ github.ref_name }}","octi_config": ${{ inputs.octi_config }},"redis_cluster":"${{ inputs.redis_cluster }}"}' \
11048
-f human
11149
- name: Forge URL to match playbook limitations
11250
id: urlforge
11351
run: |
114-
url=$(echo "${{steps.meta.outputs.version}}" | cut -c 1-15 | sed 's/[_.]/-/g' | sed 's/-*$//')
52+
url=$(echo "${{ github.ref_name }}" | cut -c 1-15 | sed 's/[_.]/-/g' | sed 's/-*$//')
11553
echo "url=$url" >> $GITHUB_OUTPUT
11654
- name: display URL
11755
run: echo "https://feat-${{steps.urlforge.outputs.url}}.octi.staging.filigran.io"

0 commit comments

Comments
 (0)