Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
end_of_line = lf
charset = utf-8
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[[shell]]
binary_next_line = true
switch_case_indent = true

[*.{yaml,yml}]
indent_size = 2
36 changes: 36 additions & 0 deletions .github/workflows/dockerfile-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Build and push `main` image

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:main
cache-from: type=gha
cache-to: type=gha,mode=max
22 changes: 22 additions & 0 deletions .github/workflows/dockerfile-cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Cleanup closed PR images

on:
pull_request:
branches:
- main
types: [closed]

jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Delete PR image
uses: actions/delete-package-versions@v5
with:
package-name: "zulip/docker-zulip"
package-type: "container"
token: ${{ secrets.GITHUB_TOKEN }}
tag-name: pr-${{ github.event.pull_request.number }}
146 changes: 146 additions & 0 deletions .github/workflows/dockerfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
name: Dockerfile lint and build

on:
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- uses: hadolint/hadolint-action@v3.1.0

build:
runs-on: ubuntu-latest
needs: lint
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }}
cache-from: type=gha
cache-to: type=gha,mode=max

helm-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Run helm-docs
uses: losisin/helm-docs-github-action@v1
with:
fail-on-diff: true

helm-test:
runs-on: ubuntu-latest
needs:
- helm-docs
- build
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4.2.0
with:
version: v3.17.0

- uses: actions/setup-python@v5.3.0
with:
python-version: "3.x"
check-latest: true

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.7.0
with:
version: 3.14.0
yamllint_version: 1.37.1
yamale_version: 6.0.0

- name: Set up helm repos
run: |
helm repo add groundhog2k https://groundhog2k.github.io/helm-charts/

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --chart-dirs kubernetes/chart \
--target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: |
ct lint --github-groups \
--chart-dirs kubernetes/chart \
--target-branch ${{ github.event.repository.default_branch }} \
--lint-conf lintconf.yaml

- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1

- name: Log in to GHCR
if: steps.list-changed.outputs.changed == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Load image into kind
if: steps.list-changed.outputs.changed == 'true'
run: |
docker pull ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }}
kind load docker-image ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }} --name chart-testing

- name: Run chart-testing (install)
id: chart-testing-install
if: steps.list-changed.outputs.changed == 'true'
run: |
ct install --github-groups \
--chart-dirs kubernetes/chart \
--target-branch ${{ github.event.repository.default_branch }} \
--helm-extra-set-args "--set image.tag=pr-${{ github.event.pull_request.number }}" \
--skip-clean-up

- name: Fetch logs
if: always()
run: |
namespace=$(helm list --all-namespaces --output json \
| jq -r '[.[] | select(.namespace | startswith("zulip-"))][0].namespace')
kubectl get pods -n "$namespace"
for pod in $(kubectl get pods -n "$namespace" -o name); do
kubectl describe "$pod" -n "$namespace"
done
pod=$(kubectl get pods -n "$namespace" -l app.kubernetes.io/name=zulip --output name)
kubectl -n "$namespace" logs "$pod"
kubectl -n "$namespace" exec "$pod" -c zulip -- cat /var/log/zulip/errors.log
14 changes: 14 additions & 0 deletions .github/workflows/shell-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Shell check and lint

on:
pull_request:
branches:
- main

jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: luizm/action-sh-checker@master
16 changes: 16 additions & 0 deletions .github/workflows/spelling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Spelling

on:
pull_request:
branches:
- main

jobs:
spelling:
name: Spellcheck with Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Spell Check Repo
uses: crate-ci/typos@v1.39.0
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ENV LANG="C.UTF-8"

ARG UBUNTU_MIRROR

# hadolint ignore=DL3005,DL3008,DL3009
RUN { [ ! "$UBUNTU_MIRROR" ] || sed -i "s|http://\(\w*\.\)*archive\.ubuntu\.com/ubuntu/\? |$UBUNTU_MIRROR |" /etc/apt/sources.list; } && \
apt-get -q update && \
apt-get -q dist-upgrade -y && \
Expand All @@ -29,8 +30,7 @@ WORKDIR /home/zulip
ARG ZULIP_GIT_URL=https://github.com/zulip/zulip.git
ARG ZULIP_GIT_REF=11.4

RUN git clone "$ZULIP_GIT_URL" -b "$ZULIP_GIT_REF" && \
cd zulip
RUN git clone "$ZULIP_GIT_URL" -b "$ZULIP_GIT_REF"

WORKDIR /home/zulip/zulip

Expand All @@ -53,12 +53,12 @@ COPY custom_zulip_files/ /root/custom_zulip

ARG CUSTOM_CA_CERTIFICATES

WORKDIR /root
RUN \
# Make sure Nginx is started by Supervisor.
dpkg-divert --add --rename /etc/init.d/nginx && \
ln -s /bin/true /etc/init.d/nginx && \
mkdir -p "$DATA_DIR" && \
cd /root && \
tar -xf zulip-server-docker.tar.gz && \
rm -f zulip-server-docker.tar.gz && \
mv zulip-server-docker zulip && \
Expand Down
2 changes: 1 addition & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ image (because we've significantly upgraded the major postgres version).

These instructions assume that you have not changed the default PostgreSQL data
path (`/opt/docker/zulip/postgresql/data`) in your `docker-compose.yml`. If you
have changed it, please replace all occurences of
have changed it, please replace all occurrences of
`/opt/docker/zulip/postgresql/data` with your path.

1. Make a backup of your Zulip PostgreSQL data directory.
Expand Down
Loading
Loading