Page MenuHomePhabricator

[jobs-cli,toolforge-cli] Add tfj as a shortcut for toolforge-jobs command
Open, Stalled, LowPublicFeature

Description

Feature summary (what you would like to be able to do and where):
Create an alias tfj for the command toolforge-jobs and make it universally available to all Toolforge users. So instead of toolforge-jobs list you could just write tfj list.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
Any user who would like to use the new Jobs framework

Benefits (why should this be implemented?):
Make working with the new Jobs framework easier

Event Timeline

@bd808 I use this through an alias. Assuming there is interest to make this universal, there are two solutions I can think of:

  • Define the alias as alias tfj="toolforge-jobs" in a file named /etc/profile.d/00-aliases.sh (as described on SO)
  • Create a symlink from /usr/bin/tfj to /usr/bin/toolfjorge-jobs

The advantage of the latter is it will be immediately effective, whereas the former would only be available for each user once they open a new terminal. That is not a big deal, so I think both approaches are equally good.

Neither of those would need a Gerrit patch, IIUC. Both require a server admin to make the change on all relevant machines.

Neither of those would need a Gerrit patch, IIUC. Both require a server admin to make the change on all relevant machines.

We try not to do things manually like this because they are very easy to forget about when building the next replacement server. If these aliases are made system wide that should be handled either by adding to the toolforge-jobs-framework-cli debian package generated from https://gerrit.wikimedia.org/r/admin/repos/cloud/toolforge/jobs-framework-cli OR by adding to the ::profile::toolforge::jobs_framework_cli Puppet module which is used to provision the deb and additional configuration on the appropriate Toolforge hosts.

That means IDNUC (i did not understand correctly)!

On https://github.com/wikimedia/cloud-toolforge-jobs-framework-cli it only says "We currently deploy this code into Toolforge using a debian package that is built from this very source tree." Do you know how it is actually built and deployed? I wonder if I will be able to learn it, replicate it on my local VM, then submit a patch.

On https://github.com/wikimedia/cloud-toolforge-jobs-framework-cli it only says "We currently deploy this code into Toolforge using a debian package that is built from this very source tree." Do you know how it is actually built and deployed? I wonder if I will be able to learn it, replicate it on my local VM, then submit a patch.

We use Debian's sbuild tool to generate .deb packages. https://wikitech.wikimedia.org/wiki/Portal:Toolforge/Admin/Packaging should be of some help in understanding how we build and deploy these packages.

Using the Puppet module approach could look something like https://gerrit.wikimedia.org/r/plugins/gitiles/operations/puppet/+/refs/heads/production/modules/vagrant/manifests/init.pp#58 and https://gerrit.wikimedia.org/r/plugins/gitiles/operations/puppet/+/refs/heads/production/modules/vagrant/files/alias-vagrant-profile-d.sh which provision a shell alias via an /etc/profile.d/ script.

Change 802596 had a related patch set uploaded (by Huji; author: Huji):

[operations/puppet@production] Add tfj as a shortcut for toolforge-jobs command

https://gerrit.wikimedia.org/r/802596

There's a plan to consolidate everything under a single toolforge root command (T299026). I'd propose to instead offer an alias for tf = toolforge which would make it something like tf jobs list.

@Majavah I was unaware of it; feel free to decline this and abandon the patch I just created.

I do want to point out that tf as a command may not be unique enough (see https://linux.die.net/man/1/tf and http://www.tfstutorial.com/tf-command) but tfj probably would be.

dcaro changed the task status from Open to Stalled.Mar 5 2024, 1:50 PM
dcaro triaged this task as Low priority.
dcaro edited projects, added Toolforge; removed Toolforge Jobs framework.
dcaro moved this task from Backlog to Ready to be worked on on the Toolforge board.
dcaro renamed this task from Add tfj as a shortcut for toolforge-jobs command to [jobs-cli,toolforge-cli] Add tfj as a shortcut for toolforge-jobs command.Mar 5 2024, 3:54 PM