diff options
author | talyz <kim.lindberger@gmail.com> | 2019-10-01 15:38:22 +0200 |
---|---|---|
committer | talyz <kim.lindberger@gmail.com> | 2019-10-04 18:03:05 +0200 |
commit | f3eb063ecfb0cb76e2cef1e9c9764cdee92f9ed7 (patch) | |
tree | a5c45717b28d10b7ba8019519a9d322bce8d02bb /pkgs/applications/version-management/gitlab/update.py | |
parent | e5b783bd225121e09bf038b859c7bae946448d80 (diff) | |
download | nixpkgs-f3eb063ecfb0cb76e2cef1e9c9764cdee92f9ed7.tar nixpkgs-f3eb063ecfb0cb76e2cef1e9c9764cdee92f9ed7.tar.gz nixpkgs-f3eb063ecfb0cb76e2cef1e9c9764cdee92f9ed7.tar.bz2 nixpkgs-f3eb063ecfb0cb76e2cef1e9c9764cdee92f9ed7.tar.lz nixpkgs-f3eb063ecfb0cb76e2cef1e9c9764cdee92f9ed7.tar.xz nixpkgs-f3eb063ecfb0cb76e2cef1e9c9764cdee92f9ed7.tar.zst nixpkgs-f3eb063ecfb0cb76e2cef1e9c9764cdee92f9ed7.zip |
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
Diffstat (limited to 'pkgs/applications/version-management/gitlab/update.py')
-rwxr-xr-x | pkgs/applications/version-management/gitlab/update.py | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/pkgs/applications/version-management/gitlab/update.py b/pkgs/applications/version-management/gitlab/update.py index 650bd73aa84..a14ef572b17 100755 --- a/pkgs/applications/version-management/gitlab/update.py +++ b/pkgs/applications/version-management/gitlab/update.py @@ -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 |