Skip to content

Commit

Permalink
Pr springboot migration final cxflow (#1315)
Browse files Browse the repository at this point in the history
* Springboot migration

* Image Version Change

* Removed support for java11

* added cacerts path

* JAVA 8 remove

* JAVA 17 Version update

* Added code for pblic scan

---------

Co-authored-by: Satyam Chaurasia <[email protected]>
  • Loading branch information
1 parent 51e226b commit 4347268
Show file tree
Hide file tree
Showing 31 changed files with 260 additions and 326 deletions.
52 changes: 23 additions & 29 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ commands: # a reusable command with parameters
go get github.com/cxflowtestuser/ghr
VERSION=$(cat ./build/libs/version.txt)
rm ./build/libs/version.txt
mv build/libs/java11/repo-${VERSION}.jar build/libs/cx-flow-${VERSION}-java11.jar
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -n ${VERSION} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} << parameters.ghr-option >> -delete ${VERSION} ./build/libs/
jobs:
build:
docker:
- image: circleci/openjdk:11-jdk
- image: cimg/openjdk:17.0.9
working_directory: ~/repo
environment:
MAVEN_OPTS: -Xmx3200m
Expand All @@ -33,7 +32,7 @@ jobs:
- restore_cache:
key: v1-gradle-cache-{{ checksum "build.gradle" }}
- run: ./gradlew clean build
- run: ./gradlew -b build-11.gradle --build-cache assemble
#- run: ./gradlew -b build-11.gradle --build-cache assemble
- run: ./gradlew -q getVersion > build/libs/version.txt
- save_cache:
paths:
Expand Down Expand Up @@ -63,7 +62,7 @@ jobs:

sonar:
docker:
- image: circleci/openjdk:11-jdk
- image: cimg/openjdk:17.0.9
steps:
- checkout
- run:
Expand Down Expand Up @@ -125,29 +124,25 @@ jobs:
VERSION=$(cat ./build/libs/version.txt)
SHA1_SHORT=${CIRCLE_SHA1::7}
docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} docker.io
docker build --target java8 \
docker build --target java17 \
-t ${DOCKER_REPO}:${SHA1_SHORT} \
-t ${DOCKER_REPO}:${VERSION}-8 \
-t ${DOCKER_REPO}:${VERSION}-17 \
-t ${DOCKER_REPO}:${VERSION} \
-t ${DOCKER_REPO} \
.
docker build --target java11 \
-t ${DOCKER_REPO}:${VERSION}-11 \
.
docker push ${DOCKER_REPO}:${SHA1_SHORT}
docker push ${DOCKER_REPO}:${SHA1_SHORT}
- run:
name: Archive Docker images
command: |
VERSION=$(cat ./build/libs/version.txt)
docker save -o image-11.tar ${DOCKER_REPO}:${VERSION}-11
docker save -o image-8.tar ${DOCKER_REPO}:${VERSION}-8
docker save -o image-17.tar ${DOCKER_REPO}:${VERSION}-17
docker save -o image.tar ${DOCKER_REPO}:${VERSION}
docker save -o latest.tar ${DOCKER_REPO}:latest
- persist_to_workspace:
root: .
paths:
- ./image-11.tar
- ./image-8.tar
# - ./image-11.tar
- ./image-17.tar
- ./image.tar
- ./latest.tar

Expand Down Expand Up @@ -237,7 +232,7 @@ jobs:

component-tests:
docker:
- image: "circleci/openjdk:8-jdk"
- image: "cimg/openjdk:17.0.9"
steps:
- checkout
- run:
Expand All @@ -256,7 +251,7 @@ jobs:

integration-tests:
docker:
- image: "circleci/openjdk:8-jdk"
- image: "cimg/openjdk:17.0.9"
steps:
- checkout
- run:
Expand All @@ -277,7 +272,7 @@ jobs:

sca-integration-tests:
docker:
- image: "circleci/openjdk:8-jdk"
- image: "cimg/openjdk:17.0.9"
steps:
- checkout
- run:
Expand All @@ -298,7 +293,7 @@ jobs:

ast-integration-tests:
docker:
- image: "circleci/openjdk:8-jdk"
- image: "cimg/openjdk:17.0.9"
steps:
- checkout
- run:
Expand All @@ -319,7 +314,7 @@ jobs:

jira-integration-tests:
docker:
- image: "circleci/openjdk:8-jdk"
- image: "cimg/openjdk:17.0.9"
steps:
- checkout
- run:
Expand All @@ -340,7 +335,7 @@ jobs:

