Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft PR for review comments of infraclouds contributions #2

Draft
wants to merge 449 commits into
base: infracloud/cassandra-5.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
449 commits
Select commit Hold shift + click to select a range
7d2b552
updated echo command
richamishra006 Sep 21, 2023
c337a82
Merge branch 'infracloud/cassandra-5.0' of https://github.com/infracl…
richamishra006 Sep 21, 2023
96799ad
updated echo command
richamishra006 Sep 21, 2023
b90db0a
updated file
richamishra006 Sep 22, 2023
9e0848e
updated file
richamishra006 Sep 22, 2023
9d5c38e
updated file
richamishra006 Sep 22, 2023
6a1cdf6
updated file
richamishra006 Sep 22, 2023
66b153d
updated file
richamishra006 Sep 22, 2023
c0b12dc
updated file
richamishra006 Sep 22, 2023
9f86207
updated file
richamishra006 Sep 22, 2023
fae1c01
updated file
richamishra006 Sep 22, 2023
0a5f6af
updated file
richamishra006 Sep 22, 2023
be11cf6
updated image tag added bc and timeout
richamishra006 Sep 22, 2023
f4b7897
updated image tag added bc and timeout
richamishra006 Sep 22, 2023
f5e1ae1
updated file
richamishra006 Sep 22, 2023
82a1589
updated file
richamishra006 Sep 22, 2023
f61f449
uncommented stash unstash block
richamishra006 Sep 25, 2023
e1f2333
uncommented stash unstash block
richamishra006 Sep 25, 2023
bb28801
reverted change
richamishra006 Sep 25, 2023
e2cbcbe
updated stash unstash block
richamishra006 Sep 25, 2023
108d2b0
updated stash unstash block
richamishra006 Sep 25, 2023
24fb78d
updated stash unstash block
richamishra006 Sep 25, 2023
ecd22b2
updated stash unstash block
richamishra006 Sep 25, 2023
3b5eb23
updated stash unstash block
richamishra006 Sep 25, 2023
6ac257f
updated stash unstash block
richamishra006 Sep 25, 2023
647c1c1
updated stash unstash block
richamishra006 Sep 25, 2023
fcf2a7c
updated stash unstash block
richamishra006 Sep 25, 2023
f60f1e8
updated stash unstash block
richamishra006 Sep 25, 2023
9e0633f
updated stash unstash block
richamishra006 Sep 25, 2023
1556417
updated stash unstash block
richamishra006 Sep 25, 2023
7e0d4aa
update pipeline.jenkins file
Nbarola Sep 26, 2023
7f0b241
reverted changes
richamishra006 Sep 26, 2023
10d6323
Merge branch 'infracloud/cassandra-5.0' of https://github.com/infracl…
richamishra006 Sep 26, 2023
e5565f4
update jenkins jenkins file
Nbarola Sep 26, 2023
cb2a0b7
Merge branch 'infracloud/cassandra-5.0' of github.com:infracloudio/ca…
Nbarola Sep 26, 2023
2e8d9e1
update jenkins jenkins file
Nbarola Sep 26, 2023
ae5c475
update jenkins jenkins file
Nbarola Sep 26, 2023
fdbf9cf
reverted changes
richamishra006 Sep 26, 2023
ac463d7
Merge branch 'infracloud/cassandra-5.0' of https://github.com/infracl…
richamishra006 Sep 26, 2023
fa3f81a
updated volume
richamishra006 Sep 27, 2023
d7b7e4d
updated volume name
richamishra006 Sep 27, 2023
446ca14
updated pipeline
richamishra006 Sep 27, 2023
58c36f6
updated pipeline
richamishra006 Sep 27, 2023
431385f
update stash code in jenkins.pipeline
Nbarola Sep 28, 2023
379d325
update stash code in jenkins.pipeline
Nbarola Sep 28, 2023
f1dbace
update stash code in jenkins.pipeline
Nbarola Sep 28, 2023
dcb8726
update stash code in jenkins.pipeline
Nbarola Sep 28, 2023
faac81a
update stash code in jenkins.pipeline
Nbarola Sep 28, 2023
99cc876
update stash code in jenkins.pipeline
Nbarola Sep 28, 2023
61bcad7
updated pipeline
richamishra006 Sep 28, 2023
82224fe
updated pipeline
richamishra006 Sep 28, 2023
3051892
updated pipeline
richamishra006 Sep 28, 2023
499af2f
updated pipeline
richamishra006 Sep 28, 2023
13ff92f
updated pipeline
richamishra006 Sep 28, 2023
23bb558
updated pipeline
richamishra006 Oct 3, 2023
d951683
updated pipeline
richamishra006 Oct 3, 2023
68df97f
updated pipeline
richamishra006 Oct 3, 2023
c3830b3
updated pipeline
richamishra006 Oct 3, 2023
218e983
updated pipeline
richamishra006 Oct 3, 2023
217c0c3
updated pipeline
richamishra006 Oct 3, 2023
bbcb26d
updated pipeline
richamishra006 Oct 3, 2023
08ee5d4
updated pipeline
richamishra006 Oct 3, 2023
87fb545
updated pipeline
richamishra006 Oct 3, 2023
1626567
updated pipeline
richamishra006 Oct 3, 2023
9b10365
updated pipeline
richamishra006 Oct 3, 2023
006c593
updated pipeline
richamishra006 Oct 3, 2023
2bff62b
updated pipeline
richamishra006 Oct 3, 2023
7c48fe3
updated pipeline
richamishra006 Oct 3, 2023
d486827
updated pipeline
richamishra006 Oct 3, 2023
245ed22
update pipeline.jenkins
Nbarola Oct 3, 2023
7b3b36a
updated file
richamishra006 Oct 3, 2023
2fb9d30
added trim
richamishra006 Oct 3, 2023
65a8835
updated pipeline
richamishra006 Oct 3, 2023
bd837ed
updated pipeline
richamishra006 Oct 3, 2023
886d7eb
updated pipeline
richamishra006 Oct 3, 2023
c28eb0a
updated pipeline
richamishra006 Oct 4, 2023
bcba87d
updated pipeline
richamishra006 Oct 4, 2023
0111793
updated pipeline
richamishra006 Oct 4, 2023
1e595bc
updated sleep
richamishra006 Oct 4, 2023
09283df
updated cp command
richamishra006 Oct 4, 2023
c341abc
updated pipeline
richamishra006 Oct 4, 2023
ec091fe
updated pipeline
richamishra006 Oct 4, 2023
3d6e2bd
updated pipeline
richamishra006 Oct 4, 2023
078ca8e
updated pipeline
richamishra006 Oct 4, 2023
395b9be
updated build dir
richamishra006 Oct 5, 2023
f2a2504
updated build dir
richamishra006 Oct 5, 2023
ed247ae
added summary and fqltool
richamishra006 Oct 5, 2023
059b2c7
updated summary
richamishra006 Oct 5, 2023
fbbbbe4
updated pipeline
richamishra006 Oct 5, 2023
d6ec04d
updated pipeline
richamishra006 Oct 5, 2023
0f3e13e
updated pipeline
richamishra006 Oct 5, 2023
04dde10
updated pipeline
richamishra006 Oct 5, 2023
62909cb
update pipeline.jenkins
Nbarola Oct 6, 2023
4ff1bce
update pipeline.jenkins
Nbarola Oct 6, 2023
0bc5d09
update pipeline.jenkins with temp build dir for test jobs
Nbarola Oct 6, 2023
d603628
fix comment in pipeline.jenkins
Nbarola Oct 6, 2023
6e8efd9
fix typo in pipeline.jenkins
Nbarola Oct 6, 2023
c95bd00
provide 1/1 for split for testAxix in pipeline.jenkins
Nbarola Oct 6, 2023
5cf5a81
add create build dir for testAxis() in pipeline.jenkins
Nbarola Oct 6, 2023
7bd388f
update path for docker cp
Nbarola Oct 6, 2023
b73b5d0
update path for docker cp
Nbarola Oct 6, 2023
1adb11c
add DIST dir variable to run the test script in pipeline.jenkins
Nbarola Oct 6, 2023
63694b5
add DIST dir argument to run the test script in pipeline.jenkins
Nbarola Oct 6, 2023
d5db683
add DIST dir argument to run the test script in pipeline.jenkins
Nbarola Oct 6, 2023
e5c45fc
add current_build_dir argument to run the test script in pipeline.jen…
Nbarola Oct 6, 2023
b978768
add current_build_dir argument to run the test script in pipeline.jen…
Nbarola Oct 6, 2023
08189f1
add current_build_dir argument to run the test script in pipeline.jen…
Nbarola Oct 6, 2023
5ca5833
fix current_build_dir argument to run the test script in pipeline.jen…
Nbarola Oct 6, 2023
7d35fb3
fix run-test.sh
Nbarola Oct 6, 2023
bafeb6c
fix run-test.sh
Nbarola Oct 6, 2023
b7405df
added sleep to troubleshoot
richamishra006 Oct 9, 2023
8e3ffd1
add ant opt build dir to .build/run-tests.sh
Nbarola Oct 9, 2023
c6ede46
Merge branch 'infracloud/cassandra-5.0' of github.com:infracloudio/ca…
Nbarola Oct 9, 2023
aef256f
resolved conflicts
richamishra006 Oct 9, 2023
3f37ec5
resolved conflicts
richamishra006 Oct 9, 2023
ffd55f6
updated command
richamishra006 Oct 9, 2023
7e68e82
updated junit command
richamishra006 Oct 9, 2023
7de2a55
updated junit command
richamishra006 Oct 9, 2023
17a797d
updated junit command
richamishra006 Oct 9, 2023
5c0ac21
updated junit command
richamishra006 Oct 9, 2023
1753aa3
updated junit command
richamishra006 Oct 9, 2023
4148183
commented artifacts to troubleshoot
richamishra006 Oct 9, 2023
ff86cf1
commented artifacts to troubleshoot
richamishra006 Oct 9, 2023
68dceab
commented artifacts to troubleshoot
richamishra006 Oct 9, 2023
7d900e8
commented artifacts to troubleshoot
richamishra006 Oct 9, 2023
291c042
commented artifacts to troubleshoot
richamishra006 Oct 9, 2023
729f8cd
commented artifacts to troubleshoot
richamishra006 Oct 9, 2023
b5adf2f
modify pipeline.jenkins for troubleshooting
Nbarola Oct 9, 2023
d822ffe
modify pipeline.jenkins for troubleshooting
Nbarola Oct 9, 2023
5cfd2a9
modify run-tests.sh for troubleshooting
Nbarola Oct 9, 2023
83ba764
modify junit command for troubleshooting
Nbarola Oct 9, 2023
1862029
modify junit with relative path command for troubleshooting
Nbarola Oct 9, 2023
a171ab4
modify piepline.jenkins file
Nbarola Oct 9, 2023
c2d0643
modify piepline.jenkins file
Nbarola Oct 9, 2023
8b2c14d
modify piepline.jenkins file
Nbarola Oct 9, 2023
d08eded
added symlink command
richamishra006 Oct 10, 2023
6d9b24e
added symlink command
richamishra006 Oct 10, 2023
7cf493c
updated symlink command
richamishra006 Oct 10, 2023
8b3eb0d
updated symlink command
richamishra006 Oct 10, 2023
8165818
commented symlink
richamishra006 Oct 10, 2023
c2ef545
commented symlink
richamishra006 Oct 10, 2023
17e1e36
commented symlink
richamishra006 Oct 10, 2023
6e094ac
updated symlink
richamishra006 Oct 10, 2023
bc787be
updated symlink
richamishra006 Oct 10, 2023
5b0a0d9
updated symlink
richamishra006 Oct 10, 2023
0445a3e
updated symlink
richamishra006 Oct 10, 2023
9b51d62
updated symlink
richamishra006 Oct 10, 2023
77e3f44
added sleep for troubleshooting
richamishra006 Oct 10, 2023
420232f
added sleep for troubleshooting
richamishra006 Oct 10, 2023
e957b1a
added sleep for troubleshooting
richamishra006 Oct 10, 2023
579b71b
removed sleep command
richamishra006 Oct 10, 2023
0ee7f7a
added symlink command
richamishra006 Oct 10, 2023
8801460
added sleep
richamishra006 Oct 10, 2023
704b80f
removed security context
richamishra006 Oct 10, 2023
0c3d81a
added sleep
richamishra006 Oct 10, 2023
b380716
added sleep
richamishra006 Oct 10, 2023
d34b6de
added symlink command
richamishra006 Oct 10, 2023
517f17b
added symlink command
richamishra006 Oct 10, 2023
9b2d1f1
added symlink command
richamishra006 Oct 10, 2023
9b4980c
added symlink command
richamishra006 Oct 10, 2023
546cf95
updated
richamishra006 Oct 10, 2023
2109074
updated
richamishra006 Oct 10, 2023
84e6595
updated
richamishra006 Oct 10, 2023
2207f9f
added sleep
richamishra006 Oct 10, 2023
fe31a27
added sleep
richamishra006 Oct 10, 2023
18295df
troubleshooting container
richamishra006 Oct 10, 2023
b4cbd6a
troubleshooting container
richamishra006 Oct 10, 2023
ad4d06a
troubleshooting container
richamishra006 Oct 10, 2023
3f99f2f
added cassandra dir env value
richamishra006 Oct 10, 2023
d98613e
Merge pull request #1 from thelastpickle/mck/license-defaults-precond…
richamishra006 Oct 11, 2023
3d97537
updated script
richamishra006 Oct 11, 2023
98c3ede
updated script
richamishra006 Oct 11, 2023
c3a1a32
updated script
richamishra006 Oct 11, 2023
a59258b
updated script
richamishra006 Oct 11, 2023
8da7257
add mount bind in pipeline.jenkins
Nbarola Oct 11, 2023
1942c8d
add mount bind in pipeline.jenkins
Nbarola Oct 11, 2023
d87111d
add sleep to troubleshoot mount bind in pipeline.jenkins
Nbarola Oct 11, 2023
9112b04
add securityContext as privileged in pipeline.jenkins
Nbarola Oct 11, 2023
238b21d
add securityContext as SYS_ADMIN in pipeline.jenkins
Nbarola Oct 11, 2023
46838ce
add securityContext as root user in pipeline.jenkins
Nbarola Oct 11, 2023
392c486
add securityContext as root user and privileged in pipeline.jenkins
Nbarola Oct 11, 2023
837df0b
remove sleep added previously for troubleshooting in pipeline.jenkins
Nbarola Oct 11, 2023
6ac16ab
add switch user to jenkins in pipeline.jenkins
Nbarola Oct 11, 2023
385eaec
updated init container
richamishra006 Oct 12, 2023
b0f4083
updated init container
richamishra006 Oct 12, 2023
baa58fd
updated init container
richamishra006 Oct 12, 2023
668755b
updated init container
richamishra006 Oct 12, 2023
dd547a6
updated init container
richamishra006 Oct 12, 2023
dd34428
updated init container
richamishra006 Oct 12, 2023
e8377c8
updated init container
richamishra006 Oct 12, 2023
9549f12
updated init container
richamishra006 Oct 12, 2023
3f33e1f
updated init container
richamishra006 Oct 12, 2023
ebd05b3
updated init container
richamishra006 Oct 12, 2023
159e867
updated docker command
richamishra006 Oct 12, 2023
ae5fb90
updated docker command
richamishra006 Oct 12, 2023
a2f5fe7
updated docker command
richamishra006 Oct 12, 2023
4a42255
updated docker command
richamishra006 Oct 12, 2023
b77830b
updated dockerfile
richamishra006 Oct 12, 2023
90937ff
updated pipeline mount command
richamishra006 Oct 12, 2023
ebb332f
updated pipeline mount command
richamishra006 Oct 12, 2023
37d4a19
updated pipeline mount command
richamishra006 Oct 12, 2023
b961834
updated test stage
richamishra006 Oct 12, 2023
3c5840e
updated logfile command
richamishra006 Oct 12, 2023
38eadd2
updated logcommand
richamishra006 Oct 12, 2023
68ededd
add string paramter to pipeline.jenkins to provide which stages to run
Nbarola Oct 13, 2023
6ab307d
add string paramter to pipeline.jenkins to provide which stages to run
Nbarola Oct 13, 2023
7dfb474
remove temp output dir
Nbarola Oct 13, 2023
5a88e4f
remove step within step in pipeline.jenkins
Nbarola Oct 13, 2023
7060a8d
clean build artifact comments in pipeline.jenkins
Nbarola Oct 13, 2023
fb4122b
comment artifact stage for troubleshooting in pipeline.jenkins
Nbarola Oct 13, 2023
d37ffb8
comment artifact stage for troubleshooting in pipeline.jenkins
Nbarola Oct 13, 2023
7773805
all echo for troubleshooting in pipeline.jenkins
Nbarola Oct 13, 2023
d5c0e25
add echo for troubleshooting in pipeline.jenkins
Nbarola Oct 13, 2023
015c9e5
updated pipleine
richamishra006 Oct 13, 2023
c9328f9
updated pipeline
richamishra006 Oct 13, 2023
20eb15a
resolve conflicts
Nbarola Oct 13, 2023
b2e3ab0
revert changes in build-jars.sh
Nbarola Oct 13, 2023
c2974b6
uncomment artifacts build job after troubleshooting in pipeline.jenkins
Nbarola Oct 13, 2023
b1faf35
add default values for include-test-stage variable in run-ci.sh
Nbarola Oct 13, 2023
d43af09
refined jenkinsfile and scripts
richamishra006 Oct 13, 2023
2a3d6c2
changed the mount path
richamishra006 Oct 13, 2023
13b89a5
updated mount path
richamishra006 Oct 13, 2023
4f9f82d
reverted mount path
richamishra006 Oct 13, 2023
45d8aa2
updated job name
richamishra006 Oct 16, 2023
88ad70c
reverted job name
richamishra006 Oct 16, 2023
1862109
add stringParam to pipelineJob in DslJob.jenkins
Nbarola Oct 16, 2023
d6ee789
Merge branch 'infracloud/cassandra-5.0' of github.com:infracloudio/ca…
Nbarola Oct 16, 2023
acaed3e
parameterise repo-url and repo-branch for jenkins-deployment.yaml in …
Nbarola Oct 16, 2023
d84b73b
remove nodeSelector from the k8s agent pod template
Nbarola Oct 17, 2023
38c27a1
updated buildjob command
richamishra006 Oct 17, 2023
d714963
Merge branch 'infracloud/cassandra-5.0' of https://github.com/infracl…
richamishra006 Oct 17, 2023
3e94a1c
reverted buildjob command
richamishra006 Oct 17, 2023
93482ef
updated buildjob command
richamishra006 Oct 17, 2023
a3f7b1a
fixed typo
richamishra006 Oct 17, 2023
2bfe665
reverted changes
richamishra006 Oct 17, 2023
be5f02e
added few changes in script
richamishra006 Oct 17, 2023
49c15df
update jenkins deployment deployment name
Nbarola Oct 17, 2023
742e923
update jenkins deployment name in run-ci.sh
Nbarola Oct 17, 2023
b696aee
add tear-down and portforwarding process termination in run-ci.sh
Nbarola Oct 18, 2023
b8f9e3a
Update the fetch result code in .build/run-ci.sh
Nbarola Oct 18, 2023
9d1765c
remove dsljob and pipelinecopy jenkinsfiles
Nbarola Oct 18, 2023
3490fdd
move agent-build.docker file
Nbarola Oct 18, 2023
80a2e43
move jenkins-deployment.yaml file
Nbarola Oct 18, 2023
fa39706
update tear-down to remove the jenkins operator along with jenkins in…
Nbarola Oct 18, 2023
653e3b1
add k8s sub dir to .jenkins dir
Nbarola Oct 18, 2023
6d47a1e
update comment in --help case in run-ci.sh
Nbarola Oct 18, 2023
c0572a2
parameterise job-name in run-ci.sh
Nbarola Oct 20, 2023
7613a52
update echo statements in run-ci.sh
Nbarola Oct 20, 2023
2b89e51
update sed command in run-ci.sh
Nbarola Oct 20, 2023
3710ca5
add sleep after port-forward in run-ci.sh
Nbarola Oct 20, 2023
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
2 changes: 1 addition & 1 deletion .build/build-jars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# variables, with defaults
[ "x${CASSANDRA_DIR}" != "x" ] || CASSANDRA_DIR="$(readlink -f $(dirname "$0")/..)"

