Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

ci: Move upgrading git for bionic to docker image.

Priyank Patel29dd0c485ad2
diff --git a/.github/workflows/zulip-ci.yml b/.github/workflows/zulip-ci.yml
index 15c2a39badb..d76bf3fddd8 100644
--- a/.github/workflows/zulip-ci.yml
+++ b/.github/workflows/zulip-ci.yml
@@ -40,18 +40,6 @@ jobs:
HOME: /home/github/
steps:
- # Upgrade git before using checkout actions because it downloads
- # the code using Rest API if git version is less than v2.18,
- # which will cause errors in tests and provision. This is only
- # required for bionic.
- - name: Upgrade git for bionic
- if: ${{ matrix.is_bionic }}
- run: |
- sudo apt-get install -y software-properties-common
- sudo add-apt-repository ppa:git-core/ppa -y
- sudo apt-get update
- sudo apt-get install -y git
-
- name: Add required permissions
run: |
# The checkout actions doesn't clone to ~/zulip or allow
diff --git a/tools/ci/Dockerfile.template b/tools/ci/Dockerfile.template
index f55d8c8a96b..d402191690d 100644
--- a/tools/ci/Dockerfile.template
+++ b/tools/ci/Dockerfile.template
@@ -96,6 +96,18 @@ RUN apt-get update \
libxml2-dev libxslt1-dev libpq-dev moreutils \
{extra_packages}
+# Upgrade git if it is less than v2.18 because GitHub Actions'
+# checkout installs source code using Rest API as an optimization
+# if the version is less than v2.18, which causes failure in provision
+# and tests because of the lack of git being initialized.
+RUN export git_version=$(git --version | cut -d ' ' -f3 | cut -d 'v' -f2) && \
+ if dpkg --compare-versions $git_version lt 2.18; then \
+ sudo apt-get install -y software-properties-common && \
+ sudo add-apt-repository ppa:git-core/ppa -y && \
+ sudo apt-get update && \
+ sudo apt-get install -y git; \
+ fi
+
ARG USERNAME=github
RUN groupadd --gid 3434 $USERNAME \
&& useradd --uid 3434 --gid $USERNAME --shell /bin/bash --create-home $USERNAME \