feature/add-jenkinsfile (#114)

Co-authored-by: Michael Hoennig <michael@hoennig.de>
Co-authored-by: Michael Hönnig <michael@hoennig.de>
Reviewed-on: #114
Reviewed-by: Timotheus Pokorra <timotheus.pokorra@hostsharing.net>
This commit is contained in:
Michael Hoennig 2024-10-14 10:36:50 +02:00
parent c26ae77a09
commit c181500a1d
5 changed files with 77 additions and 4 deletions

52
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,52 @@
pipeline {
agent {
dockerfile {
filename 'etc/jenkinsAgent.Dockerfile'
// additionalBuildArgs ...
args '--network=bridge --user root -v $PWD:$PWD -v /var/run/docker.sock:/var/run/docker.sock --group-add 984'
reuseNode true
}
}
environment {
DOCKER_HOST = 'unix:///var/run/docker.sock'
HSADMINNG_POSTGRES_ADMIN_USERNAME = 'admin'
HSADMINNG_POSTGRES_RESTRICTED_USERNAME = 'restricted'
HSADMINNG_MIGRATION_DATA_PATH = 'migration'
}
triggers {
pollSCM('H/1 * * * *')
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage ('Compile & Test') {
steps {
sh './gradlew clean check --no-daemon -x pitest -x dependencyCheckAnalyze'
}
}
}
post {
always {
// archive test results
junit 'build/test-results/test/*.xml'
// archive the JaCoCo coverage report in XML and HTML format
jacoco(
execPattern: 'build/jacoco/*.exec',
classPattern: 'build/classes/java/main',
sourcePattern: 'src/main/java'
)
// cleanup workspace
cleanWs()
}
}
}

View File

@ -0,0 +1,10 @@
FROM eclipse-temurin:21-jdk
RUN apt-get update && \
apt-get install -y bind9-utils && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# RUN mkdir /opt/app
# COPY japp.jar /opt
# CMD ["java", "-jar", "/opt/app/japp.jar"]

View File

@ -28,10 +28,10 @@ public interface HsOfficeRelationRbacRepository extends Repository<HsOfficeRelat
* @return a list of (accessible) relations which match all given criteria * @return a list of (accessible) relations which match all given criteria
*/ */
default List<HsOfficeRelationRbacEntity> findRelationRelatedToPersonUuidRelationTypePersonAndContactData( default List<HsOfficeRelationRbacEntity> findRelationRelatedToPersonUuidRelationTypePersonAndContactData(
UUID personUuid, final UUID personUuid,
HsOfficeRelationType relationType, final HsOfficeRelationType relationType,
String personData, final String personData,
String contactData) { final String contactData) {
return findRelationRelatedToPersonUuidRelationTypePersonAndContactDataImpl( return findRelationRelatedToPersonUuidRelationTypePersonAndContactDataImpl(
personUuid, toStringOrNull(relationType), toSqlLikeOperand(personData), toSqlLikeOperand(contactData)); personUuid, toStringOrNull(relationType), toSqlLikeOperand(personData), toSqlLikeOperand(contactData));
} }

View File

@ -176,6 +176,7 @@ class HsDomainDnsSetupHostingAssetValidatorUnitTest {
// given // given
final var givenEntity = validEntityBuilder().build(); final var givenEntity = validEntityBuilder().build();
final var validator = HostingAssetEntityValidatorRegistry.forType(givenEntity.getType()); final var validator = HostingAssetEntityValidatorRegistry.forType(givenEntity.getType());
Dns.fakeResultForDomain(givenEntity.getIdentifier(), Dns.Result.fromRecords());
// when // when
final var errors = validator.validateContext(givenEntity); final var errors = validator.validateContext(givenEntity);
@ -317,6 +318,7 @@ class HsDomainDnsSetupHostingAssetValidatorUnitTest {
)) ))
.build(); .build();
final var validator = HostingAssetEntityValidatorRegistry.forType(givenEntity.getType()); final var validator = HostingAssetEntityValidatorRegistry.forType(givenEntity.getType());
Dns.fakeResultForDomain("example.org", Dns.Result.fromRecords());
// when // when
final var errors = validator.validateContext(givenEntity); final var errors = validator.validateContext(givenEntity);
@ -340,6 +342,7 @@ class HsDomainDnsSetupHostingAssetValidatorUnitTest {
)) ))
.build(); .build();
final var validator = HostingAssetEntityValidatorRegistry.forType(givenEntity.getType()); final var validator = HostingAssetEntityValidatorRegistry.forType(givenEntity.getType());
Dns.fakeResultForDomain("example.org", Dns.Result.fromRecords());
// when // when
final var zonefileErrors = new ArrayList<String>(); final var zonefileErrors = new ArrayList<String>();

View File

@ -33,3 +33,11 @@ logging:
level: level:
liquibase: WARN liquibase: WARN
net.ttddyy.dsproxy.listener: DEBUG # HOWTO: log meaningful SQL statements net.ttddyy.dsproxy.listener: DEBUG # HOWTO: log meaningful SQL statements
# just for the case there are problems with Testcontainers/Docker integration
# org.testcontainers: DEBUG
# com.github.dockerjava: DEBUG
testcontainers:
network:
mode: host