Skip to content

Commit f333d2f

Browse files
authored
Merge pull request #21 from danipaniii/final-release-pipe
Closes #11 Adding Release CI/CD-Pipeline with Github Actions
2 parents 054ad0a + 9f1c080 commit f333d2f

5 files changed

Lines changed: 131 additions & 5 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"categories": [
3+
{
4+
"title": "Breaking Changes 🛠",
5+
"labels": "breaking-change"
6+
},
7+
{
8+
"title": "New Features 🎉",
9+
"labels": "enhancement"
10+
},
11+
{
12+
"title": "Bugfixes",
13+
"lables": "bug"
14+
},
15+
{
16+
"title": "Other Changes",
17+
"labels": "*"
18+
}
19+
],
20+
"ignore_labels": [
21+
"wontfix",
22+
"invalid",
23+
"duplicate",
24+
"question"
25+
]
26+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Release Eum Server
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]*.[0-9]*.[0-9]**'
7+
8+
jobs:
9+
test_eum_server:
10+
uses: ./.github/workflows/eumserver_test.yml
11+
12+
build_and_release:
13+
name: Build and release EUM Server
14+
runs-on: ubuntu-latest
15+
needs: [test_eum_server]
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
- name: Grant execute permission for gradlew
20+
run: chmod +x gradlew
21+
- name: Build project
22+
run: ./gradlew assemble bootJar -PbuildVersion=${{ github.ref_name }}
23+
- name: Create BOM
24+
run: ./gradlew cyclonedxBom
25+
- name: Add artifacts
26+
run: |
27+
mkdir artifacts
28+
cp build/libs/*.jar ./artifacts
29+
cp build/reports/bom.json ./artifacts
30+
cp build/reports/bom.xml ./artifacts
31+
# Uploading eumserver jar, for creating docker image in the next step
32+
- name: Upload eumserver jar
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: eumserver-jar
36+
path: artifacts/inspectit-ocelot-eum-server-${{ github.ref_name }}.jar
37+
- name: "Build Changelog"
38+
id: build_changelog
39+
uses: mikepenz/release-changelog-builder-action@v3.5.0
40+
with:
41+
# Config for the Changelog, reference: https://github.com/marketplace/actions/release-changelog-builder
42+
configuration: "eumserver-release-config.json"
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
- name: Create Release
46+
uses: softprops/action-gh-release@v0.1.15
47+
with:
48+
tag_name: ${{ github.ref_name }}
49+
body: ${{ steps.build_changelog.outputs.changelog }}
50+
files: artifacts/*
51+
generate_release_notes: true
52+
token: ${{ github.token }}
53+
name: Version ${{ github.ref_name }}
54+
55+
publish_docker_image:
56+
name: "Publish docker image"
57+
runs-on: ubuntu-latest
58+
needs: [build_and_release]
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v3
62+
- name: Download eumserver jar
63+
uses: actions/download-artifact@v3
64+
with:
65+
name: eumserver-jar # with the name we are referencing the eumserver-jar uploaded in the build_and_release job
66+
path: docker/
67+
- name: Check if jar exists and rename it
68+
run: |
69+
cd docker
70+
mv inspectit-ocelot-eum-server-${{ github.ref_name }}.jar inspectit-ocelot-eum-server.jar
71+
ls
72+
- name: Set up QEMU
73+
uses: docker/setup-qemu-action@v2
74+
- name: Set up Docker Buildx
75+
uses: docker/setup-buildx-action@v2
76+
- name: Login to Docker Hub
77+
uses: docker/login-action@v2
78+
with:
79+
username: ${{ secrets.DOCKER_HUB_USER }}
80+
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
81+
- name: Set up Docker Buildx
82+
uses: docker/setup-buildx-action@v2
83+
- name: Build and push image
84+
uses: docker/build-push-action@v3
85+
with:
86+
context: .
87+
push: true
88+
tags: inspectit/inspectit-ocelot-eum-server${{ github.ref_name }}, inspectit/inspectit-ocelot-eum-server:latest
89+
file: ./docker/Dockerfile

.github/workflows/eumserver_test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
- main
1010
paths-ignore:
1111
- 'README.md'
12+
workflow_call:
13+
1214
jobs:
1315
test:
1416
name: Run Tests

build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id 'org.springframework.boot' version "${springboot_version}"
33
id 'com.palantir.docker' version "0.21.0"
4-
id "org.cyclonedx.bom" version "1.5.0"
4+
id "org.cyclonedx.bom" version "1.7.2"
55
}
66

77
repositories {
@@ -93,7 +93,9 @@ bootJar {
9393
}
9494

9595
cyclonedxBom {
96-
includeConfigs += ["runtimeClasspath"]
96+
includeConfigs = ["runtimeClasspath"]
97+
schemaVersion = "1.4"
98+
projectType = "application"
9799
}
98100

99101
test {

docker/Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
FROM openjdk:19-slim-buster
2-
COPY inspectit-ocelot-eum-server.jar /
3-
COPY entrypoint.sh /
1+
FROM openjdk:11-jre-slim
2+
3+
# The docker directory contains the Dockerfile, entrypoint.sh and the eum-server jar to build the docker image.
4+
# So the docker directory gets added to the container to successfully build the docker image.
5+
# The dockerfile gets build in the docker directory where it is in and no new directories are being created.
6+
# =====
7+
# In order to build a docker image locally, the eum-server should be build locally and the resulting jar should be renamed
8+
# to 'inspectit-ocelot-eum-server.jar' and copied to the ./docker directory
9+
ADD ./docker/ /
410
ENTRYPOINT ["sh", "/entrypoint.sh"]
11+

0 commit comments

Comments
 (0)