Используя capistrano для развертывания от различных ответвлений мерзавца

Просто немного поиграли с осевым объектом g, и я нашел простой и, казалось бы, прямой способ сделать это, используя set_xlabels. Прочитайте документы здесь , спасибо @DavidG за его поиск. В частности,

set_xlabels ([label]) Пометить ось x в нижнем ряду сетки.

blockquote>
g.map(label, "x")
g.set_xlabels('x in [m]')

enter image description here

120
задан 7ochem 15 June 2016 в 08:23
поделиться

3 ответа

git rev-parse --abbrev-ref HEAD

возвратит текущее ответвление, в котором Вы находитесь точно.

я всегда устанавливал gpsh вместо git push -u origin branch_name

$ which gpsh
gpsh: aliased to git push -u origin `git rev-parse --abbrev-ref HEAD`
0
ответ дан 24 November 2019 в 01:37
поделиться

Общий ответ:

Если у вас есть файл настроек с измененным содержимым из среды в среду, вы должны сделать эту строку «шаблоном» (со строкой, представляющей имя переменной, например @ BRANCH_NAME @ или @ ENV_NAME @ ).

Тогда у вас будет (версионный) скрипт, способный читать ваш файл конфигурации, и заменить " @ BRANCH_NAME @ "на соответствующее значение, необходимое для процесса развертывания.

1
ответ дан 24 November 2019 в 01:37
поделиться

Alternatively you could structure it from the command line where you have a default branch and environment and also you are able to pass parameters to the cap call which could include the environment and the branch to use. This could be a branch that is explicitly passed or you could have a parameter which would indicate current branch as described in the link you listed.

#call with cap -S env="<env>" branch="<branchname>" deploy
...

# Prevents error if not parameter passed, assumes that default 'cap deploy' command
# and should deploy the master branch to the production server
set(:env, ‘production’) unless exists?(:env)
set(:branch, ‘master’) unless exists?(:branch)

if !env.nil? && env == "production"
   role :web, "production_ip_address"
else   # add more as needed 
   role :web, "development_ip_address"
end

if !branch.nil? && branch == "current"
   set :branch, $1 if `git branch` =~ /\* (\S+)\s/m
elsif !branch.nil?
   set :branch, branch
else   # add more as needed 
   set :branch, "master"
end
...

Code example borrowed heavily from here

15
ответ дан 24 November 2019 в 01:37
поделиться
Другие вопросы по тегам:

Похожие вопросы: