Skip to content

Commit 6ef0aa1

Browse files
author
Thomas Franco
committed
Release 3.2.0
2 parents c3042ef + 524020f commit 6ef0aa1

File tree

152 files changed

+10206
-493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+10206
-493
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: 'Get latest version of code'
3+
description: 'Simply run sbt command to get the latest app_version of code currently built'
4+
outputs:
5+
app_version:
6+
description: "App version number, like '5.2.1' for example"
7+
value: ${{ steps.get_version.outputs.app_version }}
8+
runs:
9+
using: "composite"
10+
steps:
11+
- uses: coursier/setup-action@v1
12+
with:
13+
jvm: corretto:11
14+
apps: sbt
15+
- name: Get app_version
16+
id: get_version
17+
shell: bash
18+
run: |
19+
V=$(sbt -no-colors --error "print version" | awk 'END{print $1}')
20+
echo "app_version=$V"
21+
echo "app_version=$V" >> $GITHUB_OUTPUT

.github/workflows/build.docker.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: build.docker.image.dev
2+
on:
3+
pull_request:
4+
types:
5+
- labeled
6+
workflow_dispatch:
7+
workflow_call:
8+
outputs:
9+
image_id:
10+
description: "ImageId of the docker image"
11+
value: ${{ jobs.build.outputs.image_id }}
12+
image_digest:
13+
description: "Digest of the image (sha256:xxx)"
14+
value: ${{ jobs.build.outputs.image_digest }}
15+
image_metadata:
16+
description: "Metadata as json"
17+
value: ${{ jobs.build.outputs.image_metadata }}
18+
image_version:
19+
description: "Version number of the Docker image"
20+
value: ${{ jobs.build.outputs.image_version }}
21+
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
prepare:
29+
permissions:
30+
actions: read
31+
contents: write
32+
runs-on: [ self-hosted, linux, domain=sb ]
33+
outputs:
34+
image_version: ${{ steps.get_version.outputs.version }}
35+
steps:
36+
- uses: actions/checkout@v4
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
- uses: ./.github/actions/get_code_version
40+
id: get_version
41+
42+
build:
43+
if: ${{ github.event.label.name == 'docker:build' || github.event_name == 'workflow_dispatch' }}
44+
needs:
45+
- prepare
46+
permissions:
47+
actions: read
48+
contents: read
49+
packages: write
50+
runs-on: [ self-hosted, linux, domain=sb ]
51+
outputs:
52+
image_id: ${{ steps.push.outputs.imageid }}
53+
image_digest: ${{ steps.push.outputs.digest }}
54+
image_metadata: ${{ steps.push.outputs.metadata }}
55+
image_version: ${{ needs.prepare.outputs.image_version }}
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- name: Set up Docker Buildx
60+
uses: docker/setup-buildx-action@v3
61+
62+
- uses: coursier/setup-action@v1
63+
with:
64+
jvm: corretto:11
65+
apps: sbt
66+
67+
- run: keytool -import -noprompt -trustcacerts -alias StrangeBeeCA -file /etc/ssl/certs/strangebee-sb-caroot.pem -keystore $JAVA_HOME/lib/security/cacerts -storepass changeit || true
68+
69+
- uses: actions/setup-node@v3
70+
timeout-minutes: 15
71+
continue-on-error: true
72+
with:
73+
node-version: 18.16
74+
75+
- name: Install bower
76+
run: npm install -g bower
77+
78+
- name: Build packages
79+
run: sbt Docker/stage
80+
81+
# I'm not really at ease with these tags
82+
# to me "latest" should be set manually, through a tag, for now
83+
# but further, it should "calculate" it, regarding the latest Docker image version available
84+
# for exemple if latest available is 3.2.0-1 and the sbt command returns 3.2.1-1,
85+
# then latest should apply
86+
# Moreover, the -1 is VERY important, because it increases with the number of builds:
87+
# - if a Docker image exists with tag 3.2.0-1, it should NOT be overidden but a new
88+
# 3.2.0-2 should be created, and the -1 cleaned up later
89+
#####
90+
# TODO: work on tagging
91+
#
92+
#
93+
- name: Generate full docker tags
94+
id: meta
95+
uses: docker/metadata-action@v4
96+
with:
97+
images: |
98+
name=${{ vars.SB_GHCR }}/cortex
99+
tags: |
100+
type=raw,value=devel
101+
type=raw,value=${{ needs.prepare.outputs.image_version }}
102+
labels: |
103+
org.opencontainers.image.title=cortex
104+
org.opencontainers.image.description=a Powerful Observable Analysis and Active Response Engine
105+
org.opencontainers.image.vendor=StrangeBee
106+
- name: Login to GitHub Container Registry
107+
uses: docker/login-action@v3
108+
with:
109+
registry: ghcr.io
110+
username: ${{ github.actor }}
111+
password: ${{ secrets.GITHUB_TOKEN }}
112+
113+
- name: Build and push docker image
114+
uses: docker/build-push-action@v3
115+
id: push
116+
with:
117+
context: target/docker/stage
118+
push: true
119+
platforms: linux/amd64,linux/arm64
120+
tags: ${{ steps.meta.outputs.tags }}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build packages
2+
on:
3+
push:
4+
tags: ["*"]
5+
workflow_dispatch:
6+
7+
jobs:
8+
build:
9+
name: Build
10+
runs-on: [ ubuntu-latest ]
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Setup node
14+
uses: actions/setup-node@v3
15+
timeout-minutes: 15
16+
continue-on-error: true
17+
with:
18+
node-version: 18.16
19+
- name: Install bower
20+
run: npm install -g bower
21+
- name: Import PGP Key
22+
run: |
23+
export GPG_TTY=$(tty)
24+
gpg --batch --import - <<< $PGP_KEY
25+
env:
26+
PGP_KEY: ${{ secrets.PGP_KEY }}
27+
- name: Write version
28+
id: version
29+
run: |
30+
V=$(sbt -no-colors --error "print version" | awk 'END{print $1}')
31+
echo "version=$V"
32+
echo "version=$V" >> $GITHUB_OUTPUT
33+
- name: Build packages
34+
run: ./sbt Debian/packageBin Rpm/packageBin Universal/packageBin makeBom
35+
- name: Move packages
36+
run: |
37+
mv target/rpm/RPMS/noarch/cortex*.rpm target/
38+
mv target/universal/cortex*.zip target/
39+
40+
- name: Make github release
41+
if: github.ref_type == 'tag'
42+
uses: "softprops/action-gh-release@v1"
43+
id: make-release
44+
with:
45+
generate_release_notes: true
46+
files: |
47+
target/cortex*.deb
48+
target/cortex*.rpm
49+
target/cortex*.zip
50+
target/cortex*.bom.xml
51+
52+
- name: Store artifacts
53+
if: github.ref_type != 'tag'
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: packages
57+
path: |
58+
target/cortex*.deb
59+
target/cortex*.rpm
60+
target/cortex*.zip
61+
target/cortex*.bom.xml
62+
retention-days: 5
63+
64+
notify:
65+
needs: [ build ]
66+
runs-on: [ ubuntu-latest ]
67+
if: always()
68+
steps:
69+
- name: Slack notification
70+
uses: Gamesight/slack-workflow-status@master
71+
with:
72+
repo_token: ${{secrets.GITHUB_TOKEN}}
73+
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}}
74+
channel: "#ci-cortex"
75+
name: Cortex build
76+
include_commit_message: true
77+
include_jobs: true

.github/workflows/build.yml

Lines changed: 0 additions & 133 deletions
This file was deleted.

.github/workflows/check_code.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ jobs:
1010
runs-on: [ ubuntu-latest ]
1111
steps:
1212
- uses: actions/checkout@v3
13+
- uses: coursier/setup-action@v1
14+
with:
15+
jvm: corretto:11
16+
apps: sbt
1317
- name: Setup node
1418
uses: actions/setup-node@v3
1519
timeout-minutes: 15

0 commit comments

Comments
 (0)