Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use jenkins agent instead of old script
Browse files Browse the repository at this point in the history
RE #62
cailafinn committed Jan 28, 2025
1 parent 592ed99 commit 9647325
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ AGENT_SECRET=${2}

echo "Check if the secret or name has changed and kill the current java process if it has. "

cron_entry=$(crontab -l | grep jenkins-slave.sh)
cron_entry=$(crontab -l | grep jenkins-agent.sh)
cron_name_and_secret=$(echo "$cron_entry" | grep -o "$AGENT_NAME .*")

if [[ "$AGENT_NAME $AGENT_SECRET" != "$cron_name_and_secret" ]]; then
@@ -16,7 +16,7 @@ fi

echo "Run the agent startup script in the background. "

$HOME/jenkins-slave.sh $AGENT_NAME $AGENT_SECRET &
$HOME/jenkins-agent.sh $AGENT_NAME $AGENT_SECRET &


echo "Wait for the script to get to its hang point. "
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Test and start the agent. Note: Connection will only begin consistently every 5th minute if changes are made.

- name: Download jenkins slave script.
shell: curl -o $HOME/jenkins-slave.sh https://raw.githubusercontent.com/mantidproject/mantid/main/buildconfig/Jenkins/jenkins-slave.sh
- name: Download jenkins agent script.
shell: curl -o $HOME/jenkins-agent.sh https://raw.githubusercontent.com/mantidproject/mantid/refs/heads/main/buildconfig/Jenkins/jenkins-agent.sh

- name: Make the slave script executable.
shell: chmod 777 $HOME/jenkins-slave.sh
- name: Make the agent script executable.
shell: chmod 777 $HOME/jenkins-agent.sh

- name: Check the Jenkins agent connection script.
script: ./check-connection.sh {{ agent_name }} {{ agent_secret }}

- name: Setup a chrontab entry to run the agent script every 5th minute.
- name: Setup a crontab entry to run the agent script every 5th minute.
ansible.builtin.cron:
name: "Run slave script"
name: "Run agent script"
minute: "*/5"
job: "$HOME/jenkins-slave.sh {{ agent_name }} {{ agent_secret }}"
job: "$HOME/jenkins-agent.sh {{ agent_name }} {{ agent_secret }} >> ~/agentlog.txt 2>&1"

0 comments on commit 9647325

Please sign in to comment.