Commit Graph

126 Commits

Author SHA1 Message Date
Anders Kaseorg b3260bd610 docs: Use Debian and Ubuntu version numbers over development codenames.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-23 12:04:24 -08:00
Anders Kaseorg b0ce4f1bce docs: Fix many spelling mistakes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-07 18:51:06 -08:00
Alex Vandiver 2fc156e556 ci: Cache with the OS name, not the job name.
The job name is just the constant `production_build`.  Renaming it to
have the OS in the key ensures that it is not shared across OS'es (for
instance between `4.x` and `main`, which are now bionic and buster,
respectively), and also allows it to share caches with the install
step, which uses the OS name in that place.
2022-01-24 14:29:49 -08:00
Anders Kaseorg a58a71ef43 Remove Ubuntu 18.04 support.
As a consequence:

• Bump minimum supported Python version to 3.7.
• Move Vagrant environment to Debian 10, which has Python 3.7.
• Move CI frontend tests to Debian 10.
• Move production build test to Debian 10.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-01-21 17:26:14 -08:00
Anders Kaseorg d035efd467 ci: Test upgrade-postgresql on Ubuntu 20.04.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-01-21 17:26:14 -08:00
Alex Vandiver 71b56f7c1c puppet: process_fts_updates connects as nagios (or provided username).
It should not use the configured zulip username, but should instead
pull from the login user (likely `nagios`), or an explicit alternate
provided PostgreSQL username.  Failure to do so results in Nagios
failures because the `nagios` login does not have permissions to
authenticated the `zulip` PostgreSQL user.

This requires CI changes, as the install tests install as the `zulip`
login username, which allowed Nagios tests to pass previously; with
the custom database and username, however, they must be passed to
process_fts_updates explicitly when validating the install.
2021-12-14 14:48:53 -08:00
Alex Vandiver a751d3a6ff ci: Refactor --test-custom-db to be an argument, not a command. 2021-12-14 14:48:53 -08:00
Alex Vandiver 0ae375e0f9 ci: Test upgrades from the latest minor release. 2021-11-25 08:00:34 -08:00
Alex Vandiver 4f1f8d8f6e ci: Remove an unnecessary and incorrect is_focal tag. 2021-11-25 08:00:34 -08:00
Alex Vandiver 73055255bb ci: Test pgroonga installation. 2021-11-20 07:13:50 -08:00
Alex Vandiver c9ebccdf70 ci: Update outdated comments to generated Dockerfiles.
These were missed in the doc updates in d78723b6e8, which were for
behavior changes in 16067bc4fc.
2021-11-05 15:45:46 -07:00
rht a3a71487b0 CI: Add Codespell linter.
This tool helps catch common typos in code and documentation, which is
particularly useful for our many contributors who are not native
English speakers.

The config is based on the codespell that I ran in
https://github.com/zulip/zulip/pull/18535.
2021-10-27 16:49:30 -07:00
Alex Vandiver a1d22cc7fa ci: Run production tests when files mentioning zilencer are changed.
Production installs do not use the zilencer application, but the tests
do include it; as such, changes to any files which reference zilencer
are more likely to pass tests but fail production installs.

