When running my pipelines, I am getting this notification:
The version of this runner is outdated. Upgrade to the latest version
I tried looking in the documentation but I was not able to find a solution.
How can I update my local Runners?
Hi @ethan.chen,
You can update the runner with the following command:
docker image pull docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner
In case you encounter the following error:
docker: Error response from daemon: docker: Error response from daemon: Conflict. The container name "/runner-76b247e7-b925-5e7b-9da2-1cda14c4ff2c" is already in use by container "c3403236e3af5962ed3a9b8771561bd2021974941cc8a89a40c6c66cecb18f53". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
First, remove the runner with the following command, and then execute the docker image pull command I mentioned above:
docker container rm -f runner-76b247e7-b925-5e7b-9da2-1cda14c4ff2c
Replace runner-76b247e7-b925-5e7b-9da2-1cda14c4ff2c in the command with the name of your runner.
This is documented here for easier reference:
After you have updated the runner, you can use the pre-configured Docker command that you were given when you created the runner, in order to start it again.
Please feel free to let me know if you have any questions!
Kind regards,
Theodora
Hi Theodora,
what about runners in Windows?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sturla Lange,
For Windows runners you'll need to download and extract the zip file of the latest version and then start the runner from the directory of the latest version.
When you create a Windows runner from the Bitbucket website, the first 3 commands that are given are the following:
Invoke-WebRequest -Uri https://product-downloads.atlassian.com/software/bitbucket/pipelines/atlassian-bitbucket-pipelines-runner-1.315.zip -OutFile .\atlassian-bitbucket-pipelines-runner.zip
Expand-Archive .\atlassian-bitbucket-pipelines-runner.zip
cd .\atlassian-bitbucket-pipelines-runner\bin
The version in the zip file will be different if there is a newer version available.
What you can do is:
- stop the existing runner
- delete the existing atlassian-bitbucket-pipelines-runner.zip file and atlassian-bitbucket-pipelines-runner directory to avoid any confusion
- then download the new version and extract the zip file with the commands above
- use the last command (not included in the list above) to start the runner from the new directory
Edit: there is no other way to check for the newest version of Windows runners at the moment.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this downloads a new image, but doesn't actually update a existing runner,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Theodora Boudale ,
Is there any web page that lists all of the possible runner versions that can be downloaded? I can't find one. I'm looking for a page/list of runner versions so that my PowerShell script can pick the latest one to determine if there are any updates and auto update, if there is, according to your instructions.
Without this we cannot automate our runner update process.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nathan,
I'm afraid that we don't have such a page available at the moment.
There is a feature request in our issue tracker which includes this suggestion: https://jira.atlassian.com/browse/BCLOUD-22032 Since you'd be interested in that, I would recommend adding your vote (by selecting the Vote for this issue link) and leaving a comment to give it more weight and further express your interest.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries Nathan, I'm glad I could point you in the right direction!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I deleted the older container and then used the command instructed by Bitbucket, but I changed the tag from 1 to the latest to get the newest version of the image, and worked.
docker container rm -f container-name - to delete the container
docker rmi old-imageid - to delete the image
docker pull docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner:latest - to pull the new image.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I want to share a simple python script writing by myself to control self-hosted runners with you guys. Please read the instruction on the top carefully before using it.
#!/bin/python3
"""
This script is used to control self-hosted runners. It
depends on python3.8+ and two package - docker and runlike.
I presuppose that you have no other containers' name
starting with "runner-" or you may customize this script
by yourself.
Usage: (Assuming the script is named runners.py)
./runner.py {start, stop, remove, upgrade}
Warning: When using upgrade instruction, all runners will
be deleted first and their start commands will be written
to a backup file named "runners_command_bak" storing in the
directory you current in. Once you make sure that all the
runners have started and are running normally, you can then
manually delete this file.
"""
import docker
import threading
import os
import sys
from runlike.inspector import Inspector
client = docker.from_env()
containers = client.containers.list(all=True)
def container_run(func):
threads = []
for container in containers:
if container.name.startswith("runner-"):
t = threading.Thread(
target=getattr(container, func), kwargs={"force": True} if func == "remove" else None
)
threads.append(t)
t.start()
for t in threads:
t.join()
def upgrade():
os.system("docker image pull docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner:1")
commands = []
for container in containers:
if container.name.startswith("runner-"):
ins = Inspector(container=container.name)
ins.inspect()
command = ins.format_cli().split(" ")
command.insert(-1, "-d")
commands.append(" ".join(command))
with open("runners_command_bak", "w") as f:
f.write("\n".join(commands))
container_run("remove")
threads = []
for command in commands:
t = threading.Thread(target=os.system, args=(command,))
threads.append(t)
t.start()
for t in threads:
t.join()
if len(sys.argv) == 1:
print("Available commands: start, stop, remove, upgrade")
sys.exit()
if sys.argv[1] in ["start", "stop", "remove"]:
container_run(sys.argv[1])
elif sys.argv[1] == "upgrade":
upgrade()
else:
raise ValueError("Invalid control parameter: "+sys.argv[1])
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this downloads a new image, but doesn't actually update a existing runner,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To update your self-hosted runner, you must delete the repo/workspace runner and re-add it again. It will install the updated docker image.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Gino McCarty,
Are you using Windows runners or Linux runners? (or perhaps MacOS runners)?
The instructions I shared for Windows and Linux runners in my previous replies will download the newest version of the runner.
You will then need to use the pre-configured command that you were given when you created the runner (the command that starts the runner), in order to start it again.
If you didn't save that command, you will need to create a new runner and use the pre-configured command from the new runner.
However, if you have saved that command, you can use it in order to start the runner you have already been using.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We are using linux runners
I deleted the older container, but I had to preserve the initial script in code, because I had lost my original OIDC credentials, which made starting a new container not work
now that have that string in code its easier to do upgrades.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's good to hear, thanks for the update Gino!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.