Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/var/www defined explicitly as the webroot #22

Open
mf-lit opened this issue Dec 6, 2017 · 4 comments
Open

/var/www defined explicitly as the webroot #22

mf-lit opened this issue Dec 6, 2017 · 4 comments

Comments

@mf-lit
Copy link
Contributor

mf-lit commented Dec 6, 2017

/var/www is explicitly defined as the webroot throughout these scripts.

This is fine most of the time, but does cause issues with the remove_old_builds script as on our server /var/www is a symlink to /srv/www and this causes the find command in that script to fail.

Ideally, we could pass the webroot in as a parameter (with /var/www as a fallback).

I'll try and raise a PR for this if/when I get time, but there are about 300 or so instances that will need changing!

@gregharvey
Copy link
Member

This is a good idea, we'll definitely do it. I'll look into how much we need to change.

@gregharvey
Copy link
Member

There's a few occurrences! :-D

Not sure we'll be able to regex find and replace for them, the easy bit is replacing /var/www with %s, the hard bit is putting the corresponding variable to pass in into the right place. Hmmm...

jenkins
common
Tests.py (6 matches)
13: with cd("/var/www/%s_%s_%s" % (repo, branch, build)): 
23: if run("find /var/www/%s_%s_%s/phpunit.xml" % (repo, branch, build)).return_code == 0: 
26: elif run("find /var/www/%s_%s_%s/www/core/phpunit.xml" % (repo, branch, build)).return_code == 0: 
29: elif run("find /var/www/%s_%s_%s/phpunit.xml.dist" % (repo, branch, build)).return_code == 0: 
32: elif run("find /var/www/%s_%s_%s/www/core/phpunit.xml.dist" % (repo, branch, build)).return_code == 0: 
37: with cd("/var/www/%s_%s_%s" % (repo, branch, build)): 
Utils.py (26 matches)
69: return run("readlink /var/www/live.%s.%s" % (repo, branch)) 
76: # Git clone the repo to /var/www/project_branch_build_BUILDID 
89: if sudo("mv ~jenkins/%s_%s_%s /var/www" % (repo, cleanbranch, build)).failed: 
90: raise SystemExit("Could not move the build into place in /var/www/! Aborting") 
99: if sudo("mv ~jenkins/%s_%s_%s /var/www" % (repo, buildtype, build)).failed: 
100: raise SystemExit("Could not move the build into place in /var/www/! Aborting") 
113: if put(script_dir + '/../util/remove_old_builds.sh', '/var/www/live.%s.%s' % (repo, put_location), mode=0755).failed: 
116: print "===> Remove builds script copied to %s:/var/www/live.%s.%s/remove_old_builds.sh" % (env.host, repo, put_location) 
118: sudo("/var/www/live.%s.%s/remove_old_builds.sh -d /var/www -r %s -b %s -k %s" % (repo, put_location, repo, put_location, keepbuilds)) 
121: # Adjust symlink in /var/www/project to point to the new build 
132: if run("stat /var/www/live.%s.%s" % (repo, buildtype)).succeeded: 
134: sudo("unlink /var/www/live.%s.%s" % (repo, buildtype)) 
137: sudo("ln -s /var/www/%s_%s_%s /var/www/live.%s.%s" % (repo, buildtype, build, repo, buildtype)) 
290: if run("stat /var/www/config").failed: 
292: sudo("mkdir --mode 0755 /var/www/config") 
293: sudo("chown jenkins:www-data /var/www/config") 
302: if run("stat /var/www/shared").failed: 
304: sudo("mkdir --mode 0755 /var/www/shared") 
305: sudo("chown jenkins:www-data /var/www/shared") 
327: if run("grep '%s' /var/www/%s_%s_%s/build-hooks/%s" % (disallowed, repo, branch, build, option)).return_code == 0: 
336: run("chmod +x /var/www/%s_%s_%s/build-hooks/%s" %(repo, branch, build, option)) 
339: if run("/var/www/%s_%s_%s/build-hooks/%s" %(repo, branch, build, option)).failed: 
344: if run("/var/www/%s_%s_%s/build-hooks/%s" %(repo, branch, build, option)).failed: 
545: with cd("/var/www/%s_%s_%s" % (repo, buildtype, build)): 
drupal
common
AdjustConfiguration.py (51 matches)
15: if run("stat /var/www/config").failed: 
17: sudo("mkdir --mode 0755 /var/www/config") 
18: sudo("chown jenkins:www-data /var/www/config") 
22: sudo("chmod -R 775 /var/www/%s_%s_%s/www/sites/default" % (repo, branch, build)) 
25: # 1. Check if a repo_branch.settings.inc file exists in /var/www/config 
38: if run("stat /var/www/config/%s_%s.settings.inc" % (repo, branch)).failed: 
40: print "The shared settings file /var/www/config/%s_%s.settings.inc was not found. We'll try and move a sites/default/settings.php file there, if it exists." % (repo, branch, repo, branch) 
41: if run("stat /var/www/%s_%s_%s/www/sites/default/settings.php" % (repo, branch, build)).failed: 
43: print "We couldn't find /var/www/%s_%s_%s/www/sites/default/settings.php, so we'll search for a buildtype specific file as a last resort." % (repo, branch, build) 
44: if run("stat /var/www/%s_%s_%s/www/sites/default/%s.settings.php" % (repo, branch, build, buildtype)).failed: 
46: raise SystemExit("Couldn't find any settings.php whatsoever! As it's unlikely we'll be able to bootstrap a site, we're going to abort early. TIP: Add a /var/www/config/%s_%s.settings.inc file manually and do a file_exists() check for /var/www/%s_%s_%s/www/sites/%s.settings.php and if it exists, include it. Then symlink that to /var/www/%s_%s_%s/www/sites/default/settings.php." % (repo, branch, repo, branch, build, buildtype, repo, branch, build)) 
49: print "We found /var/www/%s_%s_%s/www/sites/default/%s.settings.php, so we'll add a commented line at the bottom of it to indicate it's copied to /var/www/config/%s_%s.settings.inc. This will prevent %s.settings.php being included in the settings.inc file in subsequent builds. We'll also move it to /var/www/config/%s_%s.settings.inc." % (repo, branch, build, buildtype, repo, branch, buildtype, repo, branch) 
50: settings_file = "/var/www/%s_%s_%s/www/sites/default/%s.settings.php" % (repo, branch, build, buildtype) 
52: sudo("mv /var/www/%s_%s_%s/www/sites/default/%s.settings.php /var/www/config/%s_%s.settings.inc" % (repo, branch, build, buildtype, repo, branch)) 
53: sudo("chown jenkins:www-data /var/www/config/%s_%s.settings.inc" % (repo, branch)) 
54: sudo("chmod 664 /var/www/config/%s_%s.settings.inc" % (repo, branch)) 
55: run("ln -s /var/www/config/%s_%s.settings.inc /var/www/%s_%s_%s/www/sites/default/settings.php" % (repo, branch, repo, branch, build)) 
59: settings_file = "/var/www/%s_%s_%s/www/sites/default/settings.php" % (repo, branch, build) 
62: #append_string = """$file = '/var/www/live.%s.%s/www/sites/default/%s.settings.php'; 
63: append_string = """$file = '/var/www/%s_%s_%s/www/sites/default/%s.settings.php'; 
72: replace_string = "/var/www/.+_.+_build_[0-9]+/.+\.settings\.php" 
73: replace_with = "/var/www/%s_%s_%s/www/sites/default/%s.settings.php" % (repo, branch, build, buildtype) 
76: # 7. We found a settings.inc file in /var/www/config. Let's see if we first should append anything to it, and then if we need to. 
78: settings_file = "/var/www/config/%s_%s.settings.inc" % (repo, branch) 
89: #append_string = """$file = '/var/www/live.%s.%s/www/sites/default/%s.settings.php'; 
90: append_string = """$file = '/var/www/%s_%s_%s/www/sites/default/%s.settings.php'; 
99: replace_string = "/var/www/.+_.+_build_[0-9]+/.+\.settings\.php" 
100: replace_with = "/var/www/%s_%s_%s/www/sites/default/%s.settings.php" % (repo, branch, build, buildtype) 
103: if run("stat /var/www/%s_%s_%s/www/sites/default/settings.php" % (repo, branch, build)).failed: 
105: run("ln -s /var/www/config/%s_%s.settings.inc /var/www/%s_%s_%s/www/sites/default/settings.php" % (repo, branch, repo, branch, build)) 
108: sudo("mv /var/www/%s_%s_%s/www/sites/default/settings.php /var/www/%s_%s_%s/www/sites/default/settings.php.bak" % (repo, branch, build, repo, branch, build)) 
109: run("ln -s /var/www/config/%s_%s.settings.inc /var/www/%s_%s_%s/www/sites/default/settings.php" % (repo, branch, repo, branch, build)) 
117: sudo("ln -s /var/www/shared/%s_%s_files/ /var/www/%s_%s_%s/www/sites/default/files" % (repo, branch, repo, branch, build)) 
126: if run("stat /var/www/%s_%s_%s/www/sites/default/%s.drushrc.php" % (repo, branch, build, branch)).failed: 
127: print "Couldn't find /var/www/%s_%s_%s/www/sites/default/%s.drushrc.php, so moving on..." % (repo, branch, build, branch) 
129: if sudo("cp /var/www/%s_%s_%s/www/sites/default/%s.drushrc.php /var/www/%s_%s_%s/www/sites/default/drushrc.php" % (repo, branch, build, branch, repo, branch, build)).failed: 
130: print "Could not copy /var/www/%s_%s_%s/www/sites/default/%s.drushrc.php to /var/www/%s_%s_%s/www/sites/default/drushrc.php. Continuing with build, but perhaps have a look into why the file couldn't be copied." % (repo, branch, build, branch, repo, branch, build) 
132: print "Copied /var/www/%s_%s_%s/www/sites/default/%s.drushrc.php to /var/www/%s_%s_%s/www/sites/default/drushrc.php" % (repo, branch, build, branch, repo, branch, build) 
Autoscale.py
7: run("rm -R /var/www/%s/www/sites/default/*.settings.php" % repo) 
Drupal.py (45 matches)
103: if run("find /var/www/%s_%s_%s -maxdepth 1 -type d -name db | egrep '.*'" % (repo, branch, build)).return_code == 0: 
104: sudo("rm /var/www/%s_%s_%s/db/*.sql.bz2" % (repo, branch, build)) 
107: run("mkdir -p /var/www/%s_%s_%s/db" % (repo, branch, build)) 
141: run('drush @%s_%s sql-dump | bzip2 -f > /var/www/%s_%s_%s/db/%s_%s.sql.bz2' % (repo, syncbranch, repo, branch, build, repo, syncbranch)) 
195: local('scp /tmp/dbbackups/custombranch_%s_%s_from_%s.sql.bz2 %s:/var/www/%s_%s_%s/db/' % (repo, now, syncbranch, env.host_string, repo, branch, build)) 
233: if run("find /var/www/%s_%s_%s/composer.json" % (repo, branch, build)).return_code == 0: 
234: path = "/var/www/%s_%s_%s" % (repo, branch, build) 
236: path = "/var/www/%s_%s_%s/www" % (repo, branch, build) 
258: with cd("/var/www/%s_%s_%s/www/sites/default" % (repo, branch, build)): 
291: if sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y updatedb'" % (repo, branch, build)).failed: 
297: if sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y entity-updates'" % (repo, branch, build)).failed: 
307: with cd("/var/www/%s_%s_%s/www/sites/default" % (repo, branch, build)): 
328: with cd("/var/www/%s_%s_%s/www/sites/default" % (repo, branch, build)): 
343: sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y cr'" % (repo, branch, build)) 
345: sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y cc all'" % (repo, branch, build)) 
355: if run("find /var/www/%s_%s_%s/www -type d -name environment_indicator | egrep '.*'" % (repo, branch, build)).return_code == 0: 
381: print "===> Drupal 7 site, checking in /var/www/%s_%s_%s/www/sites/default/%s.settings.php for $conf['environment_indicator_overwritten_name']" % (repo, branch, build, buildtype) 
383: settings_file = "/var/www/%s_%s_%s/www/sites/default/%s.settings.php" % (repo, branch, build, buildtype) 
387: print "===> Settings already exist in %s.settings.php, we will not write anything to /var/www/config/%s_%s.settings.inc" % (buildtype, repo, branch) 
390: print "===> Checking for and appending environment_indicator settings to /var/www/config/%s_%s.settings.inc" % (repo, branch) 
391: append("/var/www/config/%s_%s.settings.inc" % (repo, branch), "$conf['environment_indicator_overwrite'] = 'TRUE';", True) 
392: append("/var/www/config/%s_%s.settings.inc" % (repo, branch), "$conf['environment_indicator_overwritten_name'] = '%s';" % buildtype, True) 
393: append("/var/www/config/%s_%s.settings.inc" % (repo, branch), "$conf['environment_indicator_overwritten_color'] = '%s';" % environment_indicator_color, True) 
394: append("/var/www/config/%s_%s.settings.inc" % (repo, branch), "$conf['environment_indicator_overwritten_text_color'] = '#ffffff';", True) 
400: print "===> Drupal 8 site, checking in /var/www/%s_%s_%s/www/sites/default/%s.settings.php for $config['environment_indicator.indicator']['name']" % (repo, branch, build, buildtype) 
402: settings_file = "/var/www/%s_%s_%s/www/sites/default/%s.settings.php" % (repo, branch, build, buildtype) 
406: print "===> Settings already exist in %s.settings.php, we will not write anything to /var/www/config/%s_%s.settings.inc" % (buildtype, repo, branch) 
409: print "===> Checking for and appending environment_indicator settings to /var/www/config/%s_%s.settings.inc" % (repo, branch) 
410: append("/var/www/config/%s_%s.settings.inc" % (repo, branch), "$config['environment_indicator.indicator']['name'] = '%s';" % buildtype, True) 
411: append("/var/www/config/%s_%s.settings.inc" % (repo, branch), "$config['environment_indicator.indicator']['bg_color'] = '%s';" % environment_indicator_color, True) 
412: append("/var/www/config/%s_%s.settings.inc" % (repo, branch), "$config['environment_indicator.indicator']['fg_color'] = '#ffffff';", True) 
416: #with cd("/var/www/%s_%s_%s/www/sites/default" % (repo, branch, build)): 
418: sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y en environment_indicator'" % (repo, branch, build)) 
433: if sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y cim'" % (repo, branch, build)).failed: 
435: sudo("unlink /var/www/live.%s.%s" % (repo, branch)) 
436: sudo("ln -s %s /var/www/live.%s.%s" % (previous_build, repo, branch)) 
457: if run("find /var/www/%s_%s_%s/www -type d -name readonlymode | egrep '.*'" % (repo, branch, build)).return_code == 0: 
487: if run("find /var/www/%s_%s_%s/www -type d -name readonlymode | egrep '.*'" % (repo, branch, build)).return_code == 0: 
495: sudo("unlink /var/www/live.%s.%s" % (repo, branch)) 
496: sudo("ln -s %s /var/www/live.%s.%s" % (previous_build, repo, branch)) 
509: sudo("unlink /var/www/live.%s.%s" % (repo, branch)) 
510: sudo("ln -s %s /var/www/live.%s.%s" % (previous_build, repo, branch)) 
516: sudo("unlink /var/www/live.%s.%s" % (repo, branch)) 
517: sudo("ln -s %s /var/www/live.%s.%s" % (previous_build, repo, branch)) 
532: with cd('/var/www/%s_%s_%s/www/sites/default' % (repo, branch, build)): 
DrupalTests.py (6 matches)
75: run("/home/jenkins/run-tests /var/www/%s_%s_%s/www %s %s | tee /tmp/%s.%s.review" % (repo, branch, build, test_type, option, repo, option)) 
106: with cd("/var/www/%s_%s_%s/tests/behat" % (repo, branch, build)): 
167: if sudo("stat /var/www/live.%s.%s/tests/behat/xml/default.xml" % (repo, branch)).failed: 
168: print "No xml file found in /var/www/live.%s.%s/tests/behat/xml. That's weird, but we'll carry on." % (repo, branch) 
170: print "Found an xml in /var/www/live.%s.%s/tests/behat/xml. Going to copy it to the Jenkins server." % (repo, branch) 
172: if local("scp jenkins@%s:/var/www/live.%s.%s/tests/behat/xml/default.xml %s/tests/behat/xml/" % (env.host, repo, branch, cwd)).failed: 
DrupalUtils.py (2 matches)
10: drupal_path = "/var/www/live.%s.%s" % (repo, branch) 
12: drupal_path = "/var/www/%s_%s_%s" % (repo, branch, build) 
fabfile-multisite.py
72: # Make sure /var/www/config exists 
fabfile-updates.py
121: print "####### BUILD COMPLETE. If you need to revert this build, run the following command: sudo /home/jenkins/revert -b %s -d %s -s /var/www/live.%s.%s -a %s_%s" % (previous_build, previous_db, repo, branch, repo, branch) 
fabfile.py (5 matches)
318: live_build = run("readlink /var/www/live.%s.%s" % (repo, branch)) 
319: this_build = "/var/www/%s_%s_%s" % (repo, branch, build) 
339: live_build = run("readlink /var/www/live.%s.%s" % (repo, branch)) 
340: this_build = "/var/www/%s_%s_%s" % (repo, branch, build) 
386: print "####### BUILD COMPLETE. If you need to revert this build, run the following command: sudo /home/jenkins/revert -b %s -d %s -s /var/www/live.%s.%s -a %s_%s" % (previous_build, previous_db, repo, branch, repo, branch) 
FeatureBranches.py (10 matches)
18: if sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y updatedb'" % (repo, branch, build)).failed: 
23: sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y cr'" % (repo, branch, build)) 
25: sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y cc all'" % (repo, branch, build)) 
29: if sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y cim'" % (repo, branch, build)).failed: 
34: sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y cr'" % (repo, branch, build)) 
126: with cd("/var/www/live.%s.%s/www/sites/default" % (repo, branch)): 
150: sudo("unlink /var/www/live.%s.%s" % (repo, branch)) 
151: sudo("rm -rf /var/www/%s_%s_*" % (repo, branch)) 
155: sudo("rm -rf /var/www/shared/%s_%s_*" % (repo, branch)) 
159: sudo("rm /var/www/config/%s_%s.settings.inc" % (repo, branch)) 
InitialBuild.py (45 matches)
29: sudo("ln -nsf /var/www/%s_%s_%s /var/www/live.%s.%s" % (repo, branch, build, repo, branch)) 
36: if run("stat /var/www/%s_%s_%s/www/sites/default/files" % (repo, branch, build)).return_code == 0: 
38: sudo("mv /var/www/%s_%s_%s/www/sites/default/files /var/www/%s_%s_%s/www/sites/default/files_bak" % (repo, branch, build, repo, branch, build)) 
39: sudo("chmod 775 /var/www/%s_%s_%s/www/sites/default/files_bak" % (repo, branch, build)) 
40: sudo("find /var/www/%s_%s_%s/www/sites/default/files_bak -type d -print0 | xargs -r -0 chmod 775" % (repo, branch, build)) 
41: sudo("find /var/www/%s_%s_%s/www/sites/default/files_bak -type f -print0 | xargs -r -0 chmod 664" % (repo, branch, build)) 
42: sudo("mv /var/www/%s_%s_%s/www/sites/default/files_bak/* /var/www/shared/%s_%s_files/" % (repo, branch, build, repo, branch)) 
44: sudo("ln -s /var/www/shared/%s_%s_files /var/www/%s_%s_%s/www/sites/default/files" % (repo, branch, repo, branch, build)) 
54: if sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y updatedb'" % (repo, branch, build)).failed: 
57: if sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y entity-updates'" % (repo, branch, build)).failed: 
70: if sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y cim'" % (repo, branch, build)).failed: 
85: sudo("mkdir -p /var/www/shared/%s_%s_files" % (repo, branch)) 
86: sudo("chown jenkins:www-data /var/www/shared/%s_%s_files" % (repo, branch)) 
87: sudo("chmod 775 /var/www/shared/%s_%s_files" % (repo, branch)) 
90: sudo("mkdir -p /var/www/shared/%s_%s_private_files" % (repo, branch)) 
91: sudo("chown jenkins:www-data /var/www/shared/%s_%s_private_files" % (repo, branch)) 
92: sudo("chmod 775 /var/www/shared/%s_%s_private_files" % (repo, branch)) 
99: #if(glob.glob("/var/www/%s_%s_%s/db/*.sql.bz2")): 
104: if run("find /var/www/%s_%s_%s -maxdepth 1 -type d -name db | egrep '.*'" % (repo, branch, build)).return_code == 0: 
165: sitedir = "/var/www/%s_%s_%s/www" % (repo, branch, build) 
172: if sudo("bzcat /var/www/%s_%s_%s/db/*.sql.bz2 | drush -y sql-cli" % (repo, branch, build)).failed: 
176: sudo("bunzip2 /var/www/%s_%s_%s/db/*.sql.bz2" % (repo, branch, build)) 
177: sitedir = "/var/www/%s_%s_%s/www" % (repo, branch, build) 
179: common.Utils._sshagent_run("/home/jenkins/%s.sh %s %s %s %s %s /var/www/%s_%s_%s/db %s" % (dbscript, dbhost, repo, newpass, sitedir, branch, repo, branch, build, list_of_app_servers)) 
182: sudo("/home/jenkins/%s.sh %s %s /var/www/live.%s.%s %s $(find /var/www/%s_%s_%s/db -type f -name *.sql)" % (dbscript, repo, newpass, repo, branch, buildtype, repo, branch, build)) 
184: sitedir = "/var/www/%s_%s_%s/www" % (repo, branch, build) 
218: sudo("chown -R jenkins:www-data /var/www/shared/%s_%s_files" % (repo, branch)) 
219: sudo("chmod 775 /var/www/shared/%s_%s_files" % (repo, branch)) 
221: print "===> Temporarily moving settings.php to shared area /var/www/shared/%s_%s.settings.inc so all servers in a cluster can access it" % (repo, branch) 
222: sudo("mv /var/www/%s_%s_%s/www/sites/default/settings.php /var/www/shared/%s_%s.settings.inc" % (repo, branch, build, repo, branch)) 
229: print "===> Copying %s_%s.settings.inc from shared to config area /var/www/config/%s_%s.settings.inc. Do an 'include' of this in your main settings.php, or else it will be symlinked directly as settings.php" % (repo, branch, repo, branch) 
231: if sudo("mkdir -p /var/www/config").failed: 
233: sudo("cp /var/www/shared/%s_%s.settings.inc /var/www/config/%s_%s.settings.inc" % (repo, branch, repo, branch)) 
234: sudo("chown jenkins:www-data /var/www/config/%s_%s.settings.inc" % (repo, branch)) 
235: sudo("chmod 644 /var/www/config/%s_%s.settings.inc" % (repo, branch)) 
244: if run("stat /var/www/shared/%s_%s.settings.inc" % (repo, branch)).return_code == 0: 
245: sudo("rm /var/www/shared/%s_%s.settings.inc" % (repo, branch)) 
246: print "===> Deleting /var/www/shared/%s_%s.settings.inc as we don't need it now" % (repo, branch) 
Multisite.py (121 matches)
17: settings_file = "/var/www/config/%s_%s.settings.inc" % (alias, branch) 
18: stable_build = run("readlink /var/www/live.%s.%s" % (repo, branch)) 
19: replace_string = "/var/www/.*\.settings\.php" 
77: with cd("/var/www/%s_%s_%s/www/sites/%s" % (repo, branch, build, buildsite)): 
109: print "Create /var/www/config if it doesn't exist and set correct ownership." 
110: sudo("mkdir -p /var/www/config") 
111: sudo("chown jenkins:www-data /var/www/config") 
118: if run("stat /var/www/live.%s.%s" % (repo, branch)).failed: 
121: sudo("ln -nsf /var/www/%s_%s_%s /var/www/live.%s.%s" % (repo, branch, build, repo, branch)) 
132: sudo("mkdir -p /var/www/shared/%s_%s_files" % (alias, branch)) 
133: sudo("chown -R jenkins:www-data /var/www/shared/%s_%s_files" % (alias, branch)) 
134: sudo("chmod 2775 /var/www/shared/%s_%s_files" % (alias, branch)) 
136: run("ln -nsf /var/www/shared/%s_%s_files /var/www/%s_%s_%s/www/sites/%s/files" % (alias, branch, repo, branch, build, buildsite)) 
139: sudo("mkdir -p /var/www/shared/%s_%s_private_files" % (alias, branch)) 
140: sudo("chown jenkins:www-data /var/www/shared/%s_%s_private_files" % (alias, branch)) 
141: sudo("chmod 775 /var/www/shared/%s_%s_private_files" % (alias, branch)) 
166: sitedir = "/var/www/%s_%s_%s/www" % (repo, branch, build) 
171: if run("find /var/www/%s_%s_%s -maxdepth 1 -type d -name db | egrep '.*'" % (repo, branch, build)).return_code == 0: 
213: if run("stat /var/www/%s_%s_%s/db/%s.sql.bz2" % (repo, branch, build, buildsite)).failed: 
218: if sudo("bzcat /var/www/%s_%s_%s/db/%s.sql.bz2 | drush -y sql-cli" % (repo, branch, build, buildsite)).failed: 
222: if run("stat /var/www/%s_%s_%s/db/%s.sql.bz2" % (repo, branch, build, buildsite)).failed: 
229: sudo("bunzip2 /var/www/%s_%s_%s/db/%s.sql.bz2" % (repo, branch, build, buildsite)) 
231: sudo("/home/jenkins/%s.sh %s %s /var/www/%s_%s_%s/www %s $(find /var/www/%s_%s_%s/db -type f -name %s.sql) %s" % (dbscript, alias, newpass, repo, branch, build, branch, repo, branch, build, buildsite, buildsite)) 
235: sudo("/home/jenkins/%s.sh %s %s %s /var/www/%s_%s_%s/www %s %s %s %s" % (dbscript, alias, dbhost, newpass, repo, branch, build, branch, buildsite, list_of_app_servers, drupal8)) 
237: sudo("/home/jenkins/%s.sh %s %s /var/www/%s_%s_%s/www %s %s" % (dbscript, alias, newpass, repo, branch, build, branch, buildsite)) 
239: sudo("mv /var/www/%s_%s_%s/www/sites/%s/settings.php /var/www/shared/%s_%s.settings.inc" % (repo, branch, build, buildsite, alias, branch)) 
248: sudo("chmod 755 /var/www/%s_%s_%s/www/sites/%s" % (repo, branch, build, buildsite)) 
250: # Move settings.php file to /var/www/shared, where it can be copied to multiple app 
252: sudo("cp /var/www/shared/%s_%s.settings.inc /var/www/config/%s_%s.settings.inc" % (alias, branch, alias, branch)) 
254: sudo("chown jenkins:www-data /var/www/shared/%s_%s.settings.inc" % (alias, branch)) 
255: sudo("chmod 644 /var/www/shared/%s_%s.settings.inc" % (alias, branch)) 
256: sudo("ln -s /var/www/config/%s_%s.settings.inc /var/www/%s_%s_%s/www/sites/%s/settings.php" % (alias, branch, repo, branch, build, buildsite)) 
266: with cd("/var/www/%s_%s_%s/www/sites/%s" % (repo, branch, build, buildsite)): 
278: if run("stat /var/www/shared/%s_%s.settings.inc" % (alias, branch)).return_code == 0: 
279: sudo("rm /var/www/shared/%s_%s.settings.inc" % (alias, branch)) 
280: print "===> Deleting /var/www/shared/%s_%s.settings.inc as we don't need it now" % (alias, branch) 
327: sudo("/home/jenkins/drush_alias_multisite.sh %s %s %s /var/www/live.%s.%s/www" % (alias, url, branch, repo, branch)) 
352: sudo("chown -R jenkins:www-data /var/www/shared/%s_%s_files" % (alias, branch)) 
353: sudo("chmod 2775 /var/www/shared/%s_%s_files" % (alias, branch)) 
392: sudo("ln -nsf /var/www/shared/%s_%s_files/ /var/www/%s_%s_%s/www/sites/%s/files" % (alias, branch, repo, branch, build, buildsite)) 
408: if run("stat /var/www/config").failed: 
410: sudo("mkdir --mode 0755 /var/www/config") 
411: sudo("chown jenkins:www-data /var/www/config") 
418: sudo("chmod -R 775 /var/www/%s_%s_%s/www/sites/%s" % (repo, branch, build, buildsite)) 
421: # 1. Check if a repo_branch.settings.inc file exists in /var/www/config 
434: if run("stat /var/www/config/%s_%s.settings.inc" % (alias, branch)).failed: 
438: if run("stat /var/www/shared/%s_%s.settings.inc" % (alias, branch)).failed: 
440: print "The shared settings file /var/www/shared/%s_%s.settings.inc was not found, nor was /var/www/config/%s_%s.settings.inc. We'll try and move a sites/%s/settings.php file there, if it exists." % (alias, branch, alias, branch, buildsite) 
441: if run("stat /var/www/%s_%s_%s/www/sites/%s/settings.php" % (repo, branch, build, buildsite)).failed: 
443: print "We couldn't find /var/www/%s_%s_%s/www/sites/%s/settings.php, so we'll search for a branch specific file as a last resort." % (repo, branch, build, buildsite) 
444: if run("stat /var/www/%s_%s_%s/www/sites/%s/%s.settings.php" % (repo, branch, build, buildsite, buildtype)).failed: 
446: raise SystemExit("Couldn't find any settings.php whatsoever! As it's unlikely we'll be able to bootstrap a site, we're going to abort early. TIP: Add a /var/www/config/%s_%s.settings.inc file manually and do a file_exists() check for /var/www/%s_%s_%s/www/sites/%s/%s.settings.php and if it exists, include it. Then symlink that to /var/www/%s_%s_%s/www/sites/%s/settings.php." % (repo, branch, repo, branch, build, buildsite, buildtype, repo, branch, build, buildsite)) 
449: print "We found /var/www/%s_%s_%s/www/sites/%s/%s.settings.php, so we'll add a commented line at the bottom of it to indicate it's copied to /var/www/config/%s_%s.settings.inc. This will prevent %s.settings.php being included in the settings.inc file in subsequent builds. We'll also move it to /var/www/config/%s_%s.settings.inc." % (repo, branch, build, buildsite, buildtype, alias, branch, buildtype, alias, branch) 
450: settings_file = "/var/www/%s_%s_%s/www/sites/%s/%s.settings.php" % (repo, branch, build, buildsite, buildtype) 
452: sudo("mv /var/www/%s_%s_%s/www/sites/%s/%s.settings.php /var/www/config/%s_%s.settings.inc" % (repo, branch, build, buildsite, buildtype, alias, branch)) 
453: sudo("chown jenkins:www-data /var/www/config/%s_%s.settings.inc" % (alias, branch)) 
454: sudo("chmod 664 /var/www/config/%s_%s.settings.inc" % (alias, branch)) 
455: run("ln -s /var/www/config/%s_%s.settings.inc /var/www/%s_%s_%s/www/sites/%s/settings.php" % (alias, branch, repo, branch, build, buildsite)) 
459: settings_file = "/var/www/%s_%s_%s/www/sites/%s/settings.php" % (repo, branch, build, buildsite) 
462: #append_string = """$file = '/var/www/live.%s.%s/www/sites/default/%s.settings.php'; 
463: append_string = """$file = '/var/www/%s_%s_%s/www/sites/%s/%s.settings.php'; 
472: replace_string = "/var/www/.*\.settings\.php" 
473: replace_with = "/var/www/%s_%s_%s/www/sites/%s/%s.settings.php" % (repo, branch, build, buildsite, buildtype) 
478: # 7a. We found a shared settings.inc file in /var/www/shared. We need to copy it to /var/www/config. 
479: print "We found /var/www/shared/%s_%s.settings.inc. We need to copy it to /var/www/config." % (alias, branch) 
480: run("cp -a /var/www/shared/%s_%s.settings.inc /var/www/config/%s_%s.settings.inc" % (alias, branch, alias, branch)) 
482: settings_file = "/var/www/config/%s_%s.settings.inc" % (alias, branch) 
493: #append_string = """$file = '/var/www/live.%s.%s/www/sites/default/%s.settings.php'; 
494: append_string = """$file = '/var/www/%s_%s_%s/www/sites/%s/%s.settings.php'; 
503: replace_string = "/var/www/.*\.settings\.php" 
504: replace_with = "/var/www/%s_%s_%s/www/sites/%s/%s.settings.php" % (repo, branch, build, buildsite, buildtype) 
507: if run("stat /var/www/%s_%s_%s/www/sites/%s/settings.php" % (repo, branch, build, buildsite)).failed: 
509: run("ln -s /var/www/config/%s_%s.settings.inc /var/www/%s_%s_%s/www/sites/%s/settings.php" % (alias, branch, repo, branch, build, buildsite)) 
512: sudo("mv /var/www/%s_%s_%s/www/sites/%s/settings.php /var/www/%s_%s_%s/www/sites/%s/settings.php.bak" % (repo, branch, build, buildsite, repo, branch, build, buildsite)) 
513: run("ln -s /var/www/config/%s_%s.settings.inc /var/www/%s_%s_%s/www/sites/%s/settings.php" % (alias, branch, repo, branch, build, buildsite)) 
516: # 7b. We found a settings.inc file in /var/www/config. Let's see if we first should append anything to it, and then if we need to. 
518: settings_file = "/var/www/config/%s_%s.settings.inc" % (alias, branch) 
529: #append_string = """$file = '/var/www/live.%s.%s/www/sites/default/%s.settings.php'; 
530: append_string = """$file = '/var/www/%s_%s_%s/www/sites/%s/%s.settings.php'; 
539: replace_string = "/var/www/.*\.settings\.php" 
540: replace_with = "/var/www/%s_%s_%s/www/sites/%s/%s.settings.php" % (repo, branch, build, buildsite, buildtype) 
543: if run("stat /var/www/%s_%s_%s/www/sites/%s/settings.php" % (repo, branch, build, buildsite)).failed: 
545: run("ln -s /var/www/config/%s_%s.settings.inc /var/www/%s_%s_%s/www/sites/%s/settings.php" % (alias, branch, repo, branch, build, buildsite)) 
548: sudo("mv /var/www/%s_%s_%s/www/sites/%s/settings.php /var/www/%s_%s_%s/www/sites/%s/settings.php.bak" % (repo, branch, build, buildsite, repo, branch, build, buildsite)) 
549: run("ln -s /var/www/config/%s_%s.settings.inc /var/www/%s_%s_%s/www/sites/%s/settings.php" % (alias, branch, repo, branch, build, buildsite)) 
564: with cd("/var/www/%s_%s_%s/www/sites/%s" % (repo, branch, build, buildsite)): 
604: with cd("/var/www/%s_%s_%s/www/sites/%s" % (repo, branch, build, buildsite)): 
646: if run("find /var/www/%s_%s_%s/www -type d -name environment_indicator | egrep '.*'" % (repo, branch, build)).return_code == 0: 
667: append("/var/www/shared/%s_%s.settings.inc" % (repo, branch), "$conf['environment_indicator_overwrite'] = 'TRUE';", True) 
668: append("/var/www/shared/%s_%s.settings.inc" % (repo, branch), "$conf['environment_indicator_overwritten_name'] = '%s';" % buildtype, True) 
669: append("/var/www/shared/%s_%s.settings.inc" % (repo, branch), "$conf['environment_indicator_overwritten_color'] = '%s';" % environment_indicator_color, True) 
670: append("/var/www/shared/%s_%s.settings.inc" % (repo, branch), "$conf['environment_indicator_overwritten_text_color'] = '#ffffff';", True) 
673: append("/var/www/shared/%s_%s.settings.inc" % (repo, branch), "$config['environment_indicator.indicator']['name'] = '%s';" % buildtype, True) 
674: append("/var/www/shared/%s_%s.settings.inc" % (repo, branch), "$config['environment_indicator.indicator']['bg_color'] = '%s';" % environment_indicator_color, True) 
675: append("/var/www/shared/%s_%s.settings.inc" % (repo, branch), "$config['environment_indicator.indicator']['fg_color'] = '#ffffff';", True) 
679: with cd("/var/www/%s_%s_%s/www/sites/default" % (repo, branch, build)): 
697: if sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/%s && drush -y fra --force'" % (repo, branch, build, buildsite)).failed: 
716: with cd('/var/www/%s_%s_%s/www/sites/%s' % (repo, branch, build, buildsite)): 
Revert.py (3 matches)
21: settings_file = "/var/www/config/%s_%s.settings.inc" % (repo, branch) 
22: stable_build = run("readlink /var/www/live.%s.%s" % (repo, branch)) 
23: replace_string = "/var/www/.*\.settings\.php" 
StandardHooks.py (7 matches)
14: print "First see if the directory /var/www/shared/%s_%s_exported_config exists." % (repo, branch) 
15: if run("stat /var/www/shared/%s_%s_exported_config" % (repo, branch)).return_code == 0: 
17: if sudo("rm -r /var/www/shared/%s_%s_exported_config" % (repo, branch)).failed: 
21: sudo("chown -R jenkins:www-data /var/www/shared/%s_%s_exported_config" % (repo, branch)) 
22: if sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www/sites/default && drush -y cex --destination=/var/www/shared/%s_%s_exported_config" % (repo, branch, build, repo, branch)).failed: 
25: print "Exported config successfully. It will be available at /var/www/shared/%s_%s_exported_config" % (repo, branch) 
Sync.py (4 matches)
37: sync_dir = '/var/www/shared/synced_assets' 
56: staging_files_dir = "/var/www/shared/%s_%s_files" % (shortname, staging_branch) 
58: if sudo("readlink /var/www/shared/%s_%s_files" % (shortname, staging_branch)).return_code == 0: 
59: staging_files_dir = sudo("readlink /var/www/shared/%s_%s_files" % (shortname, staging_branch)) 
Updates.py (4 matches)
12: with cd("/var/www/%s_%s_%s" % (repo, branch, build)): 
23: with cd("/var/www/live.%s.%s/www" % (repo, branch)): 
46: with cd("/var/www/%s_%s_%s" % (repo, branch, build)): 
55: _sshagent_run("cd /var/www/%s_%s_%s && git push origin %s --force" % (repo, branch, build, branch)) 
flat
common
Flat.py (2 matches)
10: if sudo("ln -s /var/www/%s_%s_%s/assets/%s /var/www/%s_%s_%s/build/%s" % (repo, branch, build, item, repo, branch, build, item)).failed: 
symfony
common
AdjustConfiguration.py (12 matches)
10: if run("stat /var/www/config/%s_%s.parameters.yml" % (repo, buildtype)).failed: 
11: print "No parameters.yml file, moving parameters.yml.dist to shared /var/www/config/%s_%s.parameters.yml. Database credentials will need adding." % (repo, buildtype) 
13: # We copy parameters.yml.dist, which is an empty template, to /var/www/shared/ ready to take database credentials. 
16: sudo("cp /var/www/%s_%s_%s/app/config/parameters.yml.dist /var/www/config/%s_%s.parameters.yml" % (repo, buildtype, build, repo, buildtype)) 
17: sudo("chown jenkins:www-data /var/www/config/%s_%s.parameters.yml" % (repo, buildtype)) 
18: sudo("chmod 664 /var/www/config/%s_%s.parameters.yml" % (repo, buildtype)) 
19: run("ln -s /var/www/config/%s_%s.parameters.yml /var/www/%s_%s_%s/app/config/parameters.yml" % (repo, buildtype, repo, buildtype, build)) 
22: print "We found /var/www/config/%s_%s.parameters.yml so nothing to do except set up the link." % (repo, buildtype) 
23: run("ln -s /var/www/config/%s_%s.parameters.yml /var/www/%s_%s_%s/app/config/parameters.yml" % (repo, buildtype, repo, buildtype, build)) 
23: run("ln -s /var/www/config/%s_%s.parameters.yml /var/www/%s_%s_%s/app/config/parameters.yml" % (repo, buildtype, repo, buildtype, build)) 
fabfile.py (2 matches)
62: if run("stat /var/www/config/%s_%s.parameters.yml" % (repo, console_buildtype)).failed: 
89: if run("stat /var/www/%s_%s_%s/vendor" % (repo, buildtype, build)).failed: 
InitialBuild.py (5 matches)
17: if sudo("mkdir -p /var/www/config").failed: 
19: if sudo("mkdir -p /var/www/shared/%s_%s_logs" % (repo, buildtype)).failed: 
21: if sudo("mkdir -p /var/www/shared/%s_%s_sessions" % (repo, buildtype)).failed: 
23: if sudo("mkdir -p /var/www/shared/%s_%s_data" % (repo, buildtype)).failed: 
25: if sudo("mkdir -p /var/www/shared/%s_%s_uploads" % (repo, buildtype)).failed: 
Symfony.py (62 matches)
30: if sudo("/home/jenkins/symfony_backup_db.sh -d /var/www/live.%s.%s -r %s -b %s -n %s" % (repo, buildtype, repo, buildtype, build)).failed: 
48: if run("find /var/www/%s_%s_%s/composer.json" % (repo, buildtype, build)).return_code == 0: 
49: symfony_version = run("grep 'symfony/symfony' /var/www/%s_%s_%s/composer.json | awk '{print $2}' | cut -d '.' -f 1 | cut -d '\"' -f 2" % (repo, buildtype, build)) 
70: if run("ln -s /var/www/shared/%s_%s_logs /var/www/%s_%s_%s/app/logs" % (repo, buildtype, repo, buildtype, build)).failed: 
72: if run("ln -s /var/www/shared/%s_%s_sessions /var/www/%s_%s_%s/app/sessions" % (repo, buildtype, repo, buildtype, build)).failed: 
74: if run("mkdir /var/www/%s_%s_%s/app/cache" % (repo, buildtype, build)).failed: 
76: if sudo("chown -R www-data:jenkins /var/www/%s_%s_%s/app/cache" % (repo, buildtype, build)).failed: 
78: if sudo("chmod -R g+w /var/www/%s_%s_%s/app/cache" % (repo, buildtype, build)).failed: 
80: print "===> Dealing with data directories - should be /var/www/shared/%s_%s_data" % (repo, buildtype) 
81: if(exists("/var/www/shared/%s_%s_data" % (repo, buildtype))): 
83: if(not exists("/var/www/%s_%s_%s/data" % (repo, buildtype, build))): 
84: if sudo ("ln -s /var/www/shared/%s_%s_data /var/www/%s_%s_%s/data" % (repo, buildtype, repo, buildtype, build)).failed: 
88: print "===> Dealing with uploads directories - should be /var/www/shared/%s_%s_uploads" % (repo, buildtype) 
89: if(exists("/var/www/shared/%s_%s_uploads" % (repo, buildtype))): 
91: if(not exists("/var/www/%s_%s_%s/web/uploads" % (repo, buildtype, build))): 
92: if sudo ("ln -s /var/www/shared/%s_%s_uploads /var/www/%s_%s_%s/web/uploads" % (repo, buildtype, repo, buildtype, build)).failed: 
100: sudo("rm -r /var/www/%s_%s_%s/var/cache" % (repo, buildtype, build)) 
101: sudo("rm -r /var/www/%s_%s_%s/var/logs" % (repo, buildtype, build)) 
102: sudo("rm -r /var/www/%s_%s_%s/var/sessions" % (repo, buildtype, build)) 
104: if run("mkdir /var/www/%s_%s_%s/app/cache" % (repo, buildtype, build)).failed: 
106: if sudo("chown -R www-data:jenkins /var/www/%s_%s_%s/app/cache" % (repo, buildtype, build)).failed: 
108: if sudo("chmod -R g+w /var/www/%s_%s_%s/app/cache" % (repo, buildtype, build)).failed: 
121: if run("ln -s /var/www/%s_%s_%s/app/cache /var/www/%s_%s_%s/var/cache" % (repo, buildtype, build, repo, buildtype, build)).failed: 
124: if run("ln -s /var/www/shared/%s_%s_logs /var/www/%s_%s_%s/var/logs" % (repo, buildtype, repo, buildtype, build)).failed: 
127: if run("ln -s /var/www/shared/%s_%s_sessions /var/www/%s_%s_%s/var/sessions" % (repo, buildtype, repo, buildtype, build)).failed: 
130: if run("ln -s /var/www/shared/%s_%s_uploads /var/www/%s_%s_%s/web/uploads" % (repo, buildtype, repo, buildtype, build)).failed: 
139: print "===> Symlinking in ckfinder files directory, /var/www/shared/%s_%s_userfiles, to web/userfiles" % (repo, buildtype) 
140: sudo("ln -s /var/www/shared/%s_%s_userfiles /var/www/%s_%s_%s/web/userfiles" % (repo, buildtype, repo, buildtype, build)) 
147: if run("cd /var/www/%s_%s_%s; php %s/console --env=%s ckfinder:download" % (repo, buildtype, build, console_location, console_buildtype)).failed: 
149: if run("cd /var/www/%s_%s_%s; php %s/console --env=%s assets:install" % (repo, buildtype, build, console_location, console_buildtype)).failed: 
159: if run("find /var/www/%s_%s_%s/web/app_%s.php" % (repo, buildtype, build, console_buildtype)).return_code == 0: 
161: sudo("rm /var/www/%s_%s_%s/web/app.php" % (repo, buildtype, build)) 
162: sudo("mv /var/www/%s_%s_%s/web/app_%s.php /var/www/%s_%s_%s/web/app.php" % (repo, buildtype, build, console_buildtype, repo, buildtype, build)) 
166: if run("stat /var/www/%s_%s_%s/web/app.php" % (repo, buildtype, build)).failed: 
175: if run("cd /var/www/%s_%s_%s; SYMFONY_ENV=%s composer install --no-dev --no-interaction" % (repo, buildtype, build, console_buildtype)).failed: 
180: if run("cd /var/www/%s_%s_%s; SYMFONY_ENV=%s composer install --no-interaction" % (repo, buildtype, build, console_buildtype)).failed: 
192: if run("cd /var/www/%s_%s_%s; php %s/console --env=%s doctrine:migrations:status" % (repo, buildtype, build, console_location, console_buildtype)).failed: 
196: migrations = run("cd /var/www/%s_%s_%s; php %s/console --env=%s doctrine:migrations:status | grep \"New Migrations\" | awk '{print $4}'" % (repo, buildtype, build, console_location, console_buildtype)) 
202: if run("cd /var/www/%s_%s_%s; php %s/console --env=%s doctrine:migrations:migrate --quiet" % (repo, buildtype, build, console_location, console_buildtype)).failed: 
212: with cd("/var/www/%s_%s_%s" % (repo, buildtype, build)): 
225: if sudo("chown -R www-data:jenkins /var/www/%s_%s_%s/app/cache" % (repo, buildtype, build)).failed: 
229: sudo("find /var/www/%s_%s_%s/app/cache -type d -print0 | xargs -r -0 chmod 775" % (repo, buildtype, build)) 
230: sudo("find /var/www/%s_%s_%s/app/cache -type f -print0 | xargs -r -0 chmod 664" % (repo, buildtype, build)) 
231: if sudo("chown -R www-data:jenkins /var/www/shared/%s_%s_logs" % (repo, buildtype)).failed: 
235: sudo("find /var/www/shared/%s_%s_logs -type d -print0 | xargs -r -0 chmod 775" % (repo, buildtype)) 
236: sudo("find /var/www/shared/%s_%s_logs -type f -print0 | xargs -r -0 chmod 664" % (repo, buildtype)) 
237: if sudo("chown -R www-data:jenkins /var/www/shared/%s_%s_sessions" % (repo, buildtype)).failed: 
241: sudo("find /var/www/shared/%s_%s_sessions -type d -print0 | xargs -r -0 chmod 770" % (repo, buildtype)) 
242: sudo("find /var/www/shared/%s_%s_sessions -type f -print0 | xargs -r -0 chmod 660" % (repo, buildtype)) 
243: if sudo("chown -R www-data:jenkins /var/www/shared/%s_%s_uploads" % (repo, buildtype)).failed: 
247: sudo("find /var/www/shared/%s_%s_uploads -type d -print0 | xargs -r -0 chmod 775" % (repo, buildtype)) 
248: sudo("find /var/www/shared/%s_%s_uploads -type f -print0 | xargs -r -0 chmod 664" % (repo, buildtype)) 
util
common
vhosts
apache2
dummy.conf.erb (2 matches)
3: DocumentRoot /var/www/live.dummy/www/ 
8: <Directory /var/www/live.dummy/www/> 
nginx
dummy_feature_branch_ssl.conf.erb
dummy_feature_branch.conf.erb
dummy_http_protected.conf.erb
dummy_http.conf.erb
dummy_protected.conf.erb (2 matches)
dummy.conf.erb (2 matches)
wp-dummy_protected.conf.erb (2 matches)
wp-dummy.conf.erb (2 matches)
drush_alias.sh
15: 'root' => '/var/www/live.${SHORTNAME}.${BRANCH}/www', 
remove_old_builds.sh
15: -d   The path to the www root (usually /var/www) 
wordpress
common
AdjustConfiguration.py (48 matches)
9: # 1. Check if a 'shared' wp-config.inc file exists in /var/www/shared yet 
11: # 3. If the wp-config.php.$branch existed, move it to /var/www/shared, effectively making it the 'shared' wp-config.inc file. Symlink this so that it maps to 'wp-config.php' for now, as there was nothing else 
13: # 5. If the wp-config.php existed, move it to /var/www/shared, effectively making it the 'shared' wp-config.inc file. Symlink this so that it maps to 'wp-config.php' for now, as there was nothing else 
21: if run("stat /var/www/config/%s_%s.wp-config.inc" % (repo, branch)).failed: 
23: print "The shared settings file /var/www/config/%s_%s.wp-config.inc was not found. We'll try and move your branch-specific wp-config.php there if it exists" % (repo, branch) 
24: if run("stat /var/www/%s_%s_%s/www/wp-config.php.%s" % (repo, branch, build, branch)).failed: 
26: print "We couldn't find a branch-specific wp-config.php file in /var/www/%s_%s_%s/www/wp-config.php.%s! We'll try one more time with a generic wp-config.php" % (repo, branch, build, branch) 
27: if run("stat /var/www/%s_%s_%s/www/wp-config.php" % (repo, branch, build)).failed: 
29: raise SystemExit("Could not find any wp-config.php whatsoever! It's unlikely we can bootstrap such a site. Aborting early. Tip: Add /var/www/config/%s_%s.wp-config.inc containing DB credentials, and make a simple /var/www/%s_%s_%s/www/wp-config.php that does an 'include' of this file." % (repo, branch, repo, branch, build)) 
32: sudo("mv /var/www/%s_%s_%s/www/wp-config.php /var/www/config/%s_%s.wp-config.inc" % (repo, branch, build, repo, branch)) 
33: sudo("chown jenkins:www-data /var/www/config/%s_%s.wp-config.inc" % (repo, branch)) 
34: sudo("chmod 644 /var/www/config/%s_%s.wp-config.inc" % (repo, branch)) 
35: run("ln -s /var/www/config/%s_%s.wp-config.inc /var/www/%s_%s_%s/www/wp-config.php" % (repo, branch, repo, branch, build)) 
36: print "Tip: modify your /var/www/%s_%s_%s/www/wp-config.php so that it does a PHP include of /var/www/config/%s_%s.wp-config.inc, as that's where credentials are" % (repo, branch, build, repo, branch) 
40: print "Moving /var/www/%s_%s_%s/www/wp-config.php.%s to /var/www/config/%s_%s.wp-config.inc" % (repo, branch, build, branch, repo, branch) 
41: sudo("mv /var/www/%s_%s_%s/www/wp-config.php.%s /var/www/config/%s_%s.wp-config.inc" % (repo, branch, build, branch, repo, branch)) 
42: sudo("chown jenkins:www-data /var/www/config/%s_%s.wp-config.inc" % (repo, branch)) 
43: sudo("chmod 644 /var/www/config/%s_%s.wp-config.inc" % (repo, branch)) 
44: run("ln -s /var/www/config/%s_%s.wp-config.inc /var/www/%s_%s_%s/www/wp-config.php" % (repo, branch, repo, branch, build)) 
45: print "Tip: make a simple /var/www/%s_%s_%s/www/wp-config.php that does a PHP include of /var/www/config/%s_%s.wp-config.inc, as that's where credentials are" % (repo, branch, build, repo, branch) 
48: print "We found the /var/www/config/%s_%s.wp-config.inc file, we'll symlink it if you have no wp-config.php file in the site root, or else do nothing" % (repo, branch) 
49: if run("stat /var/www/%s_%s_%s/www/wp-config.php" % (repo, branch, build)).failed: 
51: run("ln -s /var/www/config/%s_%s.wp-config.inc /var/www/%s_%s_%s/www/wp-config.php" % (repo, branch, repo, branch, build)) 
52: print "Tip: make a simple /var/www/%s_%s_%s/www/wp-config.php that does a PHP include of /var/www/config/%s_%s.wp-config.inc, as that's where credentials are" % (repo, branch, build, repo, branch)  
59: sudo("ln -s /var/www/shared/%s_%s_uploads/ /var/www/%s_%s_%s/www/wp-content/uploads" % (repo, branch, repo, branch, build)) 
63: if run("stat /var/www/%s_%s_%s/www/wp-content/%s" % (repo, branch, build, dirname)).return_code == 0: 
64: sudo("mkdir -p /var/www/shared/%s_%s_%s" % (repo, branch, dirname)) 
65: sudo("chown www-data:www-data /var/www/shared/%s_%s_%s" % (repo, branch, dirname)) 
66: sudo("rm -rf /var/www/%s_%s_%s/www/wp-content/%s" % (repo, branch, build, dirname)) 
67: run("ln -s /var/www/shared/%s_%s_%s /var/www/%s_%s_%s/www/wp-content/%s" % (repo, branch, dirname, repo, branch, build, dirname)) 
70: if run("stat /var/www/%s_%s_%s/www/wp-content/plugins/w3-total-cache/wp-content/advanced-cache.php" % (repo, branch, build)).failed: 
73: run("cp /var/www/%s_%s_%s/www/wp-content/plugins/w3-total-cache/wp-content/advanced-cache.php /var/www/%s_%s_%s/www/wp-content/advanced-cache.php" % (repo, branch, build, repo, branch, build)) 
75: if run("stat /var/www/%s_%s_%s/www/wp-content/plugins/w3-total-cache/wp-content/object-cache.php" % (repo, branch, build)).failed: 
78: run("cp /var/www/%s_%s_%s/www/wp-content/plugins/w3-total-cache/wp-content/object-cache.php /var/www/%s_%s_%s/www/wp-content/object-cache.php" % (repo, branch, build, repo, branch, build)) 
fabfile.py (2 matches)
71: if exists('/var/www/live.%s.%s' % (repo, branch)): 
124: print "####### BUILD COMPLETE. If you need to revert this build, run the following command: sudo /home/jenkins/revert -b %s -d %s -s /var/www/live.%s.%s -a %s_%s" % (previous_build, previous_db, repo, branch, repo, branch) 
InitialBuild.py (18 matches)
16: sudo("ln -s /var/www/%s_%s_%s /var/www/live.%s.%s" % (repo, branch, build, repo, branch)) 
19: sudo("mkdir -p /var/www/shared/%s_%s_uploads" % (repo, branch)) 
20: sudo("chown www-data:staff /var/www/shared/%s_%s_uploads" % (repo, branch)) 
21: sudo("ln -s /var/www/shared/%s_%s_uploads /var/www/%s_%s_%s/www/wp-content/uploads" % (repo, branch, repo, branch, build)) 
31: if run("find /var/www/%s_%s_%s -maxdepth 1 -type d -name db | egrep '.*'" % (repo, branch, build)).return_code == 0: 
35: sudo("bunzip2 /var/www/%s_%s_%s/db/*.sql.bz2" % (repo, branch, build)) 
43: sudo("/home/jenkins/mysqlprepare_wp.sh %s %s /var/www/live.%s.%s %s $(find /var/www/%s_%s_%s/db -type f -name *.sql)" % (repo, newpass, repo, branch, branch, repo, branch, build)) 
45: sitedir = "/var/www/%s_%s_%s/www" % (repo, branch, build) 
79: print "===> Moving wp-config.php to shared area /var/www/shared/%s_%s.wp-config.inc. Do an 'include' of this in your main wp-config.php, or else it will be symlinked directly as wp-config.php" % (repo, branch) 
80: sudo("mv /var/www/live.%s.%s/www/wp-config.php /var/www/shared/%s_%s.wp-config.inc; ln -s /var/www/shared/%s_%s.wp-config.inc /var/www/live.%s.%s/www/wp-config.php" % (repo, branch, repo, branch, repo, branch, repo, branch)) 
81: sudo("chown jenkins:www-data /var/www/shared/%s_%s.wp-config.inc" % (repo, branch)) 
82: sudo("chmod 644 /var/www/shared/%s_%s.wp-config.inc" % (repo, branch)) 
Revert.py
9: run("if [ -f ~jenkins/dbbackups/%s_%s_prior_to_%s.sql.gz ]; then zcat ~jenkins/dbbackups/%s_%s_prior_to_%s.sql.gz | wp --allow-root --path=/var/www/%s_%s_%s/www db cli; fi" % (repo, branch, build, repo, branch, build, repo, branch, build)) 
WordPress.py (8 matches)
35: with cd("/var/www/%s_%s_%s/www" % (repo, branch, build)): 
52: if sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www && wp --allow-root core update-db'" % (repo, branch, build)).failed: 
57: sudo("su -s /bin/bash www-data -c 'cd /var/www/%s_%s_%s/www && wp --allow-root cache flush'" % (repo, branch, build)) 
69: #  _sshagent_run("cd /var/www/%s_%s_%s && git branch -f dbbackups && git push origin dbbackups" % (repo, branch, build)) 
71: #  _sshagent_run("cd /var/www/%s_%s_%s && git pull origin dbbackups" % (repo, branch, build)) 
72: #  run("drush @%s_%s sql-dump | bzip2 -f > /var/www/%s_%s_%s/db/%s.%s.sql.bz2" % (repo, branch, repo, branch, build, repo, branch)) 
73: #  with cd("/var/www/live.%s.%s" % (repo, branch)): 
77: #  _sshagent_run("cd /var/www/live.%s.%s && git push origin dbbackups" % (repo, branch)) 

@mf-lit
Copy link
Contributor Author

mf-lit commented Feb 12, 2018

I haven't done a lot of testing, but it looks like the latest updates (i.e. the one where lots of shell scripts were deprecated) has effectively solved this issue for us.

I suppose having /var/www hardcoded is still something that should be fixed, but it's a lot less urgent now from our point of view.

@gregharvey
Copy link
Member

Thanks for the update, Marc. I'd still like to fix this, indeed. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants