Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
21efe12
test jenkinsfile
justinyeh1995 Jun 6, 2023
b46c853
test jenkinsfile
justinyeh1995 Jun 6, 2023
97b703e
test pipeline
justinyeh1995 Jun 6, 2023
0a01deb
test pipeline
justinyeh1995 Jun 6, 2023
07741b9
test pipeline
justinyeh1995 Jun 6, 2023
a3b33f4
test pipeline
justinyeh1995 Jun 6, 2023
5ed49bd
test trigger & post action - email
justinyeh1995 Jun 6, 2023
e6c4daf
test trigger & post action - email
justinyeh1995 Jun 6, 2023
228c780
test trigger & post action - email
justinyeh1995 Jun 6, 2023
80fe60a
test trigger & post action - email
justinyeh1995 Jun 6, 2023
6efba48
test email notifications
justinyeh1995 Jun 7, 2023
d90df87
test email notifications
justinyeh1995 Jun 7, 2023
6730abb
test email notifications
justinyeh1995 Jun 7, 2023
803237d
test email notifications
justinyeh1995 Jun 7, 2023
9414297
test email notifications
justinyeh1995 Jun 7, 2023
f7a7ef7
test email notifications
justinyeh1995 Jun 7, 2023
cee0bfe
test email notifications
justinyeh1995 Jun 7, 2023
9206f8d
test email notifications
justinyeh1995 Jun 7, 2023
82eb6f0
test email notifications
justinyeh1995 Jun 7, 2023
7b563b8
test email notifications
justinyeh1995 Jun 7, 2023
6bf574b
test email notifications
justinyeh1995 Jun 7, 2023
21e727f
test email notifications
justinyeh1995 Jun 7, 2023
2708d7b
test email notifications
justinyeh1995 Jun 7, 2023
a7c6fca
test email notifications
justinyeh1995 Jun 7, 2023
4960bee
on to the build stage
justinyeh1995 Jun 7, 2023
f11b40c
pollSCM time change
justinyeh1995 Jun 7, 2023
068b816
add deckerfile template
justinyeh1995 Jun 8, 2023
d78e003
extend dockerfile
justinyeh1995 Jun 8, 2023
0def760
need to resolve archiva part
justinyeh1995 Jun 9, 2023
ac6bbf0
for first build systemd settings
justinyeh1995 Jun 12, 2023
1231995
update dockerfile
justinyeh1995 Jun 12, 2023
0fdd4ed
for first build gradle settings
justinyeh1995 Jun 12, 2023
4ec4995
keep updating dockerfile
justinyeh1995 Jun 12, 2023
78e8b03
keep updating Dockerfile
justinyeh1995 Jun 13, 2023
02cc2b8
testing docker containers
justinyeh1995 Jun 14, 2023
3660640
testing docker containers
justinyeh1995 Jun 14, 2023
c98b9d0
testing docker containers
justinyeh1995 Jun 14, 2023
9eb3f22
testing docker containers
justinyeh1995 Jun 14, 2023
e53a08f
testing docker containers
justinyeh1995 Jun 14, 2023
e0792c4
testing docker containers
justinyeh1995 Jun 14, 2023
1b820af
test
justinyeh1995 Jun 14, 2023
2d19cd2
test
justinyeh1995 Jun 14, 2023
bb719f1
test
justinyeh1995 Jun 14, 2023
36d419d
testing
justinyeh1995 Jun 14, 2023
23bd08d
testing
justinyeh1995 Jun 14, 2023
6899be5
testing
justinyeh1995 Jun 14, 2023
9244491
testing
justinyeh1995 Jun 14, 2023
2bc75c6
testing
justinyeh1995 Jun 14, 2023
f80d263
archiva accessible through localhost:8081 on host machine but service…
justinyeh1995 Jun 14, 2023
662a551
alternative exe file for aarch64 machine to run archiva
justinyeh1995 Jun 14, 2023
2c74c3a
always -> on-failure
justinyeh1995 Jun 14, 2023
fe5a120
it runs now
justinyeh1995 Jun 14, 2023
dc15c5d
the image generate running containers
justinyeh1995 Jun 14, 2023
2b73448
the image generate running containers
justinyeh1995 Jun 14, 2023
7c530ec
the image generate running containers
justinyeh1995 Jun 15, 2023
4fabe15
the image generate running containers
justinyeh1995 Jun 15, 2023
c37e62a
updated archiva.xml
justinyeh1995 Jun 16, 2023
781a923
build container
justinyeh1995 Jun 16, 2023
ca18780
actually experiment script
justinyeh1995 Jun 16, 2023
cff98bb
csrf=false
justinyeh1995 Jun 16, 2023
327dcab
csrf=false
justinyeh1995 Jun 16, 2023
355b435
add sleep 10 to wait archiva
justinyeh1995 Jun 16, 2023
a28dfdd
archiva admin issue solved
justinyeh1995 Jun 16, 2023
08a0d14
testing for now
justinyeh1995 Jun 20, 2023
3cee414
update exp wrapper
justinyeh1995 Jun 20, 2023
b0c9d85
integrate the lifecycle of the actual exp
justinyeh1995 Jun 20, 2023
e57943e
integrate the lifecycle of the actual exp
justinyeh1995 Jun 20, 2023
2e61c95
integrate the lifecycle of the actual exp
justinyeh1995 Jun 20, 2023
6d4e5dd
try docker pipeline plugin groovy syntax
justinyeh1995 Jun 21, 2023
283f036
try docker pipeline plugin groovy syntax
justinyeh1995 Jun 21, 2023
70e3ec2
try docker pipeline plugin groovy syntax
justinyeh1995 Jun 21, 2023
608e3cd
try docker pipeline plugin groovy syntax
justinyeh1995 Jun 21, 2023
09ef5e4
try docker pipeline plugin groovy syntax
justinyeh1995 Jun 21, 2023
32b24a7
try docker pipeline plugin groovy syntax
justinyeh1995 Jun 21, 2023
c96de34
try docker pipeline plugin groovy syntax
justinyeh1995 Jun 21, 2023
3799f4a
try docker pipeline plugin groovy syntax
justinyeh1995 Jun 21, 2023
0def20b
integrate the lifecycle of the actual exp
justinyeh1995 Jun 21, 2023
bab57a1
set +e
justinyeh1995 Jun 21, 2023
f05eafb
set +e
justinyeh1995 Jun 21, 2023
75f9c95
check network stage
justinyeh1995 Jun 21, 2023
5725716
check network stage
justinyeh1995 Jun 21, 2023
01f41f1
testing on ubuntu20.04 VM
justinyeh1995 Jun 21, 2023
5be5c46
Merge branch 'SimIntToolkit:develop' into develop
justinyeh1995 Jun 21, 2023
24faedd
set java to 17 after starting archiva
justinyeh1995 Jun 22, 2023
d34f50d
testing purpose
justinyeh1995 Jun 22, 2023
f1c6e39
minor update
justinyeh1995 Jun 22, 2023
0c929e3
install gradle7.5 manually
justinyeh1995 Jun 22, 2023
4ee4252
switch between java 8 & java 17
justinyeh1995 Jun 22, 2023
8a435fd
switch between java 8 & java 17
justinyeh1995 Jun 22, 2023
3227afd
testing out gradle settings
justinyeh1995 Jun 26, 2023
c071ec1
batch mode
justinyeh1995 Jun 26, 2023
d534d39
resolve global gradle properties
justinyeh1995 Jun 26, 2023
0a55b82
add build
justinyeh1995 Jun 26, 2023
8c2f35b
delete unnecessary lines
justinyeh1995 Jun 26, 2023
63bdb95
add timeout on waiting
justinyeh1995 Jun 27, 2023
4d6c279
demo
justinyeh1995 Jun 29, 2023
c65890b
demo
justinyeh1995 Jun 29, 2023
be2cbc8
test timeout
justinyeh1995 Jun 29, 2023
5071c18
demo
justinyeh1995 Jun 29, 2023
e12b272
10 min timeout
justinyeh1995 Jun 29, 2023
fe377d3
timeout at 20min
justinyeh1995 Jul 4, 2023
ff781fc
layout
justinyeh1995 Jul 4, 2023
7813d9c
layout
justinyeh1995 Jul 4, 2023
a1dda62
sync with cpswt-build
justinyeh1995 Sep 20, 2023
88f3e3c
remove unnessesary files
justinyeh1995 Sep 20, 2023
387ba90
align with SimIntToolkit/cpswt-core
justinyeh1995 Sep 20, 2023
d9109a3
forked repo -> main repo
justinyeh1995 Sep 20, 2023
9c48780
forked repo -> main repo
justinyeh1995 Sep 20, 2023
c75e653
Jenkins Pipeline Setup
justinyeh1995 Oct 3, 2023
6f04e5b
update readme
justinyeh1995 Oct 3, 2023
7f5f911
start addressing comment & restructure files
justinyeh1995 Feb 2, 2024
c4fc388
restructure files
justinyeh1995 Feb 2, 2024
7eb6fef
address review; may cause build to fail
justinyeh1995 Feb 2, 2024
9c7bc04
address review; may cause build to fail
justinyeh1995 Feb 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .jenkins/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Base image: Ubuntu 20.04
FROM ubuntu:20.04
LABEL maintainer="CPSWT Team"

