Skip to content

Commit

Permalink
ci: Move upgrading git for bionic to docker image.
Browse files Browse the repository at this point in the history
Just reduces the clutter in configuration file for GitHub Actions.
  • Loading branch information
priyank-p authored and timabbott committed Jul 7, 2020
1 parent c908278 commit 29dd0c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/zulip-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions tools/ci/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 29dd0c4

Please sign in to comment.