Capistrano 3: how to get release_name - capistrano

In Capistrano 2.x the DSL used to provide a variable/method release_name that would return the name of the directory into which the app was just deployed, e.g. 20140225134251, corresponding to .../releases/20140225134251.
I can't seem to find an equivalent for this in cap 3.
Also missing is current_revision, although I've replicated that with
`git rev-parse HEAD`.chomp

Did you try release_path and release_timestamp?

Related

Gitlab CI pipeline failing: a tag issue

My gitlab CI pipeline is setup to run maven tests from a docker image created from my maven project.
I have tested the pipeline on my master branch and it worked fine and ran the test.
However I have created a new feature branch and now running the pipeline yet again, however I now get this error
error checking push permissions -- make sure you entered the correct tag name, and that you are authenticated correctly, and try again: getting tag for destination: repository can only contain the runes `abcdefghijklmnopqrstuvwxyz0123456789_-./`: it2901/cs344-maven:feature/produce-allocation-pdf
ERROR: Job failed: command terminated with exit code 1
I can't seem to pinpoint the problem at all. I have also pushed the tag: tut3 to the feature branch as well.
Here is my .gitlab-ci.yml: https://controlc.com/7a94a00f
Based on what you shared, you have this configured:
VERSIONLABELMETHOD: "tut3" # options: "","LastVersionTagInGit"
It should be either:
VERSIONLABELMETHOD: ""
or
VERSIONLABELMETHOD: "LastVersionTagInGit"
or
VERSIONLABELMETHOD: "OnlyIfThisCommitHasVersion"
When you specify "tut3", the script takes it as if it was "" (empty string). Assuming you didn't define $VERSIONLABEL anywhere $ADDITIONALTAGLIST will also be empty.
And later in the code you can see that this gets executed:
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then ADDITIONALTAGLIST="$ADDITIONALTAGLIST latest"; fi
Assuming $CI_DEFAULT_BRANCH is set to master if you use a separate branch mybranch the code above won't get executed so it's likely that the Kaniko command line doesn't have any a neither a valid $FORMATTEDTAGLIST or $IMAGE_LABELS.
You can debug by seeing their output on the script which is happening at the end before calling Kaniko:
...
echo $FORMATTEDTAGLIST
echo $IMAGE_LABELS
mkdir -p /kaniko/.docker
...
A hack would be to override $CI_DEFAULT_BRANCH with your custom branch.
✌️

How to use plugin commands in bcftools?

My goal is to use bcftools to check that the reference alleles in my dataset (vcf file) match with a reference genome (fasta file) using the fixref plugin.
Working on command line, I first set the following environment:
export BCFTOOLS_PLUGINS=/path/to/bcftools/plugins
The following code is recommended for test datasets with mismatches:
bcftools +fixref test.bcf -Ob -o output.bcf -- -f ref.fa -m top
When I run this code using my own files (please note that my data is .vcf, not .bcf) I get the following error:
[main] Unrecognized command
If I simply enter:
bcftools
I get a list of the only 5 commands (view, index, cat, ld, ldpair) that I can use. So although I've set the environment, does it somehow need to be activated? Do I need to run my command through a bash script?
bcftools
was pointing to a deprecated version of bcftools (0.1.19) in ../bin/, while
BCFTOOLS_PLUGINS=/path/to/bcftools/plugins
was pointing to the plugins for bcftools version 1.10.2 outside /bin/
Replacing ../bin/bcftools (0.1.19 with 1.10.2) was the fix.

helmignore double-star syntax is not supported in helm 3

I want to ignore specifics files in subchart folder (because some objects, like secrets, are created by all my subchart, so duplicated...). I don't know the depth of these objects. So I want to use this syntax in .helmignore :
charts/**/myfile.yaml
But I got this error :
Error: double-star (**) syntax is not supported
How can I do that in helm 3 ?
Unfortunately, this feature doesn't supported nether in helm2 nor helm3.
helm2 source code: link
helm3 source code: link
Try to ignore it explicitly:
$ cat .helmignore
secrets
# or
./secrets/my-secret.yaml

How to contribute to homebrew-cask using GitHub?

The quotation below is the instruction to contribute to brew-cask. However, I could not understand the sentence: github_user='<my-github-username>', I do not know whether should I input <>, and what is the github_user?
There is one email address, two names for one single GitHub account. What is more, when I input the last sentence: cask-repair --pull origin --push $github_user $outdated_cask. There is 2 errors: the requested upstream branch 'Andy1984' does not exist, and
Error creating pull request: Unprocessable Entity (HTTP 422)
Invalid value for "head"
and the result is There was an error submitting the pull request. Have you forked the repo and made sure the pull and push remotes exist? I am quite sure I followed the instructions. What is wrong?
# install and setup script - only needed once
brew install vitorgalvao/tiny-scripts/cask-repair
cask-repair --help
# fork homebrew-cask to your account - only needed once
cd "$(brew --repository)/Library/Taps/caskroom/homebrew-cask/Casks"
hub fork
# use to update <outdated_cask>
outdated_cask='<the-cask-i-want-to-update>'
github_user='<my-github-username>'
cd "$(brew --repository)/Library/Taps/caskroom/homebrew-cask/Casks"
cask-repair --pull origin --push $github_user $outdated_cask
According to the documentation you can also use a script to push new version of an existing cask.
Check: https://github.com/caskroom/homebrew-cask/blob/master/CONTRIBUTING.md#updating-a-cask
# install and setup script - only needed once
brew install vitorgalvao/tiny-scripts/cask-repair
cask-repair --help
# use to update <outdated_cask>
cask-repair <outdated_cask>

With Capistrano, how to rollback to a specific release?

With Capistrano, how to rollback to a specific release?
My server's folder has a /release folder, how can I rollback to a specific one?
Is it possible for me to get a list of releases on my computer locally?
I'm using GIT and this didn't work:
cap deploy -s revision:HASH
Update
The answer was written in the times of capistrano version 2. With the current capistrano version 3 you can achieve the same by using
cap production deploy:rollback ROLLBACK_RELEASE=2010123
Please refer to the Capistrano documentation for further details.
Thanks to #codenoob for pointing this out!
Old version
The following should work:
cap deploy:rollback -s previous_release=/path/to/release/on/server
Example:
Lets say you have deployed your app to /srv/some_app and you have the following releases/directory structure:
|- srv
|- some_app
|- shared
|- current -> /srv/some_app/releases/2012123
|- releases
|- 2010123
|- 2011123
|- 2012123
If you now want to go back from the current (2012123) release to the 2010123 one, you would use
cap deploy:rollback -s previous_release=/srv/some_app/releases/2010123
Another option is
$ cap deploy:rollback ROLLBACK_RELEASE=20160614133327
from http://capistranorb.com/documentation/getting-started/rollbacks/#
Capistrano names the release directories by date/time.
From the capistrano shell, you can connect to all the machines you are deploying to, and examine them from there:
$ cap shell
# Show them - it might be a long list
cap> ls /mnt/html/deployed/releases/
** [out :: hostname.example.com] 20110521130031
# how many releases on each machine?
cap> ls /mnt/html/deployed/releases/ |wc -l