Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plugin for updating symlink on job completion #358

Closed
wants to merge 2 commits into from

Conversation

expipiplus1
Copy link
Contributor

I've written a small plugin which can create a symlink pointing to the latest output of a job.

It also touches a file as lots of filesystem watchers don't like watching symlinks :/

I'd appreciate some feedback :)

This can be used with a section in the config like this:

      <latestoutput>
        jobs = hoogle-instance.default.hoogle
        path = /nix/var/nix/gcroots/hydra/hoogle
        touch = /tmp/hoogle-updated
      </latestoutput>

I'm using this at the moment to run a hoogle server with the latest version of all our code on.


print STDERR "INFO: Creating symlink at $linkLocation with target $linkTarget\n";
if (-e $linkLocation) { unlink ($linkLocation); }
my $linkCreated = symlink($linkTarget, $linkLocation);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using nix-env -p $linkLocation --set $linkTarget here instead? This would also allow for rollbacks and would ensure that we have a gcroot.

@expipiplus1
Copy link
Contributor Author

@aszlig I've made that change.

@expipiplus1
Copy link
Contributor Author

The fact that only two lines in this change are actually specific to what this plugin is doing makes me wonder if there's a way to abstract over all the rest.

Some kind of 'on build completion script' as described in #281 might make sense.

@grahamc
Copy link
Member

grahamc commented Mar 18, 2019

This looks pretty cool. I wonder, though, if the runcommand plugin is satisfactory?

@expipiplus1
Copy link
Contributor Author

@grahamc Perhaps, I've not looked at this for ages.

@gilligan
Copy link
Contributor

Since there was no further response and the runCommand indeed seems like a good candidate i’ll close this one.

@gilligan gilligan closed this May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants