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?
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.zipExpand-Archive .\atlassian-bitbucket-pipelines-runner.zipcd .\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.
this downloads a new image, but doesn't actually update a existing runner,
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.
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.
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.
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 containerdocker rmi old-imageid - to delete the imagedocker pull docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner:latest - to pull the new image.
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. Itdepends 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 willbe deleted first and their start commands will be writtento a backup file named "runners_command_bak" storing in thedirectory you current in. Once you make sure that all therunners have started and are running normally, you can thenmanually delete this file."""import dockerimport threadingimport osimport sysfrom runlike.inspector import Inspectorclient = 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])
It looks like you're new here. Sign in or register to get started.