Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit d779f76

Browse files
committed
Merge pull request #157 from atikhono/master
Bitbucket 4.6 needs set-bitbucket-home.sh and set-bitbucket-user.sh
2 parents bb3b02c + 869628d commit d779f76

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

recipes/tomcat_configuration.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,19 @@
5757
action :create
5858
end
5959

60-
template "#{node['stash']['install_path']}/bitbucket/bin/user.sh" do
60+
user_sh = 'user.sh'
61+
if stash_version >= Chef::Version.new('4.6.0')
62+
user_sh = 'set-bitbucket-user.sh'
63+
64+
template "#{node['stash']['install_path']}/bitbucket/bin/set-bitbucket-home.sh" do
65+
source 'bitbucket/set-bitbucket-home.sh.erb'
66+
owner node['stash']['user']
67+
mode '0755'
68+
notifies :restart, "service[#{node['stash']['product']}]", :delayed
69+
end
70+
end
71+
72+
template "#{node['stash']['install_path']}/bitbucket/bin/#{user_sh}" do
6173
source 'bitbucket/user.sh.erb'
6274
owner node['stash']['user']
6375
mode '0755'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
#
3+
# One way to set the BITBUCKET_HOME path is here via this variable. Simply uncomment it and set a valid path like
4+
# /bitbucket/home. You can of course set it outside in the command terminal; that will also work.
5+
#
6+
7+
if [ "x${BITBUCKET_HOME}" = "x" ]; then
8+
export BITBUCKET_HOME="<%= node['stash']['home_path'] %>" # set by chef
9+
fi
10+
11+
# When upgrading from the packaged distribution BITBUCKET_HOME may not be set. Fallback to legacy STASH_HOME
12+
# and output a message for the user recommending that they update their environment
13+
if [ "x${BITBUCKET_HOME}" = "x" ]; then
14+
if [ ! "x${STASH_HOME}" = "x" ]; then
15+
BITBUCKET_HOME=${STASH_HOME}
16+
echo ""
17+
echo "--------------------------------------------------------------------------------------"
18+
echo " WARNING: STASH_HOME has been deprecated and replaced with BITBUCKET_HOME."
19+
echo " We recommend you set BITBUCKET_HOME instead of STASH_HOME."
20+
echo " Future versions of Bitbucket may not support the STASH_HOME variable."
21+
echo "--------------------------------------------------------------------------------------"
22+
fi
23+
fi
24+
25+
echo $BITBUCKET_HOME | grep -q " "
26+
if [ $? -eq 0 ]; then
27+
echo ""
28+
echo "-------------------------------------------------------------------------------"
29+
echo " BITBUCKET_HOME \"$BITBUCKET_HOME\" contains spaces."
30+
echo " Using a directory with spaces is likely to cause unexpected behaviour and is"
31+
echo " not supported. Please use a directory which does not contain spaces."
32+
echo "-------------------------------------------------------------------------------"
33+
exit 1
34+
fi
35+
36+
echo "BITBUCKET_HOME set to $BITBUCKET_HOME"

0 commit comments

Comments
 (0)