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

Merge branch 'http' into 'master'

update to http for nshmp-lib dependency

See merge request ghsc/nshmp/nshmp-netcdf!34
parents 7e870cf5 cd580b33
No related branches found
No related tags found
1 merge request!34update to http for nshmp-lib dependency
Pipeline #14187 passed
...@@ -3,6 +3,8 @@ variables: ...@@ -3,6 +3,8 @@ variables:
CI_REGISTRY_IMAGE: ${CODE_REGISTRY_IMAGE} CI_REGISTRY_IMAGE: ${CODE_REGISTRY_IMAGE}
DOCKER_DIR: docker-images DOCKER_DIR: docker-images
DOCKER_TAR: ${DOCKER_DIR}/app.tar DOCKER_TAR: ${DOCKER_DIR}/app.tar
GIT_NSHMP_PASSWORD: ${GITLAB_API_TOKEN}
GIT_NSHMP_USERNAME: ${GITLAB_USER_EMAIL}
IMAGE_NAME: ${CI_PROJECT_NAME}:${CI_COMMIT_REF_SLUG} IMAGE_NAME: ${CI_PROJECT_NAME}:${CI_COMMIT_REF_SLUG}
JACOCO_HTML_DIR: ${REPORTS_DIR}/jacoco/test/html JACOCO_HTML_DIR: ${REPORTS_DIR}/jacoco/test/html
JUNIT_FILES: build/test-results/test/TEST-*.xml JUNIT_FILES: build/test-results/test/TEST-*.xml
...@@ -20,7 +22,6 @@ stages: ...@@ -20,7 +22,6 @@ stages:
# - install-aws: Install aws in a Alpine environment # - install-aws: Install aws in a Alpine environment
# - nshmp-lib: Download nshmp-lib repo # - nshmp-lib: Download nshmp-lib repo
# - static-data: Array of all static data in AWS s3 # - static-data: Array of all static data in AWS s3
# - ssh-key: Add ssh key
#### ####
.templates: .templates:
install-aws: &install-aws |- install-aws: &install-aws |-
...@@ -35,15 +36,6 @@ stages: ...@@ -35,15 +36,6 @@ stages:
STATIC_DATA=" STATIC_DATA="
${DATA_CONUS_2018A} ${DATA_CONUS_2018A}
"; ";
ssh-key: &ssh-key |-
eval $(ssh-agent -s);
mkdir -p ~/.ssh;
chmod 700 ~/.ssh;
echo "${SSH_PRIVATE_KEY}" >> ~/.ssh/id_ed25519;
chmod 0600 ~/.ssh/id_ed25519;
echo "${SSH_PRIVATE_KEY}" >> ~/.ssh/id_rsa;
chmod 0600 ~/.ssh/id_rsa;
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config;
#### ####
# Template: Devlopment tags # Template: Devlopment tags
...@@ -62,8 +54,6 @@ stages: ...@@ -62,8 +54,6 @@ stages:
only: only:
- branches - branches
- master@ghsc/nshmp/nshmp-netcdf - master@ghsc/nshmp/nshmp-netcdf
before_script:
- *ssh-key
#### ####
# Template: Deploy to Docker Swarm # Template: Deploy to Docker Swarm
...@@ -125,7 +115,7 @@ Build Project: ...@@ -125,7 +115,7 @@ Build Project:
extends: extends:
- .gradle - .gradle
script: script:
- ./gradlew --no-daemon assemble; - ./gradlew --no-daemon assemble
#### ####
# Run Spotless check. # Run Spotless check.
...@@ -134,7 +124,7 @@ Spotless Check: ...@@ -134,7 +124,7 @@ Spotless Check:
extends: extends:
- .gradle - .gradle
script: script:
- ./gradlew --no-daemon spotlessCheck; - ./gradlew --no-daemon spotlessCheck
#### ####
# Run Spotbugs main. # Run Spotbugs main.
...@@ -143,7 +133,7 @@ Spotbugs Main: ...@@ -143,7 +133,7 @@ Spotbugs Main:
extends: extends:
- .gradle - .gradle
script: script:
- ./gradlew --no-daemon spotbugsMain; - ./gradlew --no-daemon spotbugsMain
#### ####
# Run tests. # Run tests.
...@@ -161,11 +151,9 @@ Unit Tests: ...@@ -161,11 +151,9 @@ Unit Tests:
- master@ghsc/nshmp/nshmp-netcdf - master@ghsc/nshmp/nshmp-netcdf
- tags@ghsc/nshmp/nshmp-netcdf - tags@ghsc/nshmp/nshmp-netcdf
coverage: '/Total.*?([0-9]{1,3})%/' coverage: '/Total.*?([0-9]{1,3})%/'
before_script:
- *ssh-key
script: script:
- ./gradlew --no-daemon check; - ./gradlew --no-daemon check
- cat ${JACOCO_HTML_DIR}/index.html; - cat ${JACOCO_HTML_DIR}/index.html
artifacts: artifacts:
paths: paths:
- ${REPORTS_DIR} - ${REPORTS_DIR}
...@@ -187,9 +175,12 @@ Build Image: ...@@ -187,9 +175,12 @@ Build Image:
- tags@ghsc/nshmp/nshmp-netcdf - tags@ghsc/nshmp/nshmp-netcdf
before_script: before_script:
- *install-aws - *install-aws
- *ssh-key
script: script:
- docker build --build-arg ssh_private_key="${SSH_PRIVATE_KEY}" -t local/${IMAGE_NAME} . - |
docker build \
--build-arg git_username="${GIT_NSHMP_USERNAME}" \
--build-arg git_password="${GIT_NSHMP_PASSWORD}" \
-t local/${IMAGE_NAME} .
#### ####
# Build and publish Docker images with data from AWS S3. # Build and publish Docker images with data from AWS S3.
...@@ -206,7 +197,6 @@ Build/Publish Data Images: ...@@ -206,7 +197,6 @@ Build/Publish Data Images:
before_script: before_script:
- *install-aws - *install-aws
- *static-data - *static-data
- *ssh-key
- mkdir ${DOCKER_DIR} - mkdir ${DOCKER_DIR}
script: script:
- echo "${CHS_PASSWORD}" | docker login --username ${CHS_USERNAME} --password-stdin ${CODE_REGISTRY} - echo "${CHS_PASSWORD}" | docker login --username ${CHS_USERNAME} --password-stdin ${CODE_REGISTRY}
...@@ -219,7 +209,8 @@ Build/Publish Data Images: ...@@ -219,7 +209,8 @@ Build/Publish Data Images:
DATA/${data}.nc; DATA/${data}.nc;
docker build \ docker build \
--build-arg netcdf_file="DATA/${data}.nc" \ --build-arg netcdf_file="DATA/${data}.nc" \
--build-arg ssh_private_key="${SSH_PRIVATE_KEY}" \ --build-arg git_username="${GIT_NSHMP_USERNAME}" \
--build-arg git_password="${GIT_NSHMP_PASSWORD}" \
-t ${INTERNAL_IMAGE_NAME} .; -t ${INTERNAL_IMAGE_NAME} .;
rm DATA/${data}.nc rm DATA/${data}.nc
docker push ${INTERNAL_IMAGE_NAME}; docker push ${INTERNAL_IMAGE_NAME};
......
#### ####
# Build locally: # Build locally:
# docker build --build-arg ssh_private_key="$(cat ~/.ssh/id_rsa)" -t nshmp-netcdf . # docker build
# --build-arg git_username=<user@name.com>
# --build-arg git_password=<git-api-token>
# -t nshmp-netcdf .
#### ####
# Current project
ARG project=nshmp-netcdf ARG project=nshmp-netcdf
# Builder work dir
ARG workdir=/app/${project} ARG workdir=/app/${project}
# Path to libs dir
ARG libs_dir=${workdir}/build/libs ARG libs_dir=${workdir}/build/libs
# Path to jar file
ARG jar_file=${libs_dir}/${project}.jar ARG jar_file=${libs_dir}/${project}.jar
#### ####
...@@ -22,20 +18,18 @@ FROM usgs/centos:8 as builder ...@@ -22,20 +18,18 @@ FROM usgs/centos:8 as builder
ENV LANG="en_US.UTF-8" ENV LANG="en_US.UTF-8"
ARG workdir ARG git_username
ARG git_password
ARG libs_dir ARG libs_dir
ARG jar_file ARG jar_file
ARG ssh_private_key ARG workdir
ENV GIT_NSHMP_USERNAME ${git_username}
ENV GIT_NSHMP_PASSWORD ${git_password}
WORKDIR ${workdir} WORKDIR ${workdir}
RUN yum install -y java-11-openjdk which git \ RUN yum install -y java-11-openjdk 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
COPY build.gradle . COPY build.gradle .
COPY .git .git COPY .git .git
......
...@@ -24,7 +24,7 @@ repositories { ...@@ -24,7 +24,7 @@ repositories {
} }
git { git {
implementation("git@code.usgs.gov:ghsc/nshmp/nshmp-lib.git", { implementation("https://code.usgs.gov/ghsc/nshmp/nshmp-lib.git", {
name "nshmp-netcdf-dep--nshmp-lib" name "nshmp-netcdf-dep--nshmp-lib"
tag "v0.0.5" tag "v0.0.5"
}) })
......
...@@ -3,3 +3,7 @@ plugins { ...@@ -3,3 +3,7 @@ plugins {
} }
rootProject.name = "nshmp-netcdf" rootProject.name = "nshmp-netcdf"
git {
defaultAuthGroup "nshmp"
}
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