-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
585 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
pipeline { | ||
agent any | ||
options { | ||
disableConcurrentBuilds() | ||
buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) | ||
} | ||
stages { | ||
stage('Build') { | ||
steps { | ||
sh './gradlew clean build' | ||
} | ||
post { | ||
always { | ||
junit 'backend/build/test-results/**/*.xml' | ||
jacoco execPattern: '**/build/jacoco/test.exec' | ||
} | ||
} | ||
} | ||
stage('Build Docker images') { | ||
when { | ||
expression { | ||
return GIT_BRANCH in ['master'] | ||
} | ||
} | ||
steps { | ||
sh '''./gradlew docker | ||
''' | ||
} | ||
} | ||
stage('Deploy') { | ||
when { | ||
expression { | ||
return GIT_BRANCH in ['master'] | ||
} | ||
} | ||
steps { | ||
sh ''' | ||
docker stop shibui || true && docker rm shibui || true | ||
docker run -d --restart always --name shibui -p 8080:8080 -v /etc/shibui/application.properties:/application.properties unicon/shibui:latest | ||
''' | ||
} | ||
} | ||
} | ||
post { | ||
failure { | ||
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])]) | ||
} | ||
success { | ||
emailext body: '''${SCRIPT, template="groovy-text.template"}''', recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']], subject: '[SHIBUI] Build Success' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM gcr.io/distroless/java | ||
|
||
ARG JAR_FILE | ||
|
||
COPY ${JAR_FILE} app.jar | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ernet2/tier/shibboleth/admin/ui/configuration/MetadataResolverConverterConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.configuration; | ||
|
||
import edu.internet2.tier.shibboleth.admin.ui.service.MetadataResolverConverterService; | ||
import edu.internet2.tier.shibboleth.admin.ui.service.MetadataResolverConverterServiceImpl; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* @author Bill Smith (wsmith@unicon.net) | ||
*/ | ||
@Configuration | ||
public class MetadataResolverConverterConfiguration { | ||
@Bean | ||
public MetadataResolverConverterService metadataResolverConverterService() { | ||
return new MetadataResolverConverterServiceImpl(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...t2/tier/shibboleth/admin/ui/configuration/PlaceholderResolverComponentsConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.configuration; | ||
|
||
import edu.internet2.tier.shibboleth.admin.ui.service.TokenPlaceholderValueResolvingService; | ||
import edu.internet2.tier.shibboleth.admin.util.TokenPlaceholderResolvers; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.env.ConfigurableEnvironment; | ||
|
||
@Configuration | ||
public class PlaceholderResolverComponentsConfiguration { | ||
|
||
@Bean | ||
public TokenPlaceholderValueResolvingService tokenPlaceholderValueResolvingService(ConfigurableEnvironment env) { | ||
return TokenPlaceholderValueResolvingService.shibbolethPlaceholderPrefixAware(env.getPropertySources()); | ||
} | ||
|
||
@Bean | ||
public TokenPlaceholderResolvers tokenPlaceholderResolvers(TokenPlaceholderValueResolvingService service) { | ||
return new TokenPlaceholderResolvers(service); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
.../src/main/java/edu/internet2/tier/shibboleth/admin/ui/configuration/StringTrimModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.configuration; | ||
|
||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.databind.DeserializationContext; | ||
import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer; | ||
import com.fasterxml.jackson.databind.module.SimpleModule; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* @author Bill Smith (wsmith@unicon.net) | ||
* | ||
* Adapted from Maciej Marczuk's answer on Stack Overflow here: | ||
* https://stackoverflow.com/questions/6852213/can-jackson-be-configured-to-trim-leading-trailing-whitespace-from-all-string-pr/33765854#33765854 | ||
*/ | ||
public class StringTrimModule extends SimpleModule { | ||
|
||
public StringTrimModule() { | ||
addDeserializer(String.class, new StdScalarDeserializer<String>(String.class) { | ||
@Override | ||
public String deserialize(JsonParser jsonParser, DeserializationContext ctx) throws IOException { | ||
return jsonParser.getValueAsString().trim(); | ||
} | ||
}); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...th/admin/ui/configuration/postprocessors/IdpHomeValueSettingEnvironmentPostProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.configuration.postprocessors; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.env.EnvironmentPostProcessor; | ||
import org.springframework.core.env.ConfigurableEnvironment; | ||
import org.springframework.core.env.MapPropertySource; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Spring Boot Environment Post Processor setting the value for idp.home property to a temp directory | ||
* if no IDP_HOME environment variable has been set already. | ||
* | ||
* @author Dmitriy Kopylenko | ||
*/ | ||
public class IdpHomeValueSettingEnvironmentPostProcessor implements EnvironmentPostProcessor { | ||
|
||
private static final String IDP_HOME_PROP = "idp.home"; | ||
|
||
private static final String METADATA_DIR = "metadata"; | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(IdpHomeValueSettingEnvironmentPostProcessor.class); | ||
|
||
@Override | ||
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { | ||
if(environment.getProperty(IDP_HOME_PROP) == null) { | ||
Map<String, Object> map = new HashMap<>(1); | ||
try { | ||
Path tempDir = Files.createTempDirectory(null); | ||
tempDir.toFile().deleteOnExit(); | ||
String tempDirName = tempDir.toAbsolutePath().toString(); | ||
Path tempMetadataSubDir = Paths.get(tempDirName, METADATA_DIR); | ||
Files.createDirectories(tempMetadataSubDir); | ||
map.put(IDP_HOME_PROP, tempDirName); | ||
} catch (IOException e) { | ||
LOGGER.error(e.getMessage()); | ||
throw new RuntimeException(e); | ||
} | ||
environment.getPropertySources().addLast(new MapPropertySource("idp.home.propertysource", map)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.