-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from rakshithakamath94/job-code_compilation
Update the job code_compilation
- Loading branch information
Showing
8 changed files
with
150 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
|
||
SERVER_TEST_SCRIPT=${SERVER_TEST_SCRIPT} | ||
CLIENT_TEST_SCRIPT=${CLIENT_TEST_SCRIPT} | ||
|
||
server_env="export GERRIT_HOST='${GERRIT_HOST}'" | ||
server_env+=" GERRIT_PROJECT='${GERRIT_PROJECT}'" | ||
server_env+=" GERRIT_REFSPEC='${GERRIT_REFSPEC}'" | ||
server_env+=" YUM_REPO='${YUM_REPO}'" | ||
|
||
if [ $CENTOS_VERSION ]; then | ||
server_env+=" CENTOS_VERSION='${CENTOS_VERSION}'" | ||
fi | ||
|
||
if [ "$JOB_NAME" == "nfs_ganesha_iozone_vfs" ] || [ "$JOB_NAME" == "nfs_ganesha_iozone_vfs_minmdcache" ]; then | ||
server_env+=" VFS_VOLUME='${EXPORT}'" | ||
else | ||
server_env+=" GLUSTER_VOLUME='${EXPORT}'" | ||
fi | ||
|
||
SERVER_IP=$(cat $WORKSPACE/hosts | sed -n '1p') | ||
CLIENT_IP=$(cat $WORKSPACE/hosts | sed -n '2p') | ||
|
||
echo $server_env > $WORKSPACE/SERVER_ENV.txt | ||
|
||
SSH_OPTIONS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" | ||
|
||
#add the export with environment to ~/.bashrc | ||
scp ${SSH_OPTIONS} "$WORKSPACE/SERVER_ENV.txt" "root@${SERVER_IP}:./SERVER_ENV.txt" | ||
|
||
ssh -t ${SSH_OPTIONS} root@${SERVER_IP} "tee -a ~/.bashrc < ./SERVER_ENV.txt" | ||
|
||
scp ${SSH_OPTIONS} ${SERVER_TEST_SCRIPT} root@${SERVER_IP}:./$(basename ${SERVER_TEST_SCRIPT}) | ||
|
||
ssh -t ${SSH_OPTIONS} root@${SERVER_IP} "bash ./$(basename ${SERVER_TEST_SCRIPT})" | ||
RETURN_CODE=$? | ||
|
||
if [ $RETURN_CODE == 0 ]; then | ||
client_env="export SERVER='${SERVER_IP}'" | ||
client_env+=" EXPORT='/${EXPORT}'" | ||
client_env+=" CENTOS_VERSION='${CENTOS_VERSION}'" | ||
|
||
echo $client_env > $WORKSPACE/CLIENT_ENV.txt | ||
|
||
scp ${SSH_OPTIONS} "$WORKSPACE/CLIENT_ENV.txt" "root@${CLIENT_IP}:./CLIENT_ENV.txt" | ||
|
||
ssh -t ${SSH_OPTIONS} root@$CLIENT_IP 'tee -a ~/.bashrc < ./CLIENT_ENV.txt' | ||
|
||
scp ${SSH_OPTIONS} ${CLIENT_TEST_SCRIPT} root@${CLIENT_IP}:./$(basename ${CLIENT_TEST_SCRIPT}) | ||
|
||
ssh -t ${SSH_OPTIONS} root@${CLIENT_IP} "bash ./$(basename ${CLIENT_TEST_SCRIPT})" | ||
RETURN_CODE_CLIENT=$? | ||
|
||
exit $RETURN_CODE_CLIENT | ||
else | ||
echo "The SERVER script failed!" | ||
exit $RETURN_CODE | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
set +x | ||
|
||
mkdir -p ~/.config | ||
|
||
cat > ~/.config/duffy <<EOF | ||
client: | ||
url: https://duffy.ci.centos.org/api/v1 | ||
auth: | ||
name: nfs-ganesha | ||
key: ${CICO_API_KEY} | ||
EOF | ||
|
||
readarray -t POOLS < <(duffy client list-pools | jq -r '.pools[].name') | ||
|
||
LIST_POOLS=() | ||
for i in "${POOLS[@]}" | ||
do | ||
if [[ $i =~ ${CENTOS_VERSION}(s)*-x86_64 ]]; then | ||
LIST_POOLS+=($i) | ||
fi | ||
done | ||
|
||
if [ "$JOB_NAME" == "nfs-ganesha_trigger-fsal_cephfs" ] || [ "$JOB_NAME" == "nfs-ganesha_trigger-fsal_gluster" ] || [ "$JOB_NAME" == "nfs-ganesha_trigger-fsal_rgw" ]; then | ||
node_count=1 | ||
else | ||
node_count=2 | ||
fi | ||
|
||
|
||
for my_pool in ${LIST_POOLS[@]}; | ||
do | ||
if [[ $(duffy client show-pool $my_pool | jq -r '.pool.levels.ready') -gt 1 ]]; then | ||
SESSION=$(duffy client request-session pool="${my_pool}",quantity=$node_count) | ||
echo "${SESSION}" | jq -r '.session.nodes[].ipaddr' > "${WORKSPACE}"/hosts | ||
echo "${SESSION}" | jq -r '.session.id' > "${WORKSPACE}"/session_id | ||
break | ||
fi | ||
|
||
sleep 60 | ||
echo -n "." | ||
done | ||
|
||
if [ -z "${SESSION}" ]; then | ||
echo "Failed to reserve node" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
# A script that releases nodes from session ids | ||
|
||
set +x | ||
|
||
SESSION_ID=$(cat "${WORKSPACE}"/session_id) | ||
|
||
duffy client retire-session "${SESSION_ID}" > /dev/null |