# Set it to noninteractive mode
ARG DEBIAN_FRONTEND=noninteractive

# Install necessary packages
RUN apt-get update && \
apt-get install -y \
apt-transport-https \
bison \
build-essential \
ca-certificates \
clang \
curl \
doxygen \
flex \
gcc \
gdb \
git \
graphviz \
libboost1.71-all-dev \
libcppunit-dev \
libjsoncpp-dev \
libosgearth-dev \
libqt5opengl5-dev \
libwebkit2gtk-4.0-37 \
libxml2-dev \
lld \
make \
mongodb \
mpi-default-dev \
netcat \
openjdk-8-jdk \
openjdk-17-jdk \
openscenegraph-plugin-osgearth \
perl \
python2 \
python3 \
python3-pip \
python-is-python2 \
qt5-qmake \
qtbase5-dev \
qtbase5-dev-tools \
qtchooser \
software-properties-common \
wget \
xterm \
zlib1g-dev \
unzip \
zip

#install Gradle
ARG GRADLE_VERSION=7.5
RUN wget -O gradle.zip https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip && \
mkdir /opt/gradle && \
unzip -d /opt/gradle gradle.zip && \
rm gradle.zip
# Set Gradle in the environment variables
ENV GRADLE_HOME="/opt/gradle/gradle-${GRADLE_VERSION}"
ENV PATH="${GRADLE_HOME}/bin:${PATH}"

