zulip/scripts/lib
Alex Vandiver 30457ecd02 upgrade-zulip-from-git: Stop mirroring the remote.
The local `/srv/zulip.git` directory has been cloned with `--mirror`
since it was first created as a local cache in dc4b89fb08.  This
made some sense at the time, since it was purely a cache of the
remote, and not a home to local branches of its own.

That changed in 3f83b843c2, when we began using `git worktree`,
which caused the `deployment-...` branches to begin being stored in
`/src/zulip.git`.  This caused intermixing of local and remote
branches.

When 02582c6956 landed, the addition of `--prune` caused all but the
most recent deployment branch to be deleted upon every fetch --
leaving previous deployments with non-existent branches checked out:

```
zulip@example-prod-host:~/deployments/last$ git status
On branch deployment-2022-04-15-23-07-55

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
	new file:   .browserslistrc
	new file:   .codecov.yml
	new file:   .codespellignore
	new file:   .editorconfig
[...snip list of every file in repo...]
```

Switch `/srv/zulip.git` to no longer be a `--mirror` cache of the
origin.  We reconfigure the remote to drop `remote.origin.mirror`, and
delete all refs under `refs/pulls/` and `refs/heads/`, while
preserving any checked-out branches.  `refs/pulls/`, if the remote is
the canonical upstream, contains _tens of thousands_ of refs, so
pruning those refs trims off 20% of the repository size.

Those savings require a `git gc --prune=now`, otherwise the dangling
objects are ejected from the packfiles, which would balloon the
repository up to more than three times its previous size.  Repacking
the repository is reasonable, in general, after removing such a large
number of refs -- and the `--prune=now` is safe and will not lose
data, as the `--mirror` was good at ensuring that the repository could
not be used for any local state.

The refname in the upgrade process was previously resolved from the
union of local and remote refs, since they were in the same namespace.
We instead now only resolve arguments as tags, then origin branches;
this means that stale local branches will be skipped.  Users who want
to deploy from local branches can use `--remote-url=.`.

Because the `scripts/lib/upgrade-zulip-from-git` file is "stage 1" and
run from the old version's code, this will take two invocations of
`upgrade-zulip-from-git` to take effect.

Fixes #21901.
2022-06-01 16:06:15 -07:00
..
__init__.py Factor out venv-creating code from provision.py. 2016-06-21 11:25:41 -07:00
build-pgroonga build-pgroonga: Update PGroonga to 2.3.6. 2022-04-29 16:02:45 -07:00
build-wal-g puppet: Build wal-g from source for aarch64. 2022-03-22 15:02:35 -07:00
check_rabbitmq_queue.py python: Replace universal_newlines with text. 2022-01-23 22:16:01 -08:00
check-database-compatibility.py check-database-compatibility: Sort and prettify output. 2022-04-06 14:10:46 -07:00
clean_emoji_cache.py python: Reformat with Black, except quotes. 2021-02-12 13:11:19 -08:00
clean_node_cache.py python: Reformat with Black, except quotes. 2021-02-12 13:11:19 -08:00
clean_unused_caches.py clean_unused_caches: Allow the main function to accept Namespace args. 2021-06-12 07:28:16 -07:00
clean_venv_cache.py requirements: Remove Thumbor. 2021-05-06 20:07:32 -07:00
clean_yarn_cache.py zulip_tools: Rename may_be_perform_purging to maybe_perform_purging. 2022-01-12 13:21:35 -08:00
create-production-venv python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
email-mirror-postfix python: Remove default "utf8" argument for encode(), decode(). 2021-08-02 15:53:52 -07:00
fix-standalone-certbot puppet: Fix standalone certbot configurations. 2022-01-24 12:13:44 -08:00
hash_reqs.py python: Convert last type comments to annotations. 2022-03-24 20:32:39 -07:00
install Revert "apt-repos: Downgrade PostgreSQL to dodge PGroonga regression." 2022-05-17 15:07:37 -07:00
install-node install-node: Upgrade Node.js from 16.14.0 to 16.14.1. 2022-03-17 15:24:46 -07:00
install-yarn install-yarn: Use test -ef in case /srv is a symlink. 2021-12-30 13:42:07 -08:00
node_cache.py node_cache: Remove node_modules/.cache when copying. 2022-05-04 09:56:07 -07:00
puppet_cache.py python: Replace universal_newlines with text. 2022-01-23 22:16:01 -08:00
pythonrc.py actions: Delete zerver.lib.actions. 2022-04-14 17:14:38 -07:00
queue_workers.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
ruby3hack.rb zulip-puppet-apply: Work around broken Puppet on Ubuntu 22.04. 2022-05-03 09:41:08 -07:00
setup_path.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
setup_venv.py python: Convert last type comments to annotations. 2022-03-24 20:32:39 -07:00
setup-apt-repo setup-apt-repo: Make hashes file not contain full path. 2022-03-12 17:24:19 -08:00
setup-yum-repo provision: Add support for Fedora 34. 2021-07-20 12:10:41 -07:00
sharding.py python: Replace universal_newlines with text. 2022-01-23 22:16:01 -08:00
supervisor.py supervisor: 'foo:*' also matches 'foo'. 2022-03-31 10:41:41 -07:00
unpack-zulip python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
upgrade-zulip python: Replace universal_newlines with text. 2022-01-23 22:16:01 -08:00
upgrade-zulip-from-git upgrade-zulip-from-git: Stop mirroring the remote. 2022-06-01 16:06:15 -07:00
upgrade-zulip-stage-2 upgrade: Add --skip-restart which preps but does not restart. 2022-05-22 15:07:37 -07:00
warn-rabbitmq-nodename-change puppet: Always set the RabbitMQ nodename to zulip@localhost. 2022-01-25 01:48:02 +00:00
zulip_tools.py log-search: Add a tool to search nginx logs by IP/hostname. 2022-05-03 13:44:29 -07:00