echo "$CASSANDRA_DIR from build_jar"
# pre-conditions
command -v ant >/dev/null 2>&1 || { echo >&2 "ant needs to be installed"; exit 1; }
[ -d "${CASSANDRA_DIR}" ] || { echo >&2 "Directory ${CASSANDRA_DIR} must exist"; exit 1; }
Expand Down
16 changes: 11 additions & 5 deletions .build/docker/_docker_run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -x
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
Expand Down Expand Up @@ -30,7 +30,7 @@
[ "x${cassandra_dir}" != "x" ] || cassandra_dir="$(readlink -f $(dirname "$0")/../..)"
[ "x${build_dir}" != "x" ] || build_dir="${cassandra_dir}/build"
[ -d "${build_dir}" ] || { mkdir -p "${build_dir}" ; }

echo "$CASSANDRA_DIR from _docker_run"
java_version_default=`grep 'property\s*name="java.default"' ${cassandra_dir}/build.xml |sed -ne 's/.*value="\([^"]*\)".*/\1/p'`
java_version_supported=`grep 'property\s*name="java.supported"' ${cassandra_dir}/build.xml |sed -ne 's/.*value="\([^"]*\)".*/\1/p'`

Expand Down Expand Up @@ -111,9 +111,13 @@ container_name="cassandra_${dockerfile/.docker/}_${un_script_name}_jdk${java_ver
# change ant's build directory to $DIST_DIR
# set java to java_version
# execute the run_script
# docker_command="export ANT_OPTS=\"-Dbuild.dir=\${DIST_DIR} ${CASSANDRA_DOCKER_ANT_OPTS}\" ; \
# source \${CASSANDRA_DIR}/.build/docker/_set_java.sh ${java_version} ; \
# \${CASSANDRA_DIR}/.build/${run_script} ${@:4} ; exit \$? "

docker_command="export ANT_OPTS=\"-Dbuild.dir=\${DIST_DIR} ${CASSANDRA_DOCKER_ANT_OPTS}\" ; \
source \${CASSANDRA_DIR}/.build/docker/_set_java.sh ${java_version} ; \
\${CASSANDRA_DIR}/.build/${run_script} ${@:4} ; exit \$? "
source /home/build/cassandra/.build/docker/_set_java.sh ${java_version} ; \
/home/build/cassandra/.build/${run_script} ${@:4} ; exit \$? "

# run without the default seccomp profile
# re-use the host's maven repository
Expand All @@ -122,9 +126,11 @@ container_id=$(docker run --name ${container_name} -d --security-opt seccomp=unc
${docker_volume_opt} \
${image_name} sleep 1h)


echo "Running container ${container_name} ${container_id}"
#docker exec --user root ${container_name} bash -c "\${CASSANDRA_DIR}/.build/docker/_create_user.sh build $(id -u) $(id -g)"

docker exec --user root ${container_name} bash -c "\${CASSANDRA_DIR}/.build/docker/_create_user.sh build $(id -u) $(id -g)"
docker exec --user root ${container_name} bash -c "/home/build/cassandra/.build/docker/_create_user.sh build $(id -u) $(id -g)"
docker exec --user build ${container_name} bash -c "${docker_command}"
RETURN=$?

