Skip to content

Commit

Permalink
Rename template stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
zechmeister committed Sep 22, 2024
1 parent 1994d0f commit bae3fe1
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 21 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Java Application Template

[![Pipeline](https://github.com/digitalservicebund/java-application-template/actions/workflows/pipeline.yml/badge.svg)](https://github.com/digitalservicebund/java-application-template/actions/workflows/pipeline.yml)
[![Scan](https://github.com/digitalservicebund/java-application-template/actions/workflows/scan.yml/badge.svg)](https://github.com/digitalservicebund/java-application-template/actions/workflows/scan.yml)
[![Secrets Check](https://github.com/digitalservicebund/java-application-template/actions/workflows/secrets-check.yml/badge.svg)](https://github.com/digitalservicebund/java-application-template/actions/workflows/secrets-check.yml)
[![Pipeline](https://github.com/digitalservicebund/fit-connect-adapter/actions/workflows/pipeline.yml/badge.svg)](https://github.com/digitalservicebund/fit-connect-adapter/actions/workflows/pipeline.yml)
[![Scan](https://github.com/digitalservicebund/fit-connect-adapter/actions/workflows/scan.yml/badge.svg)](https://github.com/digitalservicebund/fit-connect-adapter/actions/workflows/scan.yml)
[![Secrets Check](https://github.com/digitalservicebund/fit-connect-adapter/actions/workflows/secrets-check.yml/badge.svg)](https://github.com/digitalservicebund/fit-connect-adapter/actions/workflows/secrets-check.yml)

Java service built with
the [Spring WebFlux reactive stack](https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#spring-webflux).
Expand Down Expand Up @@ -110,7 +110,7 @@ token provided as `SONAR_TOKEN` repository secret that needs to be obtained from
SONAR_TOKEN=[sonar-token] ./gradlew sonarqube
```

Go to [https://sonarcloud.io](https://sonarcloud.io/dashboard?id=digitalservicebund_java-application-template)
Go to [https://sonarcloud.io](https://sonarcloud.io/dashboard?id=digitalservicebund_fit-connect-adapter)
for the analysis results.

## Container image
Expand All @@ -121,7 +121,7 @@ the [GitHub Packages Container registry](https://docs.github.com/en/packages/wor
**To run the latest published image:**

```bash
docker run -p8080:8080 "ghcr.io/digitalservicebund/java-application-template:$(git log -1 origin/main --format='%H')"
docker run -p8080:8080 "ghcr.io/digitalservicebund/fit-connect-adapter:$(git log -1 origin/main --format='%H')"
```

The service will be accessible at `http://localhost:8080`.
Expand All @@ -130,15 +130,15 @@ We are using Spring's built-in support for producing an optimized container imag

```bash
./gradlew bootBuildImage
docker run -p8080:8080 ghcr.io/digitalservicebund/java-application-template
docker run -p8080:8080 ghcr.io/digitalservicebund/fit-connect-adapter
```

Container images in the registry are [signed with keyless signatures](https://github.com/sigstore/cosign/blob/main/KEYLESS.md).

**To verify an image**:

```bash
cosign verify "ghcr.io/digitalservicebund/java-application-template:$(git log -1 origin/main --format='%H')" --certificate-identity="https://github.com/digitalservicebund/java-application-template/.github/workflows/pipeline.yml@refs/heads/main" --certificate-oidc-issuer="https://token.actions.githubusercontent.com"
cosign verify "ghcr.io/digitalservicebund/fit-connect-adapter:$(git log -1 origin/main --format='%H')" --certificate-identity="https://github.com/digitalservicebund/fit-connect-adapter/.github/workflows/pipeline.yml@refs/heads/main" --certificate-oidc-issuer="https://token.actions.githubusercontent.com"
```

If you need to push a new container image to the registry manually there are two ways to do this:
Expand All @@ -147,7 +147,7 @@ If you need to push a new container image to the registry manually there are two

```bash
export CONTAINER_REGISTRY=ghcr.io
export CONTAINER_IMAGE_NAME=digitalservicebund/java-application-template
export CONTAINER_IMAGE_NAME=digitalservicebund/fit-connect-adapter
export CONTAINER_IMAGE_VERSION="$(git log -1 --format='%H')"
CONTAINER_REGISTRY_USER=[github-user] CONTAINER_REGISTRY_PASSWORD=[github-token] ./gradlew bootBuildImage --publishImage
```
Expand All @@ -158,7 +158,7 @@ CONTAINER_REGISTRY_USER=[github-user] CONTAINER_REGISTRY_PASSWORD=[github-token]

```bash
echo [github-token] | docker login ghcr.io -u [github-user] --password-stdin
docker push "ghcr.io/digitalservicebund/java-application-template:$(git log -1 --format='%H')"
docker push "ghcr.io/digitalservicebund/fit-connect-adapter:$(git log -1 --format='%H')"
```

**Note:** Make sure you're using a GitHub token with the necessary `write:packages` scope for this to work.
Expand All @@ -179,7 +179,7 @@ brew install aquasecurity/trivy/trivy

```bash
./gradlew bootBuildImage
trivy image --severity HIGH,CRITICAL ghcr.io/digitalservicebund/java-application-template:latest
trivy image --severity HIGH,CRITICAL ghcr.io/digitalservicebund/fit-connect-adapter:latest
```

As part of the automated vulnerability scanning we are generating a Cosign vulnerability scan record using Trivy,
Expand Down Expand Up @@ -218,12 +218,12 @@ with the name `SLACK_WEBHOOK_URL`, containing a url for [Incoming Webhooks](http
## Contributing

🇬🇧
Everyone is welcome to contribute the development of the _java-application-template_. You can contribute by opening pull request,
Everyone is welcome to contribute the development of the _fit-connect-adapter_. You can contribute by opening pull request,
providing documentation or answering questions or giving feedback. Please always follow the guidelines and our
[Code of Conduct](CODE_OF_CONDUCT.md).

🇩🇪
Jede:r ist herzlich eingeladen, die Entwicklung der _java-application-template_ mitzugestalten. Du kannst einen Beitrag leisten,
Jede:r ist herzlich eingeladen, die Entwicklung der _fit-connect-adapter_ mitzugestalten. Du kannst einen Beitrag leisten,
indem du Pull-Requests eröffnest, die Dokumentation erweiterst, Fragen beantwortest oder Feedback gibst.
Bitte befolge immer die Richtlinien und unseren [Verhaltenskodex](CODE_OF_CONDUCT_DE.md).

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ sonar {
// NOTE: sonarqube picks up combined coverage correctly without further configuration from:
// build/reports/jacoco/test/jacocoTestReport.xml
properties {
property("sonar.projectKey", "digitalservicebund_java-application-template")
property("sonar.projectKey", "digitalservicebund_fit-connect-adapter")
property("sonar.organization", "digitalservicebund")
property("sonar.host.url", "https://sonarcloud.io")
}
Expand Down
35 changes: 35 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# EXAMPLE USAGE:
#
# Refer for explanation to following link:
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
#
# pre-push:
# commands:
# packages-audit:
# tags: frontend security
# run: yarn audit
# gems-audit:
# tags: backend security
# run: bundle audit
#
# pre-commit:
# parallel: true
# commands:
# eslint:
# glob: "*.{js,ts,jsx,tsx}"
# run: yarn eslint {staged_files}
# rubocop:
# tags: backend style
# glob: "*.rb"
# exclude: "application.rb|routes.rb"
# run: bundle exec rubocop --force-exclusion {all_files}
# govet:
# tags: backend style
# files: git ls-files -m
# glob: "*.go"
# run: go vet {files}
# scripts:
# "hello.js":
# runner: node
# "any.go":
# runner: go run
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = "java-application-template"
rootProject.name = "fit-connect-adapter"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.bund.digitalservice.template;
package de.bund.digitalservice.a2j;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.bund.digitalservice.template;
package de.bund.digitalservice.a2j;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.bund.digitalservice.template.config;
package de.bund.digitalservice.a2j.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package de.bund.digitalservice.a2j.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/sender")
public class SenderController {
public SenderController() {}

@PostMapping("/submit")
public ResponseEntity<String> submitMessage(@RequestBody String message) {
return ResponseEntity.ok("Received message: " + message);
}
}
2 changes: 1 addition & 1 deletion src/main/resources/public/.well-known/security.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Contact: mailto:[email protected]
Expires: 2022-12-31T23:59:59.000Z
Preferred-Languages: en, de
Policy: https://raw.githubusercontent.com/digitalservicebund/java-application-template/main/SECURITY.md
Policy: https://raw.githubusercontent.com/digitalservicebund/fit-connect-adapter/main/SECURITY.md
# TODO: Update the canonical URI below and remove this comment
Canonical: https://example.com/.well-known/security.txt
Hiring: https://digitalservice.bund.de/en/career
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.bund.digitalservice.template;
package de.bund.digitalservice.a2j;

import com.tngtech.archunit.core.domain.JavaClasses;
import com.tngtech.archunit.core.importer.ClassFileImporter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.bund.digitalservice.template;
package de.bund.digitalservice.a2j;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.bund.digitalservice.template;
package de.bund.digitalservice.a2j;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Tag;
Expand Down

0 comments on commit bae3fe1

Please sign in to comment.