# Install Python packages
RUN python3 -m pip install --system --upgrade \
jinja2 \
matplotlib \
numpy \
pandas \
posix_ipc \
scipy \
seaborn \
webgme-bindings

# Download and extract portico
WORKDIR /home
RUN wget -O portico.tar.gz https://master.dl.sourceforge.net/project/portico/Portico/portico-2.1.0/portico-2.1.0-linux64.tar.gz?viasf=1 && \
tar xf portico.tar.gz && \
rm portico.tar.gz
ENV RTI_HOME="/home/portico-2.1.0"

# Download and set up Apache Archiva
WORKDIR /opt
RUN wget -O archiva.tar.gz https://archive.apache.org/dist/archiva/2.2.5/binaries/apache-archiva-2.2.5-bin.tar.gz && \
tar xf archiva.tar.gz && \
rm archiva.tar.gz

# Expose the Archiva port
EXPOSE 8080/tcp

# Use SIGINT for stopping
STOPSIGNAL SIGINT

# Set up Gradle properties
COPY gradle.properties /root/.gradle/
RUN chmod 600 /root/.gradle/gradle.properties

# Clone and build CPSWT packages
RUN mkdir /home/cpswt
COPY experiment_wrapper.sh /home/cpswt

WORKDIR /home/cpswt
# Start Archiva
CMD [ "/usr/bin/bash", "experiment_wrapper.sh" ]
# CMD [ "/usr/bin/bash" ]

74 changes: 74 additions & 0 deletions .jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Do NOT place within the pipeline block
properties([ [ $class: 'ThrottleJobProperty',
categories: ['ci_cpswt_build'],
limitOneJobWithMatchingParams: false,
maxConcurrentPerNode: 1,
maxConcurrentTotal: 1,
paramsToUseForLimit: '',
throttleEnabled: true,
throttleOption: 'category' ] ])

pipeline {
agent any
triggers {
pollSCM('*/1 * * * *') // poll the SCM every 1 minutes
}

stages {
stage('Clone repository') {
steps {
echo 'Cloning Forked CPSWT-Core..'
deleteDir() // Delete workspace before cloning
sh 'git clone git@github.com:justinyeh1995/CI_with_Jenkins.git'
}
}
stage('Build image') {
steps {
echo 'Start a Docker Container for this experiment, which should start the experiment and a archiva server, a inet server, and a omnet++ server..'
dir("CI_with_Jenkins/cpswt-core") {
sh 'docker build -t cpswt-core:latest -f Dockerfile .'
}
}
}
stage('Deploy image') {
steps {
echo 'Run the Docker Container inside Jenkins container'
sh 'docker run \
--name cpswt-core \
-p 8081:8080 \
cpswt-core:latest'
}
}
stage('Wait for container to stop') {
options {
timeout(time: 30, unit: 'MINUTES')
}
steps {
echo 'Wait for container to stop'
sh 'docker wait cpswt-core'
}
}
stage('Archive loggings') {
steps {
echo 'Archiving the results...'
sh 'docker logs cpswt-core > cpswt-core.log'
archiveArtifacts artifacts: 'cpswt-core.log', fingerprint: true
}
}
}

post {
always {
echo 'This will always run'
emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']],
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}",
attachLog: true,
attachmentsPattern: 'cpswt-core.log'
echo 'Tearing Down the image & container....'
sh 'docker rm -f cpswt-core'
sh 'docker rmi cpswt-core:latest'
sh 'rm -rf cpswt-core'
}
}
}
104 changes: 104 additions & 0 deletions .jenkins/experiment_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# this script is used to build cpswt-core and its dependencies in the docker container
ORIGINAL_PATH=$PATH
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH

/opt/apache-archiva-2.2.5/bin/archiva start

# wait for archiva to start
# wait for archiva to start
echo "Waiting archiva to launch on 8080..."

while ! nc -z localhost 8080; do
sleep 0.1 # wait for 1/10 of the second before check again
done

echo "archiva launched"

# create admin user
curl --no-progress-meter -X POST -H "Content-Type: application/json" -H "Origin: http://localhost:8080" -d @- \
http://localhost:8080/restServices/redbackServices/userService/createAdminUser <<'TERMINUS'
{
"username": "admin",
"password": "adminpass123",
"email": "admin@archiva-test.org",
"fullName": "Admin",
"locked": false,
"passwordChangeRequired": false,
"permanent": false,
"readOnly": false,
"validated": true,
"confirmPassword": "adminpass123"
}
TERMINUS

# disable rest.csrffilter.enabled in archiva.xml
sed -i '/<rest>/,/<\/csrffilter>/s/<enabled>true/<enabled>false/' /opt/apache-archiva-2.2.5/conf/archiva.xml
# sed -i 's/<baseUrl\/>/<baseUrl>http:\/\/129.59.107.97\/archiva-core\/<\/baseUrl>/' /opt/apache-archiva-2.2.5/conf/archiva.xml

# # restart archiva
/opt/apache-archiva-2.2.5/bin/archiva stop
/opt/apache-archiva-2.2.5/bin/archiva start

echo "Waiting archiva to launch again on 8080..."

while ! nc -z localhost 8080; do
sleep 0.1 # wait for 1/10 of the second before check again
done

echo "archiva launched again"

# switch to java 17
unset JAVA_HOME
export JAVA_HOME=/usr/lib/jvm/java-1.17.0-openjdk-amd64
export PATH=$JAVA_HOME/bin:$ORIGINAL_PATH

# clone cpswt-core and build it
cd /home/cpswt
git clone https://github.com/SimIntToolkit/cpswt-core.git
cd cpswt-core/cpswt-core

gradle wrapper --gradle-version=8.0

ARCHIVA_REPO_URL="http://localhost:8080/repository/snapshots/0.8.0-SNAPSHOT/"

# sh ./cpswt-redeploy.sh
./gradlew :utils:build --rerun-tasks --refresh-dependencies
./gradlew :utils:publish
echo "utils published"

./gradlew :root:build --rerun-tasks --refresh-dependencies
./gradlew :root:publish
echo "root published"

./gradlew :base-events:build --rerun-tasks --refresh-dependencies
./gradlew :base-events:publish
echo "base-events published"

./gradlew :config:build --rerun-tasks --refresh-dependencies
./gradlew :config:publish
echo "config published"

./gradlew :federate-base:build --rerun-tasks --refresh-dependencies
./gradlew :federate-base:publish
echo "federate-base published"

./gradlew :coa:build --rerun-tasks --refresh-dependencies
./gradlew :coa:publish
echo "coa published"

./gradlew :federation-manager:build --rerun-tasks --refresh-dependencies
./gradlew :federation-manager:publish
echo "federation-manager published"

./gradlew :fedmanager-host:build --rerun-tasks --refresh-dependencies
./gradlew :fedmanager-host:publish
echo "fedmanager-host published"

# run the HelloWorldJava example
cd /home/cpswt/cpswt-core/examples/HelloWorldJava
gradle wrapper --gradle-version=8.0
./gradlew :Source:build
./gradlew :Sink:build
./gradlew :PingCounter:build
./gradlew :runFederationBatch
9 changes: 9 additions & 0 deletions .jenkins/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
archivaUser=admin
archivaPassword=adminpass123
archivaHostId=localhost
archivaPort=8080
version=0.8.0-SNAPSHOT

org.gradle.console=plain

omnetppHome=/opt/omnetpp-5.6.2
Loading