Expand Down
5 changes: 3 additions & 2 deletions .build/docker/_set_java.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/bin/bash -e -x
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
Expand All @@ -24,7 +24,8 @@
# variables, with defaults
[ "x${CASSANDRA_DIR}" != "x" ] || { CASSANDRA_DIR="$(pwd)"; }
[ -d "${CASSANDRA_DIR}" ] || { echo >&2 "Directory ${CASSANDRA_DIR} must exist"; exit 1; }

echo "$CASSANDRA_DIR from _set_java"
echo $(pwd)
# pre-conditions
[ -f "${CASSANDRA_DIR}/build.xml" ] || { echo >&2 "${CASSANDRA_DIR}/build.xml must exist"; exit 1; }

Expand Down
10 changes: 5 additions & 5 deletions .build/docker/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash +x
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
Expand Down Expand Up @@ -82,7 +82,6 @@ dockerfile="ubuntu2004_test.docker"
image_tag="$(md5sum docker/${dockerfile} | cut -d' ' -f1)"
image_name="apache/cassandra-${dockerfile/.docker/}:${image_tag}"
docker_mounts="-v ${cassandra_dir}:/home/cassandra/cassandra -v "${build_dir}":/home/cassandra/cassandra/build -v ${HOME}/.m2/repository:/home/cassandra/.m2/repository"

