Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refix release info #87

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ config:
siblings_only: true
# see https://github.com/conventional-changelog/conventional-changelog/issues/615
MD025: false
# see https://github.com/conventional-changelog/conventional-changelog/issues/615
MD041: false

"$schema":
"https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/main/schema/markdownlint-cli2-config-schema.json"
26 changes: 26 additions & 0 deletions api/src/main/kotlin/pp/api/ReleaseInfo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package pp.api

import io.quarkus.info.BuildInfo
import io.quarkus.info.GitInfo
import io.quarkus.runtime.annotations.RegisterForReflection

/**
* Dto to display build info for this release
*
* @property gitHash Full commit hash
* @property githubLink Link the commit used to build this version on github
* @property version Project version from the gradle project
*/
// see https://quarkus.io/guides/writing-native-applications-tips#registerForReflection
@RegisterForReflection(registerFullHierarchy = true)
data class ReleaseInfo(
val gitHash: String,
val githubLink: String,
val version: String,
) {
constructor(gitInfo: GitInfo, buildInfo: BuildInfo) : this(
gitHash = gitInfo.latestCommitId(),
githubLink = "https://github.com/sne11ius/pp/commit/${gitInfo.latestCommitId()}",
version = buildInfo.version(),
)
}
22 changes: 0 additions & 22 deletions api/src/main/kotlin/pp/api/ReleaseInfoResource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package pp.api

import io.quarkus.info.BuildInfo
import io.quarkus.info.GitInfo
import io.quarkus.runtime.annotations.RegisterForReflection
import jakarta.ws.rs.GET
import jakarta.ws.rs.Path
import jakarta.ws.rs.Produces
Expand All @@ -25,25 +24,4 @@ class ReleaseInfoResource(
@GET
@Produces(APPLICATION_JSON)
fun getReleaseInfo(): ReleaseInfo = ReleaseInfo(gitInfo, buildInfo)

/**
* Dto to display build info for this release
*
* @property gitHash Full commit hash
* @property githubLink Link the commit used to build this version on github
* @property version Project version from the gradle project
*/
// see https://quarkus.io/guides/writing-native-applications-tips#registerForReflection
@RegisterForReflection(registerFullHierarchy = true)
data class ReleaseInfo(
val gitHash: String,
val githubLink: String,
val version: String,
) {
constructor(gitInfo: GitInfo, buildInfo: BuildInfo) : this(
gitHash = gitInfo.latestCommitId(),
githubLink = "https://github.com/sne11ius/pp/commit/${gitInfo.latestCommitId()}",
version = buildInfo.version(),
)
}
}
26 changes: 25 additions & 1 deletion integration-test/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,31 @@ set -e
# build backend
cd ..
docker build -f api/src/main/docker/Dockerfile.distroless-test -t pp/api-test .
docker run --rm --name pp-test --detach -p 31337:8080 pp/api-test

echo "Running Docker container..."
container_id=$(docker run --rm --name pp-test --detach -p 31337:8080 pp/api-test)
echo "Docker container started with ID: $container_id"

# Wait for a few seconds to ensure the container is up and running
echo "Waiting for the container to start..."
sleep 10

# Check container logs to see if the application started correctly
echo "Fetching container logs..."
docker logs "$container_id"

# test info endpoint with verbose output
echo "Testing info endpoint..."
json_response=$(curl -s -v http://localhost:31337/release-info)
echo "Response from endpoint: $json_response"

if echo "$json_response" | grep -q "version"; then
echo "Some string found"
else
echo "Some string not found"
docker stop "$container_id"
exit 1
fi

# build frontend
cd client
Expand Down