Deploy web2019 to the intl domain #40
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "134-deploy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -654,0 +659,4 @@
cp /opt/hydra_id_ed25519.pub $HOME/.ssh/id_ed25519.pub && \
echo "5.78.86.156 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEMbV69aqkHdQ1T5lMuALyHjNowU1rottZtEV4OhKQ6Y" > $HOME/.ssh/known_hosts && \
chmod 600 $HOME/.ssh/id_ed25519 && \
rsync -r -c $(jq -r '.outputs[0].path' < $HYDRA_JSON) zolaupd@5.78.86.156:/var/www/m-labs-intl.com/html/
Is this tested? I doubt rsync is in scope.
You may also want to use writeShellScript.
be2aa53220
to7455367033
Temporary files created inside Nix derivations are automatically cleaned up after build, but is it the case here?
@ -654,0 +660,4 @@
echo "5.78.86.156 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEMbV69aqkHdQ1T5lMuALyHjNowU1rottZtEV4OhKQ6Y" > $HOME/.ssh/known_hosts && \
chmod 600 $HOME/.ssh/id_ed25519 && \
${pkgs.rsync}/bin/rsync -r -c $(jq -r '.outputs[0].path' < $HYDRA_JSON)/ zolaupd@5.78.86.156:/var/www/m-labs-intl.com/html/
rm -rf $HOME
Is this still executed if a command fails?
If you had paid attention to my other commits in this repos, you would have noticed that I use
trap
to handle situations like this.Also
rm -rf $HOME
is bad form in any shell script.1b3efaa5dd
to3868eb8919
@ -654,0 +654,4 @@
<runcommand>
job = web:web:web-intl
command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && export TMPSSH=`mktemp -d` && \
trap "rm -rf ${TMPSSH@Q}" EXIT && \
Does this work as intended when used in RunCommand?
May be safer to use writeShellScript as I mentioned earlier (and which you ignored, as often).
They forgot to specify anything useful in the docs, but looking at the source code they eventually just run it with IPC::Run3:
d7986226f0/src/lib/Hydra/Plugin/RunCommand.pm (L259)
. Which under the hood runs the subprocess with perl'ssystem
https://metacpan.org/pod/perlfunc#system , which runs it with default shell (/bin/sh
).Also code for checking that
trap
actually works:Will fail with
ls: cannot access '/tmp/tmp.bOSgsRnGNW': No such file or directory
Right. It's not specified and might change.
@ -654,0 +655,4 @@
job = web:web:web-intl
command = [ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ] && export TMPSSH=`mktemp -d` && \
trap "rm -rf ${TMPSSH@Q}" EXIT && \
mkdir $TMPSSH/.ssh && \
Why do you need that .ssh directory if you're overriding each file in the ssh invokation using -o ?
3868eb8919
tod498d6330b
@ -10,0 +11,4 @@
#!${pkgs.bash}/bin/bash
[ $(jq '.buildStatus' < $HYDRA_JSON) = 0 ]
export TMPSSH=`mktemp -d`
trap "rm -rf ${TMPSSH@Q}" EXIT
Why is
@Q
needed? Any reason other than it was suggested by ChatGPT?And you can use a local let. That derivation is only used once.
d498d6330b
tod3c830f4ef
d3c830f4ef
to0cfc234187
@ -646,0 +652,4 @@
cp /opt/hydra_id_ed25519 "$TMPSSH/id_ed25519"
cp /opt/hydra_id_ed25519.pub "$TMPSSH/id_ed25519.pub"
echo "5.78.86.156 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEMbV69aqkHdQ1T5lMuALyHjNowU1rottZtEV4OhKQ6Y" > "$TMPSSH/known_hosts"
chmod 600 "$TMPSSH/id_ed25519"
cp -a
or similar?Such a command would be shorter and avoid any time window during which the file is world-readable.
0cfc234187
tod749f20cc6
d749f20cc6
to9da1ab6707