# Look for existing docker image, otherwise build
if ! ( [[ "$(docker images -q ${image_name} 2>/dev/null)" != "" ]] ) ; then
# try docker login to increase dockerhub rate limits
Expand Down Expand Up @@ -196,7 +195,7 @@ logfile="${build_dir}/test/logs/docker_attach_${container_name}.log"
# set java to java_version
# execute the run_script
docker_command="source \${CASSANDRA_DIR}/.build/docker/_set_java.sh ${java_version} ; \
\${CASSANDRA_DIR}/.build/docker/_docker_init_tests.sh ${target} ${split_chunk} ; exit \$?"
\${CASSANDRA_DIR}/.build/docker/_docker_init_tests.sh ${target} ${split_chunk}; exit \$?"

# start the container, timeout after 4 hours
docker_id=$(docker run --name ${container_name} ${docker_flags} ${docker_mounts} ${docker_volume_opt} ${image_name} sleep 4h)
Expand All @@ -210,6 +209,7 @@ docker exec --user root ${container_name} update-alternatives --set python /usr/
docker exec --user cassandra ${container_name} bash -c "${docker_command}" | tee -a ${logfile}
status=$?


if [ "$status" -ne 0 ] ; then
echo "${docker_id} failed (${status}), debug…"
docker inspect ${docker_id}
Expand All @@ -222,8 +222,8 @@ if [ "$status" -ne 0 ] ; then
echo "–––"
echo "Failure."
fi
# docker stop in background, ignore errors
( nohup docker stop ${docker_id} >/dev/null 2>/dev/null & )
docker stop in background, ignore errors
#( nohup docker stop ${docker_id} >/dev/null 2>/dev/null & )

xz -f ${logfile} 2>/dev/null

Expand Down
260 changes: 260 additions & 0 deletions .build/run-ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,260 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# variables, with defaults
[ "x${CASSANDRA_DIR}" != "x" ] || CASSANDRA_DIR="$(readlink -f $(dirname "$0")/..)"
[ "x${KUBECONFIG}" != "x" ] || KUBECONFIG="${HOME}/.kube/config"
[ "x${KUBE_NS}" != "x" ] || KUBE_NS="default" # FIXME – doesn't work in other namespaces :shrug:

# pre-conditions
command -v kubectl >/dev/null 2>&1 || { echo >&2 "kubectl needs to be installed"; exit 1; }
command -v helm >/dev/null 2>&1 || { echo >&2 "helm needs to be installed"; exit 1; }

# Parse command-line arguments
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-c|--kubeconfig)
KUBECONFIG="$2" # This sets the KUBECONFIG variable to the next argument.
shift # This shifts the arguments to the left, discarding the current argument and moving to the next one.
shift # This is an additional shift to move to the argument after the option value.
;;
-ctx|--kubecontext)
unset KUBECONFIG
KUBECONTEXT="$2" # This sets the KUBECONTEXT variable to the next argument.
shift # This shifts the arguments to the left, discarding the current argument and moving to the next one.
shift # This is an additional shift to move to the argument after the option value.
;;
--include-test-stage)
INCLUDE_TEST_STAGE="$2"
shift
shift
;;
--repo-url)
REPO_URL="$2"
shift
shift;;
--repo-branch)
REPO_BRANCH="$2"
shift
shift
;;
--targets)
TARGETS="$2"
shift
shift
;;
--tear-down)
TEAR_DOWN="$2"
shift
shift
;;
--help)
echo "Usage: your_script.sh [options]"
echo "Options:"
echo " -c, --kubeconfig <file> Specify the path to a Kubeconfig file."
echo " -ctx, --kubecontext <context> Specify the Kubernetes context to use."
echo " --include-test-stage <value> Include test stage/s."
echo " --repo-url <url> Specify the repository URL."
echo " --repo-branch <branch> Specify the repository branch."
echo " --targets <target> Specify the build targets."
echo " --tear-down <value> Tear down Jenkins Instance and Jenkins Operator, true or false."
echo " --help Show this help message."
exit 0
;;
*)
echo "Unknown option: $1"
michaelsembwever marked this conversation as resolved.
Show resolved Hide resolved
exit 1
;;
esac
done

if [ -z "$KUBECONFIG" ] && [ -z "$KUBECONTEXT" ]; then
echo "Please provide either the path to the kubeconfig using -c|--kubeconfig option or the kubecontext using -ctx|--kubecontext option."
exit 1
fi

# This sets the kubeconfig and kubecontext if provided
if [ -n "$KUBECONFIG" ]; then
export KUBECONFIG="$KUBECONFIG"
fi

if [ -n "$KUBECONTEXT" ]; then
kubectl config use-context "$KUBECONTEXT"
fi

if ! kubectl get namespace ${KUBE_NS} >/dev/null 2>/dev/null ; then
kubectl create namespace ${KUBE_NS}
fi

if [ -n "$INCLUDE_TEST_STAGE" ]; then
# The variable is not empty, so it has a value
echo "INCLUDE_TEST_STAGE is not empty. Its value is: $INCLUDE_TEST_STAGE"
else
# The variable is empty, so assign a default value
INCLUDE_TEST_STAGE="lint,stress,fqltool"
echo "INCLUDE_TEST_STAGE is empty. Assigning default value: $INCLUDE_TEST_STAGE"
fi


if [ -n "$TARGETS" ]; then
# The variable is not empty, so it has a value
echo "TARGETS is not empty. Its value is: $TARGETS"
else
# The variable is empty, so assign a default value
TARGETS=".jenkins/job/DslJob.jenkins"
echo "TARGETS is empty. Assigning default value: $TARGETS"
fi

if [ -n "$REPO_URL" ]; then
# The variable is not empty, so it has a value
echo "REPO_URL is not empty. Its value is: $REPO_URL"
else
# The variable is empty, so assign a default value
REPO_URL="https://github.com/infracloudio/cassandra.git"
echo "REPO_URL is empty. Assigning default value: $REPO_URL"
fi

if [ -n "$REPO_BRANCH" ]; then
# The variable is not empty, so it has a value
echo "REPO_BRANCH is not empty. Its value is: $REPO_BRANCH"
else
# The variable is empty, so assign a default value
REPO_BRANCH="infracloud/cassandra-5.0"
echo "REPO_BRANCH is empty. Assigning default value: $REPO_BRANCH"
fi

if [ -n "$TEAR_DOWN" ]; then
# The variable is not empty, so it has a value
echo "TEAR_DOWN is not empty. Its value is: $TEAR_DOWN"
else
# The variable is empty, so assign a default value
TEAR_DOWN=false
echo "TEAR_DOWN is empty. Assigning default value: $TEAR_DOWN"
fi

sed -e "/targets:/s|:.*$|: \"$TARGETS\"|" \
-e "/repositoryBranch:/s|:.*$|: \"$REPO_BRANCH\"|" \
-e "/repositoryUrl:/s|:.*$|: \"$REPO_URL\"|" ${CASSANDRA_DIR}/.jenkins/k8s/jenkins-deployment.yaml > ${CASSANDRA_DIR}/build/jenkins-deployment.yaml

# get the job name from the DSL Job file
JOB_NAME=$(grep -o "pipelineJob('\([^']*\)')" .jenkins/job/DslJob.jenkins | sed "s/pipelineJob('//;s/')//")


echo "JOB_NAME = $JOB_NAME"

# Add Helm Jenkins Operator repository
echo "Adding Helm repository for Jenkins Operator..."
helm repo add --namespace ${KUBE_NS} jenkins https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart

# Install Jenkins Operator using Helm
echo "Installing Jenkins Operator..."
helm upgrade --namespace ${KUBE_NS} --install jenkins-operator jenkins/jenkins-operator --set jenkins.enabled=false --set jenkins.backup.enabled=false --version 0.8.0-beta.2

while ! ( kubectl --namespace ${KUBE_NS} get pods | grep jenkins-operator | grep " 1/1 " | grep -q " Running" ) ; do
echo "Jenkins Operator installing. Waiting..."
sleep 5 # Adjust the polling interval as needed
done

echo "Jenkins Operator installed successfully!"

michaelsembwever marked this conversation as resolved.
Show resolved Hide resolved
kubectl apply --namespace ${KUBE_NS} -f ${CASSANDRA_DIR}/build/jenkins-deployment.yaml

while ! ( kubectl --namespace ${KUBE_NS} get pods | grep jenkins-jenkins | grep " 1/1 " | grep -q " Running" ) ; do
echo "Jenkins installing. Waiting..."
sleep 5 # Adjust the polling interval as needed
done

kubectl rollout status deployment/jenkins-operator -n ${KUBE_NS}

# Port-forward the Jenkins service to access it locally
jenkins_pod=$(kubectl get pods -n ${KUBE_NS} -l jenkins-cr=jenkins -o jsonpath='{.items[0].metadata.name}')

nohup kubectl port-forward svc/jenkins-operator-http-jenkins 8080:8080 > /dev/null >2&1 &
sleep 5
echo "port-forwarding running in background"
# echo "To forward the Jenkins service to another terminal, open a new terminal window and run the following command:"
# echo "kubectl port-forward -n ${KUBE_NS} $jenkins_pod 8080:8080"

TOKEN=$(kubectl get secret jenkins-operator-credentials-jenkins -o jsonpath="{.data.token}" | base64 --decode)

# Trigger a new build and capture the response headers
response_headers=$(curl -i -X POST http://localhost:8080/job/$JOB_NAME/buildWithParameters -u jenkins-operator:$TOKEN --data-urlencode "TEST_STAGES_TO_RUN=$INCLUDE_TEST_STAGE" 2>&1)

echo "response_headers $response_headers"
queue_url=$(echo "$response_headers" | grep -i "Location" | awk -F ": " '{print $2}' | tr -d '\r')
queue_item_number=$(basename "$queue_url")

# Construct the complete URL to retrieve build information
queue_json_url="http://localhost:8080/queue/item/$queue_item_number/api/json"

# Wait for the build number to become available (querying the API)
build_number=""
while [ -z "$build_number" ] || [ "$build_number" == "null" ]; do
build_info=$(curl -s "$queue_json_url" -u jenkins-operator:$TOKEN)
build_number=$(echo "$build_info" | jq -r '.executable.number')
if [ -z "$build_number" ] || [ "$build_number" == "null" ]; then
echo "Build number not available yet. Waiting..."
sleep 5 # Adjust the polling interval as needed
fi
done

echo "build_number $build_number"
BUILD_DIR=/var/lib/jenkins/jobs/$JOB_NAME/builds
POD_NAME=jenkins-jenkins
LATEST_BUILD=$(kubectl exec -it $POD_NAME -- /bin/bash -c "ls -t $BUILD_DIR | head -n 1" | tr -d '\r')

CONSOLE_LOG_FILE="$BUILD_DIR/$build_number/log"

# Define a function to check if "FINISHED" is in the consoleLog
check_finished() {
kubectl exec -n $KUBE_NS $POD_NAME -- cat "$CONSOLE_LOG_FILE" | grep -q "Finished"
}

# Continuously check for "FINISHED"
while true; do
if check_finished; then
echo "Build has finished."
break
else
echo "Build is still in progress."
fi
sleep 5 # Adjust the sleep interval as needed
done

RESULTS_DIR="${CASSANDRA_DIR}/build/ci_${build_number}"
mkdir -p ${RESULTS_DIR}
kubectl cp -n $KUBE_NS $POD_NAME:${CONSOLE_LOG_FILE} ${RESULTS_DIR}/log

if kubectl exec -n $KUBE_NS $POD_NAME -- test -e $BUILD_DIR/$build_number/junitResult.xml; then
kubectl cp -n $KUBE_NS $POD_NAME:$BUILD_DIR/$build_number/junitResult.xml ${RESULTS_DIR}/junitResult.xml
else
# Display a message indicating that junitResult.xml is not generated
echo "junitResult.xml is not generated."
fi


Copy link
Member Author

@michaelsembwever michaelsembwever Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're missing here the teardown of the jenkins stack.
and this needs to be optional via a parameter.

something along the lines of

# teardown # TODO add option to skip this
kubectl delete --namespace ${KUBE_NS} -f ${CASSANDRA_DIR}/build/jenkins-deployment.yaml
kubectl delete "$(kubectl api-resources --namespaced=true --verbs=delete -o name | tr "\n" "," | sed -e 's/,$//')" --all
[ "default" == "${KUBE_NS}" ] ||  kubectl delete namespace ${KUBE_NS}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can leave this, i will tackle it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since for now, the jenkins deployment is working with default namespace only (the limitation we mentioned earlier), so there is no need to delete the default namespace, we can remove the delete command (for namespace)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have added the teardown code, also parameterised it as well

# kill the port-forwarding process
ps -elf | grep port-forward | head -n1 | awk -F " " '{ print $4 }' | xargs kill -9


if [ $TEAR_DOWN ]; then
kubectl delete --namespace ${KUBE_NS} -f ${CASSANDRA_DIR}/build/jenkins-deployment.yaml
helm uninstall --namespace ${KUBE_NS} jenkins-operator
fi
Loading