Commit d9ca3ad6 authored by Konstantin Pavlov's avatar Konstantin Pavlov

CI: do the rebuilds via kaniko.

parent 316e28e0
Pipeline #3334 failed with stage
in 18 seconds
image: docker:stable
variables:
# When using dind service we need to instruct docker, to talk with the
# daemon started inside of the service. The daemon is available with
# a network connection instead of the default /var/run/docker.sock socket.
#
# The 'docker' hostname is the alias of the service container as described at
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services
#
# Note that if you're using Kubernetes executor, the variable should be set to
# tcp://localhost:2375 because of how Kubernetes executor connects services
# to the job container
DOCKER_HOST: tcp://docker:2375/
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
DOCKER_DRIVER: overlay2
services:
- docker:dind
before_script:
- docker info
- apk add git make
.build-images: &build-images |
echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
DIRS=""
CHANGED=$(for i in `git log --name-only --pretty=oneline --full-index $CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA | grep -vE '^[0-9a-f]{40} '`; do echo `dirname $i`; done | sort | uniq)
for dir in $CHANGED; do
case "$dir" in
".")
;;
*)
DIRS="$DIRS $dir"
;;
esac
done
echo "Changed images: '$DIRS'"
for d in $DIRS; do
[ -d "$d" ] || continue
DATE=`date +'%Y%m%d%H%M%S`
/kaniko/executor --no-push --context $d --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $d-aarch64:$DATE
done
build:
stage: build
image:
name: registry.videolan.org:5000/videolan-kaniko-aarch64:20181206203056
entrypoint: [""]
script:
- ./rebuild-ci.sh
- *build-images
REGISTRY := registry.videolan.org:5000
TAG := $(notdir $(CURDIR))-aarch64
DATE := $(shell date +'%Y%m%d%H%M%S')
REVISION := $(shell git log --pretty=format:'%h' -n 1)
.PHONY: build push
all:
build:
docker build -t $(TAG):$(REVISION) .
push:
docker tag $(TAG):$(REVISION) $(REGISTRY)/$(TAG)
docker tag $(TAG):$(REVISION) $(REGISTRY)/$(TAG):$(DATE)
docker push $(REGISTRY)/$(TAG)
docker push $(REGISTRY)/$(TAG):$(DATE)
#!/bin/sh
set -e
/usr/bin/env
DIRS=""
CHANGED=$(for i in `git log --name-only --pretty=oneline --full-index $CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA | grep -vE '^[0-9a-f]{40} '`; do echo `dirname $i`; done | sort | uniq)
for dir in $CHANGED; do
case "$dir" in
".")
;;
*)
DIRS="$DIRS $dir"
;;
esac
done
echo "Changed images: '$DIRS'"
for d in $DIRS; do
[ -d "$d" ] || continue
make -C $d build
make -C $d push
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment