Ssh command variables

I am unable to figure out how to do rollbacks when deploying via ssh.

I could do it with a simple script if I know the branch and or commit hash.

My request is to add branch name and commit hash to the Meat! variables available to the ssh scripts.

Thank you and great work.

Hey Daniel,

Just to specify: you are running a deploy and use SSH to authenticate and would like to rollback changes, right?
If so, click Run on the scenario and choose the revision that was on the server prior to the deployment.

Will this solve your problem?

I don’t see how that will roll back changes as it just runs commands you specify over SSH.
I doesn’t do any git checkout or anything else.

In Meat you roll back changes by choosing the revision that you want to have on the server: if you choose the revision prior to the deploy that you want to revert, Meat will automatically remove the files from server and restore those from the previous version. You don’t need an SSH script to manually checkout the repo :slight_smile:

The idea of Meat is to save people from manually updating servers and rolling back changes with automatic deployments that use ssh -sftp to connect.

I’m using SSH not sftp so this will not work

Okay. I don’t understand one thing, however: why do you want to make deploys with SSH scripts if Meat can do that with a dedicated action?

Mainly because sftp is not ideal for multiple reasons:

  • It is slower to apply changes or reversions than using git commands
  • Larger applications will take even longer
  • If there are post deploy steps to be run it cannot do it such as asset building or database migrations

I assumed I could use the variables that are supplied to just run something similar to:

git fetch
git checkout ${commit/branch/tag}
#run build steps

I see now, thanks for the explanation. I’m afraid the only variables available at the moment are those listed here: https://getmeat.io/knowledge/deployments/how-use-ssh-scripts
We may be able to deliver more variables in the future iterations to give you more control over the process. For now it’s not possible, sorry.

I understand that :smile:

That is my request, for a few new variables to be added

Hey @Hourd,
You may want to use this variable to get the revision:

${release.action_executions.get(0).to_revision}

Hope this helps.

That would be great but it seems the ssh release scenario does not have the “from_revision” and “to_revision” variables in there.

Those would be exactly what I need.