Skip to content

Commit 8a6baad

Browse files
Merge pull request #159 from kit-data-manager/development
Prepare next release
2 parents f6a8dd2 + 8cbdc15 commit 8a6baad

File tree

10 files changed

+168
-147
lines changed

10 files changed

+168
-147
lines changed
Lines changed: 101 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,118 @@
1-
name: Docker
1+
# Create and publish a Docker image on github
2+
name: Create and publish a Docker image
23

4+
# Configures this workflow to run every time a change
5+
# is pushed to the 'main' branch.
36
on:
47
push:
5-
# Publish `master` as Docker `latest` image.
8+
# Publish `main` as Docker `latest` image.
69
branches:
710
- main
811

912
# Publish `v1.2.3` tags as releases.
1013
tags:
1114
- v*
15+
- '*-v*'
1216

13-
# Run tests for PRs on main branch only.
14-
pull_request:
15-
branches:
16-
- main
17-
17+
# Defines two custom environment variables for the workflow.
18+
# These are used for the Container registry domain, and a
19+
# name for the Docker image that this workflow builds.
1820
env:
19-
# TODO: Change variable to your image's name.
20-
IMAGE_NAME: indexing-service
21-
# JDK version used for building jar file
22-
currentBuildVersion: 17
21+
REGISTRY: ghcr.io
22+
IMAGE_NAME: ${{ github.repository }}
2323

24+
# Two jobs for creating and pushing Docker image
25+
# - build-and-push-image -> triggered by commits on main and tagging with semantic version (e.g.: v1.2.3)
26+
# - build-and-push-image-of-branch -> triggered by tags matching '*-v*' (e.g.: Version_1-v1.2.3)
2427
jobs:
25-
# Run tests.
26-
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
27-
test:
28+
build-and-push-image:
2829
runs-on: ubuntu-latest
29-
30+
if: ${{ contains(github.ref_name, '-') == failure() }}
31+
# Sets the permissions granted to the `GITHUB_TOKEN`
32+
# for the actions in this job.
33+
permissions:
34+
contents: read
35+
packages: write
36+
#
3037
steps:
31-
- name: Checkout repo
32-
uses: actions/checkout@v4
33-
- name: Set up OpenJDK version ...
34-
uses: actions/setup-java@v4
35-
with:
36-
distribution: 'zulu'
37-
java-version: ${{ env.currentBuildVersion }}
38-
- name: Pull elasticsearch image from docker
39-
run: docker pull elasticsearch:7.9.3
40-
- name: Install python
41-
run: sudo apt-get install --assume-yes python3 python3-setuptools python3-pip
42-
- name: Update pip
43-
run: pip3 install --upgrade pip
44-
- name: Install libraries via pip (xmltodict and wget)
45-
run: pip3 install xmltodict wget
46-
- name: Grant execute permission for gradlew
47-
run: chmod +x gradlew
48-
- name: Run tests
49-
run: ./gradlew jacocoTestReport
50-
# docker build . --file Dockerfile
51-
# Push image to GitHub Packages.
52-
# See also https://docs.docker.com/docker-hub/builds/
53-
push:
54-
# Ensure test job passes before pushing image.
55-
needs: test
56-
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
# Uses the `docker/login-action` action to log in to the Container
41+
# registry using the account and password that will publish the packages.
42+
# Once published, the packages are scoped to the account defined here.
43+
- name: Log in to the Container registry
44+
uses: docker/login-action@v3
45+
with:
46+
registry: ${{ env.REGISTRY }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about)
50+
# to extract tags and labels that will be applied to the specified image.
51+
# The `id` "meta" allows the output of this step to be referenced in a
52+
# subsequent step. The `images` value provides the base name for the tags
53+
# and labels.
54+
- name: Extract metadata (tags, labels) for Docker
55+
id: meta
56+
uses: docker/metadata-action@v5
57+
with:
58+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
59+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
60+
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
61+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
62+
- name: Build and push Docker image
63+
uses: docker/build-push-action@v5
64+
with:
65+
context: .
66+
push: true
67+
tags: ${{ steps.meta.outputs.tags }}
68+
labels: ${{ steps.meta.outputs.labels }}
69+
build-and-push-image-of-branch:
5770
runs-on: ubuntu-latest
58-
if: github.event_name == 'push'
59-
71+
if: contains(github.ref_name, '-')
72+
# Sets the permissions granted to the `GITHUB_TOKEN`
73+
# for the actions in this job.
74+
permissions:
75+
contents: read
76+
packages: write
77+
#
6078
steps:
61-
- name: Checkout repo
62-
uses: actions/checkout@v4
63-
64-
- name: Build image
65-
run: |
66-
docker build . --file Dockerfile --tag $IMAGE_NAME
67-
- name: Log into registry
68-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
69-
70-
- name: Push image
71-
run: |
72-
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
73-
# Change all uppercase to lowercase
74-
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
75-
# Strip git ref prefix from version
76-
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
77-
# Strip "v" prefix from tag name
78-
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
79-
# Use Docker `latest` tag convention
80-
[ "$VERSION" == "main" ] && VERSION=latest
81-
echo IMAGE_ID=$IMAGE_ID
82-
echo VERSION=$VERSION
83-
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
84-
docker push $IMAGE_ID:$VERSION
85-
- name: Docker meta
86-
id: docker_meta
87-
uses: crazy-max/ghaction-docker-meta@v5
88-
with:
89-
# list of Docker images to use as base name for tags
90-
images: |
91-
kitdm/indexing-service
92-
# add git short SHA as Docker tag
93-
tag-sha: true
94-
- name: Set up QEMU
95-
uses: docker/setup-qemu-action@v3
96-
97-
- name: Set up Docker Buildx
98-
uses: docker/setup-buildx-action@v3
99-
- name: Login to DockerHub
100-
uses: docker/login-action@v3
101-
with:
102-
username: ${{ secrets.DOCKER_USERNAME }}
103-
password: ${{ secrets.DOCKER_PASSWORD }}
104-
105-
- name: Push to Docker Hub
106-
uses: docker/build-push-action@v5
107-
with:
108-
context: .
109-
push: true
110-
tags: ${{ steps.docker_meta.outputs.tags }}
111-
labels: ${{ steps.docker_meta.outputs.labels }}
79+
- name: Split first part
80+
env:
81+
TAG: ${{ github.ref_name }}
82+
id: split
83+
run: echo "branch=${TAG%-v*}" >> $GITHUB_OUTPUT
84+
- name: Test variable
85+
run: |
86+
echo ${{ steps.split.outputs.branch }}
87+
- name: Checkout repository
88+
uses: actions/checkout@v4
89+
# Uses the `docker/login-action` action to log in to the Container
90+
# registry using the account and password that will publish the packages.
91+
# Once published, the packages are scoped to the account defined here.
92+
- name: Log in to the Container registry
93+
uses: docker/login-action@v3
94+
with:
95+
registry: ${{ env.REGISTRY }}
96+
username: ${{ github.actor }}
97+
password: ${{ secrets.GITHUB_TOKEN }}
98+
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about)
99+
# to extract tags and labels that will be applied to the specified image.
100+
# The `id` "meta" allows the output of this step to be referenced in a
101+
# subsequent step. The `images` value provides the base name for the tags
102+
# and labels.
103+
- name: Extract metadata (tags, labels) for Docker
104+
id: meta-branch
105+
uses: docker/metadata-action@v5
106+
with:
107+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{steps.split.outputs.branch}}
108+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
109+
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
110+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
111+
- name: Build and push Docker image
112+
uses: docker/build-push-action@v5
113+
with:
114+
context: .
115+
push: true
116+
tags: ${{ steps.meta-branch.outputs.tags }}
117+
labels: ${{ steps.meta-branch.outputs.labels }}
118+

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Changed
1313

14+
## [1.0.1] - date 2024-01-12
15+
### Changed
16+
- Use softlink to jar file in start script.
17+
- Switch to GitHub Packages.
18+
- Bump com.google.guava:guava from 32.1.3-jre to 33.0.0-jre
19+
- Bump de.codecentric:spring-boot-admin-starter-client from 3.1.8 to 3.2.1
20+
- Bump elasticsearch instance for test from 7.9.3 to 8.11.1
21+
- Bump javersVersion from 7.3.6 to 7.3.7
22+
- Bump org.asciidoctor.jvm.convert from 3.3.2 to 4.0.1
23+
- Bump org.owasp.dependencycheck from 9.0.6 to 9.0.8
24+
- Bump org.springframework.boot from 3.2.0 to 3.2.1
25+
- Bump org.springframework.cloud:spring-cloud-gateway-mvc from 4.1.0 to 4.1.1
26+
- Bump org.springframework.data:spring-data-elasticsearch from 5.2.1 to 5.2.2
27+
- Bump org.springframework:spring-messaging from 6.1.2 to 6.1.3
28+
1429
## [1.0.0] - date 2023-12-18
1530
### Added
1631
- Enable authentication for RabbitMQ
@@ -135,7 +150,8 @@ and mapping of metadata documents delivered by RabbitMQ
135150
- Mapping of metadata documents with Gemma
136151
- Ingest to elasticsearch
137152

138-
[Unreleased]: https://github.com/kit-data-manager/indexing-service/compare/v1.0.0...HEAD
153+
[Unreleased]: https://github.com/kit-data-manager/indexing-service/compare/v1.0.1...HEAD
154+
[1.0.1]: https://github.com/kit-data-manager/indexing-service/compare/v1.0.0...v1.0.1
139155
[1.0.0]: https://github.com/kit-data-manager/indexing-service/compare/v0.9.0...v1.0.0
140156
[0.9.0]: https://github.com/kit-data-manager/indexing-service/compare/v0.1.3...v0.9.0
141157
[0.1.3]: https://github.com/kit-data-manager/indexing-service/compare/v0.1.2...v0.1.3

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
[![codecov](https://codecov.io/gh/kit-data-manager/indexing-service/graph/badge.svg)](https://codecov.io/gh/kit-data-manager/indexing-service)
55
[![CodeQL](https://github.com/kit-data-manager/indexing-service/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/kit-data-manager/indexing-service/actions/workflows/codeql-analysis.yml)
66
![License](https://img.shields.io/github/license/kit-data-manager/indexing-service.svg)
7-
[![Docker Build Status](https://img.shields.io/docker/automated/kitdm/indexing-service)](https://hub.docker.com/r/kitdm/indexing-service/tags)
8-
[![Docker Image Version](https://img.shields.io/docker/v/kitdm/indexing-service/latest)](https://hub.docker.com/r/kitdm/indexing-service/tags)
9-
[![Docker Pulls](https://img.shields.io/docker/pulls/kitdm/indexing-service)](https://hub.docker.com/r/kitdm/indexing-service/tags)
7+
[![docker]](https://github.com/kit-data-manager/indexing-service/pkgs/container/indexing-service)
8+
[![currentVersion]](https://github.com/kit-data-manager/indexing-service/pkgs/container/indexing-service)
9+
[![size]](https://github.com/kit-data-manager/indexing-service/pkgs/container/indexing-service)
10+
11+
12+
[docker]: <https://ghcr-badge.egpl.dev/kit-data-manager/indexing-service/tags?trim=major&color=steelblue&ignore=main,latest&label=docker versions>
13+
[currentVersion]: <https://ghcr-badge.egpl.dev/kit-data-manager/indexing-service/latest_tag?trim=major&color=steelblue&label=current version>
14+
[size]: <https://ghcr-badge.egpl.dev/kit-data-manager/indexing-service/size?color=steelblue&label=size>
1015

1116

1217
:information_source:

build.gradle

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
plugins {
2-
id "org.springframework.boot" version "3.2.0"
2+
id "org.springframework.boot" version "3.2.1"
33
id "io.spring.dependency-management" version "1.1.4"
44
id "io.freefair.lombok" version "8.4"
55
id "io.freefair.maven-publish-java" version "8.4"
6-
id "org.owasp.dependencycheck" version "9.0.6"
7-
id 'org.asciidoctor.jvm.convert' version '3.3.2'
6+
id "org.owasp.dependencycheck" version "9.0.8"
7+
id 'org.asciidoctor.jvm.convert' version '4.0.1'
88
id 'net.researchgate.release' version '3.0.2'
99
id "com.gorylenko.gradle-git-properties" version "2.4.1"
1010
id 'java'
@@ -13,7 +13,7 @@ plugins {
1313

1414
ext {
1515
// versions of dependencies
16-
javersVersion = '7.3.6'
16+
javersVersion = '7.3.7'
1717
springDocVersion = '2.3.0'
1818
}
1919

@@ -51,8 +51,8 @@ if (System.getProperty('profile') == 'minimal') {
5151

5252
dependencies {
5353
// Spring
54-
implementation 'org.springframework:spring-messaging:6.1.2'
55-
implementation 'org.springframework.cloud:spring-cloud-gateway-mvc:4.1.0'
54+
implementation 'org.springframework:spring-messaging:6.1.3'
55+
implementation 'org.springframework.cloud:spring-cloud-gateway-mvc:4.1.1'
5656

5757
// Spring Boot
5858
// boot starter
@@ -63,7 +63,7 @@ dependencies {
6363
implementation "org.springframework.boot:spring-boot-starter-security"
6464
implementation "org.springframework.boot:spring-boot-starter-actuator"
6565
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
66-
implementation 'org.springframework.data:spring-data-elasticsearch:5.2.1'
66+
implementation 'org.springframework.data:spring-data-elasticsearch:5.2.2'
6767

6868
// springdoc
6969
implementation "org.springdoc:springdoc-openapi-starter-webmvc-ui:${springDocVersion}"
@@ -92,12 +92,12 @@ dependencies {
9292
implementation "edu.kit.datamanager:service-base:1.2.0"
9393

9494
// actuator
95-
implementation 'de.codecentric:spring-boot-admin-starter-client:3.1.8'
95+
implementation 'de.codecentric:spring-boot-admin-starter-client:3.2.1'
9696

9797
runtimeOnly 'org.apache.httpcomponents:httpclient:4.5.14'
9898

9999
// Additional libraries for tests
100-
testImplementation "com.google.guava:guava:32.1.3-jre"
100+
testImplementation "com.google.guava:guava:33.0.0-jre"
101101

102102
//Java 11 Support
103103
testImplementation "org.mockito:mockito-core:5.8.0"

build.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
################################################################################
1818
function usage {
1919
################################################################################
20-
echo "Script for creating indexing-service."
20+
echo "Script for creating $REPO_NAME service."
2121
echo "USAGE:"
2222
echo " $0 [/path/to/installation/dir]"
2323
echo "IMPORTANT: Please enter an empty or new directory as installation directory."
@@ -63,8 +63,7 @@ function checkParameters {
6363
exit 1
6464
fi
6565
# Convert variable of installation directory to an absolute path
66-
cd "$INSTALLATION_DIRECTORY" || { echo "Failure changing to directory $INSTALLATION_DIRECTORY"; ex
67-
it 1; }
66+
cd "$INSTALLATION_DIRECTORY" || { echo "Failure changing to directory $INSTALLATION_DIRECTORY"; exit 1; }
6867
INSTALLATION_DIRECTORY=$(pwd)
6968
cd "$ACTUAL_DIR" || { echo "Failure changing to directory $ACTUAL_DIR"; exit 1; }
7069
}
@@ -99,20 +98,19 @@ done
9998
################################################################################
10099
ACTUAL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
101100

102-
################################################################################
103-
# Check parameters
104-
################################################################################
105-
checkParameters "$*"
106-
107101
################################################################################
108102
# Determine repo name
109103
################################################################################
110104
REPO_NAME=$(./gradlew -q printProjectName)
111105
# Use only last line
112106
REPO_NAME=${REPO_NAME##*$'\n'}
113107

114-
printInfo "Build microservice of $REPO_NAME at '$INSTALLATION_DIRECTORY'"
108+
################################################################################
109+
# Check parameters
110+
################################################################################
111+
checkParameters "$*"
115112

113+
printInfo "Build microservice of $REPO_NAME at '$INSTALLATION_DIRECTORY'"
116114

117115
################################################################################
118116
# Build service
@@ -156,6 +154,8 @@ cd "$INSTALLATION_DIRECTORY" || { echo "Failure changing to directory $INSTALLAT
156154

157155
# Determine name of jar file.
158156
jarFile=($(ls "$REPO_NAME"*.jar))
157+
# Create soft link for jar file
158+
ln -s ${jarFile[0]} $REPO_NAME.jar
159159

160160
{
161161
echo "#!/bin/bash"
@@ -173,7 +173,7 @@ jarFile=($(ls "$REPO_NAME"*.jar))
173173
echo "################################################################################"
174174
echo "# Define jar file"
175175
echo "################################################################################"
176-
echo "jarFile=${jarFile[0]}"
176+
echo "jarFile=${REPO_NAME}.jar"
177177
echo " "
178178
echo "################################################################################"
179179
echo "# Determine directory of script."

0 commit comments

Comments
 (0)