Run production tests when those files are changed.
2021-10-20 16:53:11 -07:00
Anders Kaseorg 9cf5a03f2a ci: Migrate to new Codecov uploader.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-10-14 17:56:52 -07:00
Anders Kaseorg a88ace988a ci: Remove /__w permission twiddling.
Commit 9f2ac49fb3 (#19963) should make
this unnecessary.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-10-14 13:24:30 -07:00
Alex Vandiver acbe7ae7a8 github: Ignore CodeQL analysis in private repos.
CodeQL only runs in public repos; private forks will otherwise error
their CI runs.
2021-09-30 18:07:20 -07:00
Anders Kaseorg e96abc3c5a ci: Remove legacy-os test.
As of yesterday, the GitHub Actions ubuntu-16.04 environment has been
removed.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-09-22 13:58:46 -07:00
Ganesh Pawar dee20f0dbf node_tests: Run node tests in parallel.
Fixes #9471.
2021-09-10 14:18:31 -07:00
Anders Kaseorg a9501772c1 ci: Do not run CodeQL on Dependabot push events.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-04 02:34:21 -07:00
Anders Kaseorg d464b3c805 ci: Run CodeQL on merge commit.
As per https://github.com/github/codeql-action/pull/297.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-08-03 13:51:18 -07:00
Tim Abbott aa651f75c1 ci: Adjust when production suite is run.
We make a few adjustments:
* We now run full CI whenever pushing to master. It's cheap enough
  that it's worth getting accurate signal.
* We now don't run production tests on PRs for changes to JavaScript/CSS
  in static/ that don't also affect the webpack configuration.
* We sort the list of paths that trigger tests.
2021-07-30 15:32:23 -07:00
Alex Vandiver 2daad58afa ci: Use an init process to reap defunct processes.
When Github Actions run in Docker, the default pid 1 entrypoint is
`tail -f /dev/null`.  PID 1 is responsible for propagating signals to
its children, and calling `waitpid()` on defunct processes; `tail`
does not do these things.  This results in zombie processes piling up
inside the container, which is not an issue in most contexts.

However, it affects `start-stop-daemon`, which hangs when stopping
daemon processes, as they are never reaped.  This appears in CI as
`/etc/init.d/supervisor restart` never being able to succeed.

Run the docker container with `--init`, which spawns a
`/sbin/docker-init` PID 1 to handle the job of an init process.
2021-07-22 14:09:01 -07:00
Alex Vandiver d78723b6e8 ci: Update outdated comments, documentation and gitignore.
Use of `Dockerfile.template` and generated `tools/ci/images/` was
removed in 16067bc4fc.
2021-07-22 14:09:01 -07:00
Anders Kaseorg 47897c76a2 scripts: Use curl -f (--fail).
This makes curl exit with nonzero status on HTTP 4xx/5xx errors.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-13 16:47:49 -07:00
Gaurav Pandey 9282956f19 upgrade-check: Add create cache directory step.
Create cache directories for the upgrade check
in the production-suite.
2021-07-05 09:55:38 -07:00
Gaurav Pandey e648ad3477 ci: Add prod upgrade step to prod suite.
This adds a check in the current production suite of
CI that upgrades a previous release of zulip server
with a newer one.

Fixes #18346.
2021-06-21 10:15:24 -07:00
Priyank Patel 05510a8c04 github-actions: Upgrade styfle/cancel-workflow-action. 2021-06-20 16:53:45 -07:00
Priyank Patel 607110ca33 github-actions: Ensure cancel previous run job never fails. 2021-06-20 16:53:45 -07:00
Riken Shah 4f54e15993 refactor: Convert `clean-unused-caches` to`clean_unused_caches.py`.
We convert the `clean-unused-caches` script to a
python file so we can run it in provision by importing it
instead of running the script, hence saving some time.
2021-06-12 07:28:16 -07:00
Adam Birds 9aab03654e ci: Update CI to test once with custom db name and user.
Update CI to test once with a custom db name and user so we can test
both scenarios of a custom dbname/user and the default "zulip".
2021-05-25 13:56:05 -07:00
Tim Abbott 3af0485d84 ci: Unpack installation tarball under /root/.
This ensures that we exercise the fact that the Zulip installer may be
unpacked to a directory that may not be world-readable.

bc45525369 fixed a recent regression in
this behavior that would have been caught by this commit.
2021-05-14 14:31:00 -07:00
Anders Kaseorg 405bc8dabf requirements: Remove Thumbor.
Thumbor and tc-aws have been dragging their feet on Python 3 support
for years, and even the alphas and unofficial forks we’ve been running
don’t seem to be maintained anymore.  Depending on these projects is
no longer viable for us.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-06 20:07:32 -07:00
Adam Birds e27268837b tools: Have `optimize-svg` do the optimization automatiically.
I have made `tools/setup/optimize-svg` do the SVG optimization
automatically rather than just telling you the command to run if they
need optimizing. This included adding a `--check` parameter to use in
CI to only check as we previously did rather than actually running the
optimization.

I have also made `tools/setup/optimize-svg` execute
`tools/setup/generate_integration_bots_avatars.py` once it has run the
optimization to ensure it is always ran.

This makes it one less command to run when creating an integration,
but also means that we catch instances where a PNG has just been
copied into the `static/images/integrations/bot_avatars` folder as the
only instance where this won't be run is if `optimize-svg` has not
been run which would be caught in CI.

Fixes #18183. Fixes #18184.
2021-04-19 10:16:54 -07:00
Gaurav Pandey 1bdcb11543 ci: Run zulip backend test suite for Debian bullseye.
This also verifies the Zulip codebase's Python 3.9 support.
2021-04-15 21:38:31 -07:00
Gaurav Pandey 303e7b9701 ci: Add Debian bullseye to production test suite. 2021-04-15 21:38:31 -07:00
Vishnu KS 8362865c8d actions: Rename kandra-ops to kandra ops in oneclick config file.
This bug was introduced in f00c13d303
when we started to hardcode stream name in config file instead of
storing it as one of the GitHub secrets.
2021-04-15 10:41:20 -07:00
Tim Abbott ad2e7dcba3 ci: Add comments documenting building base images. 2021-04-13 10:33:47 -07:00
Vishnu KS f00c13d303 actions: Improve the secrets of one click release action. 2021-04-05 14:40:45 -07:00
Alex Vandiver 0023d561dd ci: Switch to hosting the CI images under Zulip on Dockerhub. 2021-03-31 16:54:34 -07:00
Aman Agrawal 837736001d ci: Use latest containers for running production tests.
This should have been a part of
da80895249 where the containers
were originally created.
2021-03-30 07:54:41 -07:00
Anders Kaseorg 056b715765 ci: Remove 2>&1 redirection.
We had used 2>&1 to redirect stderr to stdout so it could be piped
into ts, but commit dd3cdd6ec5 (#17611)
removed ts, so we no longer need the redirection.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-29 14:52:06 -07:00
Aman Agrawal 9c4d9dbaf1 ci: Regenerate bionic and focal containers.
This helps us reduce time to update dependencies on every CI
build since the previous containers used to take about 1 minute.

`sudo` had a bug due to which we were not able to create directories.
See https://github.com/sudo-project/sudo/issues/42.
We used these directories to restore caches.
Upgrading the focal dependencies via this commit naturally fixes that
bug.

Fixes #17854
2021-03-29 12:26:56 +05:30
Gaurav Pandey 371cdf9dc1 production_suite: Add debian production install to production suite.
We support Debian as an OS for setting up the Zulip server. But the CI
does not run on pull request to test the setting up of the server on
Debian. Hence, add the check to CI.
2021-03-28 16:04:03 -07:00
Vishnu KS 79586cc466 github: Create action for generating DigitalOcean one click app image. 2021-03-26 16:01:18 -07:00
Aman Agrawal e0ed9cc605 ci: Remove CircleCI workaround for buggy CPU count allocation.
GitHub Actions gives us 2 cpus (probably shared) to run the
jobs. Specifying 6 processes here doesn't make a difference
since both jobs run in around 5 minutes right now.
2021-03-16 15:11:26 -07:00
Aman Agrawal f2a137f863 github_actions: Remove Codecov workaround.
Codecov has released the new version which fixes the find error.
Followup from 6a357ea114
2021-03-16 15:11:21 -07:00
Aman Agrawal 76c69b943c github_actions: Explode backend and frontend tests.
We basically move all the tests from backend and frontend test
files to zulip-ci workflow. This results in GitHub Actions
nicely displaying all the tests separately.
2021-03-16 15:11:21 -07:00
Aman Agrawal dd3cdd6ec5 github_actions: Stop logging timestamp.
Timestamps are logged automatically by GitHub Actions and can be
made visible using log settings easily. Hence we remove the
unnecessary timestamps here to make the logs look much cleaner.
2021-03-16 15:11:21 -07:00
Alex Vandiver 2dc0662a50 ci: Upload puppeteer artifacts on failure.
Storing the puppeteer artifacts is useful for debugging failures in
CI.

Confusingly, `if: ${{ something }}` does not work out to be true like
`if: ${{ always() && something }}` does; the former has a silent
`success()` built into it[1]:

> If your if expression does not contain any of the status functions
> it will automatically result with success().

[1] https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions
2021-03-10 12:00:47 -08:00
Aman Agrawal 80268c52df ci: Notify in zulip when a build fails in GitHub Actions.
We use the circleci integration which already has a nice setup
for sending messages when triggered to send the build failure
notification.
2021-02-26 08:29:56 -08:00
Anders Kaseorg 892ef2749f ci: Port xenial-legacy check to GitHub Actions.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-08 18:01:29 -08:00
Tim Abbott b6ec66e972 github: Enable retention periods for uploaded artifacts.
This prevents Zulip CI from eventually consuming large amounts of
storage on one's GitHub account.

I picked a longer retention period for the Puppeteer artifacts because
humans look at those; the production tarballs are unlikely to be used
10 minutes after the run completes as they are just for the next stage
fo the build; certainly 14 days seems ample for any debugging.
2020-11-03 16:36:26 -08:00
Alex Vandiver 2b0bbbb882 tools: Rename postgres to postgresql in tool names. 2020-10-28 11:57:02 -07:00
Anders Kaseorg 72d6ff3c3b docs: Fix more capitalization issues.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-10-23 11:46:55 -07:00
Anders Kaseorg dd48dbd912 docs: Add spaces to “check out”, “log in”, “set up”, “sign up” as verbs.
“Checkout”, “login”, “setup”, and “signup” are nouns, not verbs.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-10-13 15:47:13 -07:00
Anders Kaseorg 58808c2362 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-24 16:33:45 -07:00
Anders Kaseorg d9860d40a6 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-02 19:34:37 -07:00
Anders Kaseorg 60a25b2721 docs: Fix spelling errors caught by codespell.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-11 10:23:06 -07:00
Priyank Patel cbf1404c2d github-actions: Cancel previous runs on pushes to forks and PRs.
It only cancel previous runs on forks or for pull request builds
and does not run for zulip/zulip repo pushes. It finishes pretty
quickly (under 1 minute) so it fine to have it as a workflow
rather than to add a new step under every single job to cancel it's
previous runs.

The only downside to this is that GitHub creates a notification for
the cancelled job just like it does for failed jobs!!!
2020-08-04 14:32:03 -07:00
Priyank Patel 9504d403b3 github-actions: Fix incorrect hash key in production install job.
The hash keys were missing hash for package.json and yarn.lock
because they were not present since we don't do a full checkout
in this job. We fix this by sending over those files and generating
hashes from them.

I usally verify these cache keys by clicking the Restore <cache>
step dropdown menu and then clicking the Run ... dropdown menu again
to see the generated hash.
2020-08-03 12:37:20 -07:00
Tim Abbott f3921e57be ci: Remove confused references to test-event-log.
The "event log" in question was never useful in our test systems (and
hasn't been used for anything real since 2014).  I'm not sure how we
ended up with in the CI configuration.
2020-07-24 12:42:08 -07:00
Priyank Patel 98d1c215de github-actions: Rename focal and bionic tests job name to unit_tests. 2020-07-24 10:39:19 -07:00
Priyank Patel 07b79833a9 github-actions: Only run production suite on production related updates.
The production suite will only run if anything under puppet,
scripts, and tools or any migrations are updated. The '**' glob
means it includes subdirectory updates. For migrations all ~5
migrations directories are includes using the **/migrations/**
pattern.

The GitHub Action docs that explain the syntax:
https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
2020-07-24 10:36:55 -07:00
Priyank Patel 3ab53c6a83 github-actions: Add bionic and focal production install jobs.
We remove the "Do memcached hack" step from CircleCI when migrating
this job because a fix has been made upstream.
2020-07-24 10:36:55 -07:00
Priyank Patel 23372a49e1 github-actions: Add bionic production build job.
All the steps are same from circleci except two steps:
  1. The 'Add permissions ...' step is Actions specific as explained
     in comments.
  2. The step that used upload-artifacts is Actions verison of
     presist_to_workspace.

Finally, I should note the duplication in this and zulip-ci
workflow. There are three reason this is not a problem:
  1. It will be messy to mush this into zulip-ci workflow only for
     benefit of un-duplicating the env and cache restore steps.
  2. We needs this on its own workflow if we want to only run it
     when production related dependencies are updated.
  3. I don't see us updating the duplicated steps between both
     workflow. Circle CI config is prefect example for this; nothing
     is changed except for adding or updating steps which are not
     duplicated.
2020-07-24 10:36:55 -07:00
Priyank Patel 4c475ab2f7 github-actions: Do not fail other jobs when one job in matrix fails.
This change makes it so if focal backend job fails the bionic
backend and frontend jobs keeps running. Previously, it failed both
of the jobs if one failed. This is expected since typically matrix
is used to run sames tests on multiple versions and such but our use
case is bit more than that.
2020-07-24 10:36:55 -07:00
Anders Kaseorg 2794bc1ef4 lint: Reformat YAML files with Prettier.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-14 16:25:31 -07:00
Priyank Patel 61955ecf41 github-actions: Don't run code scanning workflow every week.
Since we already run this on every push we don't need to run it as a
cron job every week for no reason. While we are touching this code
block, we convert it to on: [push, pull_request] since the previous
format felt weird. It was only written that way because we had the
cron job declared there.
2020-07-07 17:26:16 -07:00
Priyank Patel 711943a3ab github-actions: Use include_frontend_test check.
Uses the include_frontend_test instead of platfrom specific check.
2020-07-07 17:26:16 -07:00
Priyank Patel 4938d6ab6b minor: Rename codeql workflow names.
This makes it so the GitHub displays the runs as "Code Scanning / CodeQL"
instead of "Code scanning - actions / CodeQL-Build".
2020-07-07 17:26:16 -07:00
Priyank Patel 29dd0c485a ci: Move upgrading git for bionic to docker image.
Just reduces the clutter in configuration file for GitHub Actions.
2020-07-06 18:09:15 -07:00
Priyank Patel c908278237 ci: Install moreutils in the docker image. 2020-07-06 18:09:15 -07:00
Priyank Patel 650ec29859 github-actions: Use stratergy and if to deduplicate steps.
This is a fine solution short-term until github implements the
yaml anchors support. The limitation of this method is that we
cannot re-use most of the steps again for production install test
builds.

Thanks, Anders for this solution.

Verifying everything is migrated correctly is a pain. This script
ensures everything is done correctly (previous commit message
contains explainations for the steps being ignored if; in case
of github-actions steps they are ignored because they are actions
specific):
"""
This script prints out the ignore steps first. Then
prints out each step of both circle and actions side-by-side.
One step is out of order for bionic but verfying correction is
still easier. Format:
Actions: Install dependencies
Circle CI: install dependencies
....
"""
import yaml

with open('.circleci/config.yml') as f:
    circleci_config = yaml.safe_load(f)

with open('.github/workflows/zulip-ci.yml') as f:
    actions_config = yaml.safe_load(f)

circle_bionic_steps = []
circle_focal_steps = []
actions_bionic_steps = []
actions_focal_steps = []

"""
We ignore casper artifact upload, save_cache, and
store_tests_reports steps.
"""
def get_circleci_steps(job, arr):
    for step in circleci_config['jobs'][job]['steps']:
        if isinstance(step, str):
            arr.append(step)
            continue

        step_name = step.get('run', {}).get('name', False)
        if not step_name:
            if step.get('restore_cache'):
                key = step['restore_cache']['keys'][0].split('.')[0]
                step_name = f'<restore-cache> {key}'
            elif step.get('store_artifacts', False):
                destination = step['store_artifacts']['destination']
                step_name = f'<store-artificats> {destination}'

                if destination == 'casper':
                    \# This is no longer needed
                    print('Ignoring step:')
                    print(step)
                    print()
                    continue
            else:
		"""
                We don't care about save_cache; github-actions
                does this automatically, and store_tests_reports
                is circelci timing specific.
		"""
                print('Ignoring step:')
                print(step)
                print()
                continue

        if step_name != 'On fail':
            arr.append(step_name)

get_circleci_steps('bionic-backend-frontend', circle_bionic_steps)
get_circleci_steps('focal-backend', circle_focal_steps)

""" We ignore there steps specific to github-actions"""
for step in actions_config['jobs']['focal_bionic']['steps']:
    BOTH_OS = 'BOTH_OS'
    if_check = step.get('if', BOTH_OS)
    step_name = step.get('name')

    if step_name is None:
        step_name = step['uses']

    if (
        step_name == 'Upgrade git for bionic' or
        step_name == 'Add required permissions' or
        step_name == 'Move test reports to var'
    ):
        print('Ignoring step:')
        print(step)
        print()
        """These are github-actions specific; see comments"""
        continue

    if if_check == BOTH_OS:
        actions_bionic_steps.append(step_name)
        actions_focal_steps.append(step_name)
    elif 'is_bionic' in if_check:
        actions_bionic_steps.append(step_name)
    else:
        actions_focal_steps.append(step_name)

bionic = zip(circle_bionic_steps, actions_bionic_steps)
focal = zip(circle_focal_steps, actions_focal_steps)

print('Bionic steps:')
for (circle_step, actions_step) in bionic:
    print(f'CircleCI: {circle_step}')
    print(f'Actions: {actions_step}')
    print()

print('Focal steps:')
for (circle_step, actions_step) in focal:
    print(f'CircleCI: {circle_step}')
    print(f'Actions: {actions_step}')
    print()
2020-07-06 18:09:15 -07:00
Priyank Patel ad5eb68ee1 github-actions: Add focal backend job.
No new sets of change in this commit that are explained two commits
before this one, which add bionic-backend-frontend.
2020-07-06 18:09:15 -07:00
Priyank Patel 7ff1fd5923 github-actions: Add bionic frontend and backend test job.
Some noteable diffrence from circleci:
   - We upgrade git to newer version (reason explained in comments)
   - We set HOME to /home/github (also explained in comments)
   - Adjust permissions (... comments)
   - Minor changes to step names and cache keys.
   - We don't need to port the save_cache steps they are done
     automatically in actions. And, we did not port the
     store_test_results step which is circleci specific.
   - We didn't port the notify_failure step yet (see the TODO).
2020-07-06 18:09:15 -07:00
Tim Abbott cc8353f8b1 github: Enable new codeql-analysis feature.
This file was generated by GitHub's code analysis tutorial; we were
just approved from their waitlist.

I deleted the part to run compilers as it is not relevant for us.
2020-06-26 16:59:28 -07:00