CIDuty/How To/QuarantineMultipleInstances: Difference between revisions

From MozillaWiki
< CIDuty‎ | How To
Jump to navigation Jump to search
(updated the code and the requirement for the taskcluster library)
(updated with new info and made some format changes)
Line 1: Line 1:
'''Preparation'''
# Create an empty python file.
# Create an empty python file.
# Copy > Paste this code from git : https://gist.github.com/catlee/9f85b4d51425a41cdc33ab8c7b754507/d747ca8220cdf8fbe24534b77ba78fed7b5ab394
# Copy and Paste this code from git : https://gist.github.com/catlee/9f85b4d51425a41cdc33ab8c7b754507/d747ca8220cdf8fbe24534b77ba78fed7b5ab394
# Save the file and make sure you have the right to execute it. If you don't have it then run : chmod u+x name_of_file
# Save the file and make sure you have the right to execute it. If you don't have it then run : chmod u+x name_of_the_python_file
# Copy it to ~/bin so you can access it anytime, from any directory in the terminal.
# Copy it to ~/bin so you can access it anytime, from any directory in the terminal.
# Before running any other command make sure you have the taskcluster library for python installed : pip install taskcluster==3.0.2
In order to run the previous python file we will need the help from taskcluster cli. The installation of the app can be done in two methods. Choose one. Both are correct.
# Next we execute the python file we saved locally with the code from git in it. Make sure it is properly indented after the copy > paste. Below is a table with all the possible arguments:
* Download taskcluster needed file and make it executable
# Download the taskcluster : https://index.taskcluster.net/v1/task/project.taskcluster.taskcluster-cli.latest/artifacts/public/linux-amd64/taskcluster
# Save the file and make it executable it: chmod u+x taskcluster
* Install taskcluster
# The second way is by installing it : pip install taskcluster==3.0.2
 
'''Authentication'''
# Before running the command, check that you are logged on with your ldap on [https://tools.taskcluster.net/ taskcluster]
# Next we need to sign in, running the following command :
* ./taskcluster signin
 
In the browser a new page should have opened with all your taskcluster secrets and access groups. Scroll down until the bottom of the screen and check for a button called  '''Create client''', ''press it''. Now you are ready to run the script.
 
'''Running the script'''
 
Next we will execute the python file we saved locally with the code from git in it. Make sure it is properly indented after the copy & paste. Below is a table with all the possible arguments:


[[File:Cli.png]]
[[File:Cli.png]]


# In our case we needed to un-quarantine t-yosemite-r7-070 so the command looked like this :
In our case we needed to un-quarantine t-yosemite-r7-070 so the command looked like this :
# python quarantine_tc.py --enable -p releng-hardware -w gecko-t-osx-1010 -g mdc1 t-yosemite-r7-070
* python quarantine_machines.py --enable --provisioner releng-hardware --worker-type gecko-t-osx-1010 --worker-group mdc1 t-yosemite-r7-070
# What happens? We go through worker 070 and every worker from 075 till 156 and for each of them we run the script from the python file we saved locally. With the proper arguments.
 
Here is an other example, when we needed to un-quarantine multiple osx machines from mdc2 starting from 001 to 009 :
* python quarantine_machines.py --enable --provisioner releng-hardware --worker-type gecko-t-osx-1010 --worker-group mdc2 t-yosemite-r7-00{1..9}

Revision as of 02:42, 22 April 2019

Preparation

  1. Create an empty python file.
  2. Copy and Paste this code from git : https://gist.github.com/catlee/9f85b4d51425a41cdc33ab8c7b754507/d747ca8220cdf8fbe24534b77ba78fed7b5ab394
  3. Save the file and make sure you have the right to execute it. If you don't have it then run : chmod u+x name_of_the_python_file
  4. Copy it to ~/bin so you can access it anytime, from any directory in the terminal.

In order to run the previous python file we will need the help from taskcluster cli. The installation of the app can be done in two methods. Choose one. Both are correct.

  • Download taskcluster needed file and make it executable
  1. Download the taskcluster : https://index.taskcluster.net/v1/task/project.taskcluster.taskcluster-cli.latest/artifacts/public/linux-amd64/taskcluster
  2. Save the file and make it executable it: chmod u+x taskcluster
  • Install taskcluster
  1. The second way is by installing it : pip install taskcluster==3.0.2

Authentication

  1. Before running the command, check that you are logged on with your ldap on taskcluster
  2. Next we need to sign in, running the following command :
  • ./taskcluster signin

In the browser a new page should have opened with all your taskcluster secrets and access groups. Scroll down until the bottom of the screen and check for a button called Create client, press it. Now you are ready to run the script.

Running the script

Next we will execute the python file we saved locally with the code from git in it. Make sure it is properly indented after the copy & paste. Below is a table with all the possible arguments:

Cli.png

In our case we needed to un-quarantine t-yosemite-r7-070 so the command looked like this :

  • python quarantine_machines.py --enable --provisioner releng-hardware --worker-type gecko-t-osx-1010 --worker-group mdc1 t-yosemite-r7-070

Here is an other example, when we needed to un-quarantine multiple osx machines from mdc2 starting from 001 to 009 :

  • python quarantine_machines.py --enable --provisioner releng-hardware --worker-type gecko-t-osx-1010 --worker-group mdc2 t-yosemite-r7-00{1..9}