UNCLASSIFIED

Commit 0dc30b79 authored by Jeffrey Weatherford's avatar Jeffrey Weatherford
Browse files

Merge branch 'repo1-mirror' into 'development'

Converting to use s3 dependencies.

See merge request !2
parents df4ebdb7 88b22261
Pipeline #159404 passed with stages
in 22 minutes and 7 seconds
...@@ -8,4 +8,6 @@ SnippetTest.java ...@@ -8,4 +8,6 @@ SnippetTest.java
submitted.txt submitted.txt
gradlew gradlew
gradlew.bat gradlew.bat
gradle gradle
\ No newline at end of file build_dependencies
libs
\ No newline at end of file
...@@ -7,16 +7,22 @@ RUN dnf update -y && dnf clean all ...@@ -7,16 +7,22 @@ RUN dnf update -y && dnf clean all
# Copy in the project files # Copy in the project files
WORKDIR /app WORKDIR /app
COPY ./scripts /app COPY ./scripts /app
COPY redis-cli.tar.gz .
COPY jars.tar.gz .
# Setup libraries and node modules. # Set workdir.
WORKDIR /app/bundles
RUN tar xzf redis-cli.tar.gz
RUN rm redis-cli.tar.gz
RUN mv redis-cli /usr/local/bin/redis-cli
WORKDIR /app WORKDIR /app
# Cleanup # Setup redis.
RUN rm -rf bundles RUN tar xzf redis-cli.tar.gz && rm redis-cli.tar.gz
RUN mv redis-cli /usr/local/bin/redis-cli
# Setup jars.
RUN tar xzf jars.tar.gz && rm jars.tar.gz
RUN mkdir libs && mv jars/main/* libs/
RUN mkdir process_job/libs && mv jars/process_job/* process_job/libs/
RUN mkdir send_results/libs && mv jars/send_results/* send_results/libs/
RUN rm -rf jars
# Set permissions and ownership # Set permissions and ownership
RUN chown -R 1000 /app RUN chown -R 1000 /app
......
...@@ -10,6 +10,23 @@ code snippets that were submitted from students through the LEARN application. ...@@ -10,6 +10,23 @@ code snippets that were submitted from students through the LEARN application.
- Java 11 - Java 11
- Gradle 6.7 - Gradle 6.7
## Container Usage:
### Container info:
- workdir: /app
- user id: 1000
- Does not require container port mapping.
### Recommended Resources:
- Min/Max CPU: 0.25/0.5
- Min/Max Memory: 256Mi/1Gi
### Required Environment Variables:
- ```REDIS_HOST``` - The redis server host address.
## Local Development ## Local Development
1) Install [Java JDK 11](https://adoptopenjdk.net). 1) Install [Java JDK 11](https://adoptopenjdk.net).
......
...@@ -30,11 +30,24 @@ labels: ...@@ -30,11 +30,24 @@ labels:
# List of resources to make available to the offline build context # List of resources to make available to the offline build context
resources: resources:
- url: https://download.redis.io/releases/redis-6.0.9.tar.gz - auth:
filename: redis-6.0.9.tar.gz type: s3
validation: id: galvanize
type: sha256 region: us-gov-west-1
value: dc2bdcf81c620e9f09cfd12e85d3bc631c897b2db7a55218fd8a65eaa37f86dd url: s3://learn-dependencies/java-evaluator/redis-cli.tar.gz
filename: redis-cli.tar.gz
validation:
type: sha256
value: 975e37c4165969c4cd612ddd81a6950e872f2d9a7a355376a05be4ad901e62fe
- auth:
type: s3
id: galvanize
region: us-gov-west-1
url: s3://learn-dependencies/java-evaluator/jars.tar.gz
filename: jars.tar.gz
validation:
type: sha256
value: 8d9cbd2da25b8c1792e6fc900c9bd88c7e79005fdacf81fd0765933682b53c21
# List of project maintainers # List of project maintainers
maintainers: maintainers:
......
include:
- project: 'platform-one/devops/pipeline-products'
ref: 'learn-ci'
file: 'products/tron/galvanize/learn/java-evaluator-ci.yml'
ARG BASE_REGISTRY
ARG BASE_IMAGE
ARG BASE_TAG
FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}
USER 0
# Install required libs.
RUN dnf update -y && dnf install -y \
curl \
make \
gcc \
gcc-c++
# Setup our environment
WORKDIR /app
# Redis
RUN curl -L http://download.redis.io/redis-stable.tar.gz -o redis-stable.tar.gz
RUN tar xzf redis-stable.tar.gz
WORKDIR /app/redis-stable
RUN make redis-cli
WORKDIR /app/redis-stable/src
RUN tar czf redis-cli.tar.gz redis-cli
RUN mv redis-cli.tar.gz /app/
WORKDIR /app
# Add write permissions.
RUN chown -R 1000 .
# Set the entry point.
CMD tail -f /dev/null
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# Initial builds. # Initial builds.
gradle --offline test gradle --offline test
loop=1
while true ; do while true ; do
# If it exists, delete the json-object.json file # If it exists, delete the json-object.json file
[ -e json-object.json ] && rm json-object.json [ -e json-object.json ] && rm json-object.json
...@@ -21,6 +23,14 @@ while true ; do ...@@ -21,6 +23,14 @@ while true ; do
[ -s json-object.json ] || continue [ -s json-object.json ] || continue
# Log the current job number.
echo
echo "============================"
echo "Processing job number: $loop"
echo "============================"
echo
let "loop=loop+1"
java -jar process_job/build/libs/process-job.jar java -jar process_job/build/libs/process-job.jar
gradle --offline test \ gradle --offline test \
......
#!/bin/bash
# Image Params.
BASE_REGISTRY=registry.il2.dso.mil
BASE_IMAGE=platform-one/devops/pipeline-templates/ironbank/gradle-jre11
BASE_TAG=6.7.1
# This is the profile name in your aws credentials file.
DEPENDENCY_FOLDER=build_dependencies
AWS_PROFILE_NAME=revacomm
AWS_BUCKET_NAME=learn-dependencies/java-evaluator
AWS_REGION=us-gov-west-1
echo "Clearing dependency folder."
rm -rf $DEPENDENCY_FOLDER
mkdir $DEPENDENCY_FOLDER
echo "Building docker image."
IMAGE_ID=$(docker build --file Dockerfile.packages . -q \
--build-arg BASE_REGISTRY=$BASE_REGISTRY \
--build-arg BASE_IMAGE=$BASE_IMAGE \
--build-arg BASE_TAG=$BASE_TAG)
echo "Image ID: ${IMAGE_ID}"
echo "Starting docker container."
CONTAINER_ID=$(docker run -d "$IMAGE_ID")
echo "Container ID: ${CONTAINER_ID}"
echo "Copying node modules and gems to the bundles directory."
docker cp "$CONTAINER_ID":/app/redis-cli.tar.gz $DEPENDENCY_FOLDER
echo "Stopping the docker container."
docker stop "$CONTAINER_ID"
echo "Uploading all the build dependencies to AWS."
aws s3 sync $DEPENDENCY_FOLDER s3://$AWS_BUCKET_NAME --delete --profile $AWS_PROFILE_NAME --region $AWS_REGION
echo "Checksums:"
cd $DEPENDENCY_FOLDER
sha256sum redis-cli.tar.gz
cd ..
echo "Removing dependency folder."
rm -rf $DEPENDENCY_FOLDER
echo "Done!"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment