gitlab: 12.1.6 -> 12.3.4

- Update GitLab to 12.3.4

- Update update.py to cope with the new upstream repository structure

- Refactor gitlab-shell to use buildGoPackage and bundlerEnv for
  dependencies

- Refactor gitlab-workhorse to use buildGoPackage for dependencies

- Make update.py able to update gitlab-shell and gitlab-workhorse
  dependencies

- Various fixes necessary for update to work
This commit is contained in:
talyz
2019-10-01 15:38:22 +02:00
parent e5b783bd22
commit f3eb063ecf
22 changed files with 3303 additions and 788 deletions

View File

@@ -55,8 +55,8 @@ class GitLabRepo:
:param arch: amd64
:return: url of the debian package
"""
if self.owner != "gitlab-org" or self.repo not in ['gitlab-ce', 'gitlab-ee']:
raise Exception(f"don't know how to get deb_url for {self.url}")
if flavour not in ['ce', 'ee']:
raise Exception(f"don't know how to get deb_url for flavour {flavour}")
return f"https://packages.gitlab.com/gitlab/gitlab-{flavour}/packages" + \
f"/debian/stretch/gitlab-{flavour}_{version}-{flavour}.0_{arch}.deb/download.deb"
@@ -106,7 +106,10 @@ def _flavour2gitlabrepo(flavour: str):
raise Exception(f"unknown gitlab flavour: {flavour}, needs to be ce or ee")
owner = 'gitlab-org'
repo = 'gitlab-' + flavour
if flavour == 'ce':
repo = 'gitlab-foss'
else:
repo = 'gitlab'
return GitLabRepo(owner, repo)
@@ -209,12 +212,8 @@ def update_gitaly():
for fn in ['go.mod', 'go.sum']:
os.unlink(gitaly_dir / fn)
# currently broken, as `gitaly.meta.position` returns
# pkgs/development/go-modules/generic/default.nix
# so update-source-version doesn't know where to update hashes
# _call_update_source_version('gitaly', gitaly_server_version)
gitaly_hash = r.get_git_hash(f"v{gitaly_server_version}")
click.echo(f"Please update gitaly/default.nix to version {gitaly_server_version} and hash {gitaly_hash}")
_call_update_source_version('gitaly', gitaly_server_version)
@cli.command('update-gitlab-shell')
@@ -224,14 +223,42 @@ def update_gitlab_shell():
gitlab_shell_version = data['ce']['passthru']['GITLAB_SHELL_VERSION']
_call_update_source_version('gitlab-shell', gitlab_shell_version)
r = GitLabRepo('gitlab-org', 'gitlab-shell')
gitlab_shell_dir = pathlib.Path(__file__).parent / 'gitlab-shell'
for fn in ['Gemfile.lock', 'Gemfile']:
with open(gitlab_shell_dir / fn, 'w') as f:
f.write(r.get_file(fn, f"v{gitlab_shell_version}"))
for fn in ['go.mod', 'go.sum']:
with open(gitlab_shell_dir / fn, 'w') as f:
f.write(r.get_file(f"go/{fn}", f"v{gitlab_shell_version}"))
subprocess.check_output(['bundix'], cwd=gitlab_shell_dir)
subprocess.check_output(['vgo2nix'], cwd=gitlab_shell_dir)
for fn in ['go.mod', 'go.sum']:
os.unlink(gitlab_shell_dir / fn)
@cli.command('update-gitlab-workhorse')
def update_gitlab_workhorse():
"""Update gitlab-shell"""
"""Update gitlab-workhorse"""
data = _get_data_json()
gitlab_workhorse_version = data['ce']['passthru']['GITLAB_WORKHORSE_VERSION']
_call_update_source_version('gitlab-workhorse', gitlab_workhorse_version)
r = GitLabRepo('gitlab-org', 'gitlab-workhorse')
gitlab_workhorse_dir = pathlib.Path(__file__).parent / 'gitlab-workhorse'
for fn in ['go.mod', 'go.sum']:
with open(gitlab_workhorse_dir / fn, 'w') as f:
f.write(r.get_file(fn, f"v{gitlab_workhorse_version}"))
subprocess.check_output(['vgo2nix'], cwd=gitlab_workhorse_dir)
for fn in ['go.mod', 'go.sum']:
os.unlink(gitlab_workhorse_dir / fn)
@cli.command('update-all')
@click.pass_context