Skip to content
Snippets Groups Projects
Commit 59f288ff authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

Merge branch 'deps' into 'master'

Dependencies

See merge request ghsc/nshmp/nshmp-haz-v2!485
parents ecd850da bcb704c6
No related branches found
No related tags found
1 merge request!485Dependencies
Pipeline #13893 passed
......@@ -14,3 +14,4 @@ Scratch*.java
nshmp-haz-log*
.vscode
config.properties
libs
......@@ -20,3 +20,4 @@ scratch*.html
Scratch*.js
webapp/config.json
config.properties
libs
......@@ -3,13 +3,9 @@ variables:
CI_REGISTRY_IMAGE: ${CODE_REGISTRY_IMAGE}
DOCKER_DIR: docker-images
DOCKER_TAR: ${DOCKER_DIR}/app.tar
FAULT_SECTIONS: nshm-fault-sections
FAULT_SECTIONS_GIT: https://gitlab-ci-token:${CI_JOB_TOKEN}@code.usgs.gov/ghsc/nshmp/${FAULT_SECTIONS}.git
IMAGE_NAME: ${CI_PROJECT_NAME}:${CI_COMMIT_REF_SLUG}
JACOCO_HTML_DIR: build/reports/jacoco/test/html
JUNIT_FILES: build/test-results/test/TEST-*.xml
NSHMP_LIB: nshmp-lib
NSHMP_LIB_GIT: https://gitlab-ci-token:${CI_JOB_TOKEN}@code.usgs.gov/ghsc/nshmp/${NSHMP_LIB}.git
stages:
- test
......@@ -30,19 +26,16 @@ stages:
# - adjust-image-names: Update container image names
####
.templates:
nshmp-lib: &nshmp-lib |-
cd ..;
rm -rf ${NSHMP_LIB};
git clone ${NSHMP_LIB_GIT};
cd ${CI_PROJECT_NAME};
fault-sections: &fault-sections |-
cd ..;
rm -rf ${FAULT_SECTIONS};
git clone ${FAULT_SECTIONS_GIT};
cd ${CI_PROJECT_NAME};
adjust-image-names: &adjust-image-names
adjust-image-names: &adjust-image-names |-
IMAGE_NAME=${IMAGE_NAME/:master/:latest};
INTERNAL_IMAGE_NAME=${CI_REGISTRY_IMAGE}/${IMAGE_NAME};
ssh-key: &ssh-key |-
eval $(ssh-agent -s);
mkdir -p ~/.ssh;
chmod 700 ~/.ssh;
echo "${SSH_PRIVATE_KEY}" >> ~/.ssh/id_rsa;
chmod 0600 ~/.ssh/id_rsa;
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config;
####
# Template: Deploy to Docker Swarm
......@@ -96,11 +89,11 @@ Build Project:
image: gradle:jdk11
extends: .dev-tags
only:
- merge_request
- branches
- master@ghsc/nshmp/nshmp-haz-v2
- tags@ghsc/nshmp/nshmp-haz-v2
before_script:
- *nshmp-lib
- *ssh-key
script:
- ./gradlew assemble
......@@ -112,10 +105,10 @@ Spotless Check:
image: gradle:jdk11
extends: .dev-tags
only:
- merge_request
- branches
- master@ghsc/nshmp/nshmp-haz-v2
before_script:
- *nshmp-lib
- *ssh-key
script:
- ./gradlew spotlessCheck;
......@@ -127,10 +120,10 @@ Spotbugs Main:
image: gradle:jdk11
extends: .dev-tags
only:
- merge_request
- branches
- master@ghsc/nshmp/nshmp-haz-v2
before_script:
- *nshmp-lib
- *ssh-key
script:
- ./gradlew spotbugsMain;
......@@ -142,10 +135,10 @@ Spotbugs Test:
image: gradle:jdk11
extends: .dev-tags
only:
- merge_request
- branches
- master@ghsc/nshmp/nshmp-haz-v2
before_script:
- *nshmp-lib
- *ssh-key
script:
- ./gradlew spotbugsTest;
......@@ -160,13 +153,12 @@ Unit Tests:
image: gradle:jdk11
extends: .dev-tags
only:
- merge_request
- branches
- master@ghsc/nshmp/nshmp-haz-v2
- tags@ghsc/nshmp/nshmp-haz-v2
coverage: '/Total.*?([0-9]{1,3})%/'
before_script:
- *fault-sections
- *nshmp-lib
- *ssh-key
script:
- ./gradlew check
- cat ${JACOCO_HTML_DIR}/index.html
......@@ -190,20 +182,17 @@ Build Image:
image: docker:stable
extends: .dev-tags
only:
- merge_request
- branches
- master@ghsc/nshmp/nshmp-haz-v2
- tags@ghsc/nshmp/nshmp-haz-v2
before_script:
- *adjust-image-names
- rm -rf ${DOCKER_DIR}
- apk add git;
- *nshmp-lib
- mv ../${NSHMP_LIB} .
- *fault-sections
- mv ../${FAULT_SECTIONS} .
- *ssh-key
script:
- mkdir ${DOCKER_DIR}
- docker build -t local/${IMAGE_NAME} .
- docker build --build-arg ssh_private_key="${SSH_PRIVATE_KEY}" -t local/${IMAGE_NAME} .
- docker save local/${IMAGE_NAME} > ${DOCKER_TAR}
artifacts:
paths:
......
......@@ -17,6 +17,9 @@
# -e RUN_HAZARD=false \
# -e MODEL=<COUS-20[08|14|18] | AK-2007 | HI-2020> \
# code.chs.usgs.gov:5001/ghsc/nshmp/images/nshmp-haz-v2;
#
# Build locally:
# docker build --build-arg ssh_private_key="$(cat ~/.ssh/id_rsa)" -t nshmp-haz .
####
ARG project=nshmp-haz-v2
......@@ -35,15 +38,21 @@ ENV LANG="en_US.UTF-8"
ARG builder_workdir
ARG libs_dir
ARG ws_file
ARG ssh_private_key
WORKDIR ${builder_workdir}
COPY . .
RUN yum install -y java-11-openjdk-devel which git
RUN yum install -y java-11-openjdk-devel which git \
&& eval $(ssh-agent -s) \
&& mkdir -p ~/.ssh \
&& chmod 700 ~/.ssh \
&& echo "${ssh_private_key}" >> ~/.ssh/id_rsa \
&& chmod 0600 ~/.ssh/id_rsa \
&& echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
RUN mv nshmp-lib ../. \
&& ./gradlew --no-daemon assemble \
RUN ./gradlew --no-daemon assemble \
&& mv ${libs_dir}/*-all.jar ${ws_file}
####
......
......@@ -43,9 +43,6 @@ apply from: "${projectDir}/gradle/ext.gradle"
apply from: "${projectDir}/gradle/jar.gradle"
apply from: "${projectDir}/gradle/javadoc.gradle"
apply from: "${projectDir}/gradle/tasks.gradle"
apply from: project(":nshmp-lib").file("gradle/git-hooks.gradle")
apply from: project(":nshmp-lib").file("gradle/spotbugs.gradle")
apply from: project(":nshmp-lib").file("gradle/spotless.gradle")
sourceCompatibility = JavaVersion.VERSION_11
compileJava.options.encoding = "UTF-8"
......@@ -60,9 +57,18 @@ repositories {
jcenter()
}
dependencies {
implementation project(":nshmp-lib")
git {
implementation("git@code.usgs.gov:ghsc/nshmp/nshmp-lib.git", {
name "nshmp-haz-dep--nshmp-lib"
tag "v0.0.4"
})
}
apply from: "${nshmpLibGradleDir}/git-hooks.gradle"
apply from: "${nshmpLibGradleDir}/spotbugs.gradle"
apply from: "${nshmpLibGradleDir}/spotless.gradle"
dependencies {
// AWS
implementation "com.amazonaws:aws-lambda-java-core:${awsLambdaCoreVersion}"
implementation "com.amazonaws:aws-java-sdk-lambda:${awsLambdaVersion}"
......
......@@ -8,3 +8,4 @@ logbackVersion = 1.2.3
mnOpenAPIVersion = 1.4.0
mnVersion = 1.3.2
swaggerVersion = 2.1.1
nshmFaultSectionsTag = v0.1
......@@ -6,6 +6,11 @@ ext {
propsPath = '/classes/java/main/service.properties'
nshmpLib = "libs/nshmp-haz-dep--nshmp-lib"
nshmpLibGradleDir = "${nshmpLib}/gradle"
spotbugsDir = "${nshmpLib}/gradle"
spotlessDir = "${nshmpLib}/src/main/resources"
/* Multi-model repository paths for version tracking */
repo_cous_2008 = '../nshm-cous-2008'
repo_cous_2014 = '../nshm-cous-2014'
......
rootProject.name = 'nshmp-haz-v2'
include ':nshmp-lib'
project(':nshmp-lib').projectDir = new File(settingsDir, '../nshmp-lib')
plugins {
id "com.alexvasilkov.git-dependencies" version "2.0.1"
}
rootProject.name = "nshmp-haz-v2"
git {
// Required for nshmp-lib tests
fetch ("git@code.usgs.gov:ghsc/nshmp/nshm-fault-sections.git", {
tag nshmFaultSectionsTag
})
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment