docker: allow to specify the branch to pull for various repos

Declare an docker build-arg [1] and use it
whenever cloning one of our repositories. If the buildarg
is not specified, the variable defaults back to 'master'
and thus the current behavior doesn't change.

From the .gitlab-ci.yml file, when building pass
the GST_UPSTREAM_BRANCH that's defined from the ci_template
as the buildarg so we will be building the corresponding branches
for the docker images.

Close #33

[1] https://docs.docker.com/engine/reference/builder/#arg
This commit is contained in:
Jordan Petridis 2020-02-10 15:09:49 +02:00 committed by Jordan Petridis
parent 3608d69c1f
commit a99cdc8909
7 changed files with 16 additions and 8 deletions

View file

@ -1,3 +1,5 @@
include: "gitlab/ci_template.yml"
stages:
- "build docker"
- "preparation"
@ -36,7 +38,7 @@ test manifest:
- export _UID="${IMAGE}:${DATE}-${CI_JOB_ID}"
- export LATEST="${IMAGE}:latest"
- docker build --pull -f ${DOCKERFILE} -t ${LATEST} ${CONTEXT_DIR}
- docker build --pull --build-arg DEFAULT_BRANCH=${GST_UPSTREAM_BRANCH} -f ${DOCKERFILE} -t ${LATEST} ${CONTEXT_DIR}
# If we are in a fork, push the image to the reigstry regardless the branch
- |
@ -110,8 +112,6 @@ android docker:
DOCKERFILE: "docker/android/Dockerfile"
extends: .base
include: "gitlab/ci_template.yml"
.build local:
extends: '.build'
when: 'manual'

View file

@ -3,6 +3,8 @@ FROM registry.fedoraproject.org/fedora:31
ENV ANDROID_HOME=/android/sdk
ENV ANDROID_NDK_HOME=/android/ndk
ARG DEFAULT_BRANCH="master"
COPY prepare.sh cleanup.sh /root/
RUN /usr/bin/sh /root/prepare.sh && \

View file

@ -37,11 +37,11 @@ mkdir $GSTREAMER_ROOT_ANDROID
tar -xvf /android/sources/gstreamer-android.tar.xz -C $GSTREAMER_ROOT_ANDROID
ls $GSTREAMER_ROOT_ANDROID
git clone https://gitlab.freedesktop.org/gstreamer/gst-examples.git /android/sources/gst-examples
git clone -b ${DEFAULT_BRANCH} https://gitlab.freedesktop.org/gstreamer/gst-examples.git /android/sources/gst-examples
chmod +x /android/sources/gst-examples/playback/player/android/gradlew
/android/sources/gst-examples/playback/player/android/gradlew --no-search-upward --no-daemon --project-dir /android/sources/gst-examples/playback/player/android dependencies --refresh-dependencies
git clone https://gitlab.freedesktop.org/gstreamer/gst-docs.git /android/sources/gst-docs
git clone -b ${DEFAULT_BRANCH} https://gitlab.freedesktop.org/gstreamer/gst-docs.git /android/sources/gst-docs
chmod +x /android/sources/gst-docs/examples/tutorials/android/gradlew
/android/sources/gst-docs/examples/tutorials/android/gradlew --no-search-upward --no-daemon --project-dir /android/sources/gst-docs/examples/tutorials/android dependencies --refresh-dependencies

View file

@ -1,5 +1,7 @@
FROM python:3.7.1-alpine
ARG DEFAULT_BRANCH="master"
RUN pip install requests
RUN apk add git
RUN cd / && git clone https://gitlab.freedesktop.org/gstreamer/gst-ci.git
RUN cd / && git clone -b ${DEFAULT_BRANCH:=master} https://gitlab.freedesktop.org/gstreamer/gst-ci.git

View file

@ -2,6 +2,8 @@ FROM registry.fedoraproject.org/fedora:31
ENV TERM="dumb"
ARG DEFAULT_BRANCH="master"
# System setup
RUN echo "fastestmirror=true" >> /etc/dnf/dnf.conf && \
dnf upgrade -y && \
@ -11,7 +13,7 @@ RUN echo "fastestmirror=true" >> /etc/dnf/dnf.conf && \
RUN git config --global user.email "cerbero@gstreamer.freedesktop.org" && \
git config --global user.name "Cerbero Build System"
RUN git clone https://gitlab.freedesktop.org/gstreamer/cerbero.git && \
RUN git clone -b ${DEFAULT_BRANCH} https://gitlab.freedesktop.org/gstreamer/cerbero.git && \
mkdir $HOME/.cerbero && \
echo "allow_parallel_build=True" > $HOME/.cerbero/cerbero.cbc && \
echo "use_ccache=True" >> $HOME/.cerbero/cerbero.cbc && \

View file

@ -4,6 +4,8 @@ ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
ARG DEFAULT_BRANCH="master"
COPY prepare.sh cleanup.sh /root/
RUN /usr/bin/sh /root/prepare.sh && \

View file

@ -223,6 +223,6 @@ cargo --version
rustc --version
# get gst-build and make all subprojects available
git clone git://anongit.freedesktop.org/gstreamer/gst-build /gst-build/
git clone -b ${DEFAULT_BRANCH} https://gitlab.freedesktop.org/gstreamer/gst-build.git /gst-build/
cd /gst-build
meson subprojects download