pullRequestComments-integration-tests:
docker:
- image: "circleci/openjdk:8-jdk"
- image: "cimg/openjdk:17.0.9"
steps:
- checkout
- run:
Expand All @@ -361,13 +356,13 @@ jobs:

SAST-CLI-integration-tests:
docker:
- image: "circleci/openjdk:8-jdk"
- image: "cimg/openjdk:17.0.9"
steps:
- checkout
- run:
name: Importing Certificate
command: |
sudo $JAVA_HOME/bin/keytool -import -alias sastcer -storepass changeit -keystore "/usr/local/openjdk-8/jre/lib/security/cacerts" -file /home/circleci/project/src/test/resources/checkmarx.crt --noprompt
sudo $JAVA_HOME/bin/keytool -import -alias sastcer -storepass changeit -keystore "/usr/local/jdk-17.0.9/lib/security/cacerts" -file /home/circleci/project/src/test/resources/checkmarx.crt --noprompt
- run:
name: Run SAST CLI Integration Tests
command: |
Expand All @@ -386,7 +381,7 @@ jobs:

SCA-CLI-integration-tests:
docker:
- image: "circleci/openjdk:8-jdk"
- image: "cimg/openjdk:17.0.9"
steps:
- checkout
- run:
Expand All @@ -407,7 +402,7 @@ jobs:

AST-CLI-integration-tests:
docker:
- image: "circleci/openjdk:8-jdk"
- image: "cimg/openjdk:17.0.9"
steps:
- checkout
- run:
Expand All @@ -428,7 +423,7 @@ jobs:

CxGo-integration-tests:
docker:
- image: "circleci/openjdk:8-jdk"
- image: "cimg/openjdk:17.0.9"
steps:
- checkout
- run:
Expand All @@ -449,13 +444,13 @@ jobs:

CodeBashing-integration-tests:
docker:
- image: "circleci/openjdk:8-jdk"
- image: "cimg/openjdk:17.0.9"
steps:
- checkout
- run:
name: Importing Certificate
command: |
sudo $JAVA_HOME/bin/keytool -import -alias sastcer -storepass changeit -keystore "/usr/local/openjdk-8/jre/lib/security/cacerts" -file /home/circleci/project/src/test/resources/checkmarx.crt --noprompt
sudo $JAVA_HOME/bin/keytool -import -alias sastcer -storepass changeit -keystore "/usr/local/jdk-17.0.9/lib/security/cacerts" -file /home/circleci/project/src/test/resources/checkmarx.crt --noprompt
- run:
name: Run CodeBashing Integration Tests
command: |
Expand Down Expand Up @@ -513,8 +508,7 @@ jobs:
- run:
name: Load archived Docker images
command: |
docker load -i /tmp/workspace/image-11.tar
docker load -i /tmp/workspace/image-8.tar
docker load -i /tmp/workspace/image-17.tar
docker load -i /tmp/workspace/image.tar
docker load -i /tmp/workspace/latest.tar
- run:
Expand Down
21 changes: 3 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM alpine:3.18.4 AS java8
FROM alpine:3.18.4 AS java17

WORKDIR app
RUN apk update && \
apk upgrade && \
apk upgrade
RUN apk add openjdk8=8.392.08-r1 --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
RUN apk add openjdk17=17.0.10_p7-r0 --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk
RUN apk add libstdc++
RUN apk add glib
RUN apk add krb5 pcre
Expand All @@ -16,21 +16,6 @@ ENTRYPOINT ["java", "-Xms512m", "-Xmx2048m", "-Djava.security.egd=file:/dev/./ur
EXPOSE 8080


FROM alpine:3.18.4 AS java11

WORKDIR app
RUN apk update && \
apk upgrade
RUN apk add openjdk11=11.0.22_p7-r0 --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk
RUN apk add libstdc++
RUN apk add glib
RUN apk add krb5 pcre
RUN apk add bash
RUN wget "https://sca-downloads.s3.amazonaws.com/cli/latest/ScaResolver-musl64.tar.gz" -O "ScaResolver.tar.gz" && tar -xvzf ScaResolver.tar.gz && mv ScaResolver Configuration.yml /app && rm ScaResolver.tar.gz
COPY build/libs/java11/*.jar cx-flow.jar
ENTRYPOINT ["java", "-Xms512m", "-Xmx2048m","-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=web", "-jar", "cx-flow.jar"]
EXPOSE 8080

FROM alpine:3.18.4 AS cxgo8

Expand Down
Loading

0 comments on commit 4347268

Please sign in to comment.