jenkins-bot has submitted this change and it was merged. Change subject: Checkout revs to repo-cache, link to repo ......................................................................
Checkout revs to repo-cache, link to repo Rollback added the directories cache, revs, and current under the repo directory. Current Codebase Example: git_deploy_dir: /srv/deployment git_repo: mockbase/deploy creates: /srv/deployment/mockbase/deploy/{cache,revs,current} This breaks backwards compatibility with trebuchet. This patch puts caches, revs, and current under [git_deploy_dir]/[git_repo]-cache. Given the same git_deploy_dir and git_repo as above: creates: /srv/deployment/mockbase/deploy-cache/{cache,revs,current} Then, as a final step in the `promote` phase, it symlinks [repo]-cache/current to [repo]: /srv/deployment/mockbase/deploy -> /srv/deployment/mockbase/deploy-cache/current Also preserves any old checkout that may be at [git_repo] to [git_repo].trebuchet. This keeps rollback and backwards compatibility with trebuchet. Bug: T113107 Change-Id: I58ed5c3b057cc3c012e9d1bb202251c3ab958ef6 --- M scap/main.py 1 file changed, 17 insertions(+), 1 deletion(-) Approvals: Dduvall: Looks good to me, approved 20after4: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/scap/main.py b/scap/main.py index 627ccf0..605b7f4 100644 --- a/scap/main.py +++ b/scap/main.py @@ -594,9 +594,12 @@ def main(self, *extra_args): self.rev = self.config['git_rev'] - root_deploy_dir = os.path.normpath("{0}/{1}".format( + self.root_dir = os.path.normpath("{0}/{1}".format( self.config['git_deploy_dir'], self.config['git_repo'])) + # cache, revs, and current directory go under [repo]-cache and are + # linked to [repo] as a final step + root_deploy_dir = '{}-cache'.format(self.root_dir) deploy_dir = lambda subdir: os.path.join(root_deploy_dir, subdir) self.cache_dir = deploy_dir('cache') @@ -661,6 +664,7 @@ service = self.config.get('service_name', None) self._link_rev_dir(self.cur_link) + self._link_final_to_current() if service is not None: tasks.restart_service(service, user=self.config['git_repo_user']) @@ -721,6 +725,18 @@ self.promote() self._remove_progress_link() + def _link_final_to_current(self): + """Link the current checkout to final location at [repo] + + This should really only be needed the first time that scap03 is + run. It links the [repo]-cache/current directory to [repo]. + """ + if (not os.path.islink(self.root_dir) and + (os.path.isfile(self.root_dir) or os.path.isdir(self.root_dir))): + os.rename(self.root_dir, '{}.trebuchet'.format(self.root_dir)) + + tasks.move_symlink(self.cur_link, self.root_dir, user=self.user) + def _link_rev_dir(self, symlink_path): tasks.move_symlink(self.rev_dir, symlink_path, user=self.user) -- To view, visit https://gerrit.wikimedia.org/r/241684 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I58ed5c3b057cc3c012e9d1bb202251c3ab958ef6 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/tools/scap Gerrit-Branch: master Gerrit-Owner: Thcipriani <tcipri...@wikimedia.org> Gerrit-Reviewer: 20after4 <mmod...@wikimedia.org> Gerrit-Reviewer: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Dduvall <dduv...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits