CI: add gitlab-ci.yml config file

Eventually this CI could move to GitLab, so start with some testing.

Signed-off-by: Paul Spooren <mail@aparcar.org>
pull/18/head
Paul Spooren 2019-08-05 18:40:30 +02:00
parent 9acb62027d
commit 3e6f6e89c9
10 changed files with 183 additions and 122 deletions

View File

@ -1,81 +0,0 @@
version: 2
jobs:
testbuild:
machine:
image: ubuntu-1604:201903-01
steps:
- run: sudo apt update && sudo apt install signify-openbsd
- checkout
- run: bash docker-common.sh
- run:
name: Create snapshot Rootfs container
command: bash docker-rootfs.sh
- run:
name: Create snapshot ImageBuilder container
command: bash docker-imagebuilder.sh
- run:
name: Create snapshot SDK container
command: bash docker-sdk.sh
rootfs-snapshot:
machine:
image: ubuntu-1604:201903-01
steps:
- run: sudo apt update && sudo apt install signify-openbsd
- checkout
- run: bash docker-common.sh
- run:
name: Create snapshot Rootfs container
command: bash docker-rootfs.sh
environment:
DOCKER_IMAGE: "openwrtorg/rootfs"
TARGETS: "x86-64 armvirt-32 armvirt-64"
imagebuilder-snapshot:
machine:
image: ubuntu-1604:201903-01
steps:
- run: sudo apt update && sudo apt install signify-openbsd
- checkout
- run: bash docker-common.sh
- run:
name: Create snapshot ImageBuilder container
command: bash docker-imagebuilder.sh
environment:
DOCKER_IMAGE: "openwrtorg/imagebuilder"
TARGETS: "cns3xxx-generic mvebu-cortexa53 mvebu-cortexa72 mvebu-cortexa9 ipq40xx-generic ipq806x-generic layerscape-armv7 layerscape-armv8_32b layerscape-armv8_64b imx6-generic octeontx-generic sunxi-cortexa8 sunxi-cortexa53 sunxi-cortexa7 ppc44x-generic bcm53xx-generic brcm47xx-mips74k brcm47xx-generic brcm47xx-legacy ath79-nand ath79-generic ath79-tiny ath25-generic mcs814x-generic ar7-ac49x ar7-generic kirkwood-generic apm821xx-sata apm821xx-nand ramips-rt305x ramips-rt3883 ramips-mt76x8 ramips-mt7620 ramips-rt288x ramips-mt7621 au1000-au1550 au1000-au1500 pistachio-generic gemini-wiligear gemini-generic gemini-raidsonic brcm2708-bcm2708 brcm2708-bcm2709 brcm2708-bcm2710 x86-geode x86-generic x86-legacy x86-64 lantiq-xway_legacy lantiq-xrx200 lantiq-ase lantiq-falcon lantiq-xway mediatek-mt7622 mediatek-mt7623 mediatek-32 mpc85xx-p1020 mpc85xx-p2020 mpc85xx-generic tegra-generic zynq-generic archs38-generic ixp4xx-harddisk ixp4xx-generic mxs-generic oxnas-ox820 octeon-generic armvirt-32 armvirt-64 arc770-generic adm8668-generic xburst-qi_lb60 samsung-s5pv210 omap-generic ar71xx-nand ar71xx-generic ar71xx-tiny ar71xx-mikrotik brcm63xx-generic brcm63xx-smp at91-sama5d3 at91-sama5d4 at91-sam9x at91-sama5 at91-legacy at91-sama5d2 rb532-generic malta-le malta-be malta-be64 malta-le64"
sdk-snapshot:
machine:
image: ubuntu-1604:201903-01
steps:
- run: sudo apt update && sudo apt install signify-openbsd
- checkout
- run: bash docker-common.sh
- run:
name: Create snapshot SDK container
command: bash docker-sdk.sh
environment:
DOCKER_IMAGE: "openwrtorg/sdk"
TARGETS: "cns3xxx-generic mvebu-cortexa53 mvebu-cortexa72 mvebu-cortexa9 ipq40xx-generic ipq806x-generic layerscape-armv7 layerscape-armv8_32b layerscape-armv8_64b imx6-generic octeontx-generic sunxi-cortexa8 sunxi-cortexa53 sunxi-cortexa7 ppc44x-generic bcm53xx-generic brcm47xx-mips74k brcm47xx-generic brcm47xx-legacy ath79-nand ath79-generic ath79-tiny ath25-generic mcs814x-generic ar7-ac49x ar7-generic kirkwood-generic apm821xx-sata apm821xx-nand ramips-rt305x ramips-rt3883 ramips-mt76x8 ramips-mt7620 ramips-rt288x ramips-mt7621 au1000-au1550 au1000-au1500 pistachio-generic gemini-wiligear gemini-generic gemini-raidsonic brcm2708-bcm2708 brcm2708-bcm2709 brcm2708-bcm2710 x86-geode x86-generic x86-legacy x86-64 lantiq-xway_legacy lantiq-xrx200 lantiq-ase lantiq-falcon lantiq-xway mediatek-mt7622 mediatek-mt7623 mediatek-32 mpc85xx-p1020 mpc85xx-p2020 mpc85xx-generic tegra-generic zynq-generic archs38-generic ixp4xx-harddisk ixp4xx-generic mxs-generic oxnas-ox820 octeon-generic armvirt-32 armvirt-64 arc770-generic adm8668-generic xburst-qi_lb60 samsung-s5pv210 omap-generic ar71xx-nand ar71xx-generic ar71xx-tiny ar71xx-mikrotik brcm63xx-generic brcm63xx-smp at91-sama5d3 at91-sama5d4 at91-sam9x at91-sama5 at91-legacy at91-sama5d2 rb532-generic malta-le malta-be malta-be64 malta-le64"
workflows:
version: 2
testbuild:
jobs:
- testbuild:
filters:
branches:
ignore: master
dockerbuild:
jobs:
- rootfs-snapshot
- imagebuilder-snapshot
- sdk-snapshot
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master

136
.gitlab-ci.yml 100644
View File

@ -0,0 +1,136 @@
variables:
TERM: xterm
TARGETS: "cns3xxx-generic mvebu-cortexa53 mvebu-cortexa72 mvebu-cortexa9 ipq40xx-generic ipq806x-generic layerscape-armv7 layerscape-armv8_32b layerscape-armv8_64b imx6-generic octeontx-generic sunxi-cortexa8 sunxi-cortexa53 sunxi-cortexa7 ppc44x-generic bcm53xx-generic brcm47xx-mips74k brcm47xx-generic brcm47xx-legacy ath79-nand ath79-generic ath79-tiny ath25-generic mcs814x-generic ar7-ac49x ar7-generic kirkwood-generic apm821xx-sata apm821xx-nand ramips-rt305x ramips-rt3883 ramips-mt76x8 ramips-mt7620 ramips-rt288x ramips-mt7621 au1000-au1550 au1000-au1500 pistachio-generic gemini-wiligear gemini-generic gemini-raidsonic brcm2708-bcm2708 brcm2708-bcm2709 brcm2708-bcm2710 x86-geode x86-generic x86-legacy x86-64 lantiq-xway_legacy lantiq-xrx200 lantiq-ase lantiq-falcon lantiq-xway mediatek-mt7622 mediatek-mt7623 mediatek-32 mpc85xx-p1020 mpc85xx-p2020 mpc85xx-generic tegra-generic zynq-generic archs38-generic ixp4xx-harddisk ixp4xx-generic mxs-generic oxnas-ox820 octeon-generic armvirt-32 armvirt-64 arc770-generic adm8668-generic xburst-qi_lb60 samsung-s5pv210 omap-generic ar71xx-nand ar71xx-generic ar71xx-tiny ar71xx-mikrotik brcm63xx-generic brcm63xx-smp at91-sama5d3 at91-sama5d4 at91-sam9x at91-sama5 at91-legacy at91-sama5d2 rb532-generic malta-le malta-be malta-be64 malta-le64"
build-imagebuilder:
image: docker:latest
stage: build
services:
- docker:dind
before_script:
- apk add curl rsync bash gnupg outils-signify
- bash docker-common.sh
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- bash docker-imagebuilder.sh
- docker tag "$DOCKER_IMAGE:latest" "$DOCKER_IMAGE:imagebuilder"
- docker push "$DOCKER_IMAGE:imagebuilder"
variables:
TARGETS: "x86-64"
BRANCHES: "master 19.07-SNAPSHOT"
DOCKER_IMAGE: "$CI_REGISTRY_IMAGE"
test-imagebuilder:
image: "$CI_REGISTRY_IMAGE:imagebuilder"
stage: test
script:
- cd ~/openwrt
- make image
- ls ./bin/targets/x86/64/*combined-squashfs.img.gz
deploy-imagebuilder:
image: docker:latest
stage: deploy
only:
- master
services:
- docker:dind
before_script:
- apk add curl rsync bash gnupg outils-signify
- bash docker-common.sh
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
script:
- bash docker-imagebuilder.sh
- docker push "$DOCKER_IMAGE"
variables:
DOCKER_IMAGE: "openwrtorg/imagebuilder"
build-sdk:
image: docker:latest
stage: build
services:
- docker:dind
before_script:
- apk add curl rsync bash gnupg outils-signify
- bash docker-common.sh
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- bash docker-sdk.sh
- docker tag "$DOCKER_IMAGE:latest" "$DOCKER_IMAGE:sdk"
- docker push "$DOCKER_IMAGE:sdk"
variables:
TARGETS: "x86-64"
BRANCHES: "master 19.07-SNAPSHOT"
DOCKER_IMAGE: "$CI_REGISTRY_IMAGE"
test-sdk:
image: "$CI_REGISTRY_IMAGE:sdk"
stage: test
script:
- cd ~/openwrt
- make defconfig
- ./scripts/feeds update base
- ./scripts/feeds install busybox
- make package/busybox/compile -j$(nproc)
- ls ./bin/packages/x86_64/base/busybox*
deploy-sdk:
image: docker:latest
stage: deploy
only:
- master
services:
- docker:dind
before_script:
- apk add curl rsync bash gnupg outils-signify
- bash docker-common.sh
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
script:
- bash docker-sdk.sh
- docker push "$DOCKER_IMAGE"
variables:
DOCKER_IMAGE: "openwrtorg/sdk"
build-rootfs:
image: docker:latest
stage: build
services:
- docker:dind
before_script:
- apk add curl rsync bash gnupg outils-signify
- bash docker-common.sh
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- bash docker-rootfs.sh
- docker tag "$DOCKER_IMAGE:latest" "$DOCKER_IMAGE:rootfs"
- docker push "$DOCKER_IMAGE:rootfs"
variables:
TARGETS: "x86-64"
BRANCHES: "master 19.07-SNAPSHOT"
DOCKER_IMAGE: "$CI_REGISTRY_IMAGE"
test-rootfs:
image: "$CI_REGISTRY_IMAGE:rootfs"
stage: test
script:
- ls /
- ping -c 3 1.1.1.1
deploy-rootfs:
image: docker:latest
stage: deploy
only:
- master
services:
- docker:dind
before_script:
- apk add curl rsync bash gnupg outils-signify
- bash docker-common.sh
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS"
script:
- bash docker-rootfs.sh
- docker push "$DOCKER_IMAGE"
variables:
DOCKER_IMAGE: "openwrtorg/rootfs"
BRANCHES: "master 19.07-SNAPSHOT"
TARGETS: "x86-64 armvirt-32 armvirt-64"

View File

@ -1,7 +1,7 @@
# OpenWrt Docker repository
[![GPL-2.0-only License][license-badge]][license-ref]
[![Circle CI][circle-ci-badge]][circle-ci-ref]
[![CI][ci-badge]][ci-ref]
[![Docker Hub][docker-hub-badge]][docker-hub-ref]
This repository contains scripts to create Docker containers for OpenWrt. The
@ -17,7 +17,7 @@ Used variables are `BRANCHES`, `TARGETS`, `DOCKER_USER`, `DOCKER_PASS` and `DOCK
`$BRANCHES` and `$TARGETS` unite to a build matrix.
See `.circleci/config.yml` for the current setup.
See `.gitlab-ci.yml` for the current setup.
## `rootfs`
@ -27,7 +27,7 @@ additional files for the rootfs should be added there before building.
### Example
docker run --rm -it openwrtorg/rootfs:x86-64
docker run --rm -it openwrtorg/rootfs
Enjoy a local OpenWrt container with internet access. Once closed the image is
removed.
@ -46,7 +46,7 @@ Windows or via CI.
### Example
docker run --rm -v "$(pwd)"/bin/:/home/build/sdk/bin -it openwrtorg/sdk:x86-64
docker run --rm -v "$(pwd)"/bin/:/home/build/openwrt/bin -it openwrtorg/sdk
# within the Docker container
./scripts/feeds update base
make defconfig
@ -68,7 +68,7 @@ MacOS X, Windows or via CI.
### Example
docker run --rm -v "$(pwd)"/bin/:/home/build/imagebuilder/bin -it openwrtorg/imagebuilder:x86-64
docker run --rm -v "$(pwd)"/bin/:/home/build/openwrt/bin -it openwrtorg/imagebuilder
# within the Docker container
make image
@ -79,8 +79,8 @@ store the binary in hosts `./bin` folder.
All currently available ImageBuilders via lower case `<target>-<subtarget>`
[circle-ci-badge]: https://img.shields.io/circleci/build/gh/openwrt/docker.svg?style=flat-square
[circle-ci-ref]: https://circleci.com/gh/openwrt/docker
[ci-badge]: https://code.fe80.eu/openwrt/docker/badges/master/pipeline.svg
[ci-ref]: https://code.fe80.eu/openwrt/docker/commits/master
[docker-hub-badge]: https://img.shields.io/badge/docker--hub-openwrtorg-blue.svg?style=flat-square
[docker-hub-ref]: https://hub.docker.com/u/openwrtorg
[license-badge]: https://img.shields.io/github/license/openwrt/docker.svg?style=flat-square

19
docker-build.sh 100755
View File

@ -0,0 +1,19 @@
#!/bin/bash
set -ex
if [ "$BRANCH" != "master" ]; then
if [ "$TARGET" != "x86-64" ]; then
docker build -t "$DOCKER_IMAGE:$TARGET-$BRANCH" -f Dockerfile ./build
else
docker build -t "$DOCKER_IMAGE:$BRANCH" -f Dockerfile ./build
fi
else
if [ "$TARGET" != "x86-64" ]; then
docker build -t "$DOCKER_IMAGE:$TARGET" -f Dockerfile ./build
else
docker build -t "$DOCKER_IMAGE:latest" -f Dockerfile ./build
fi
fi
rm -rf ./build

View File

@ -18,4 +18,12 @@ curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/17E1CE16.asc' |
# LEDE Build System (LEDE usign key for unattended build jobs)
curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=usign/b5043e70f9a75cde' --create-dirs \
-o ~/usign/b5043e70f9a75cde
-o ./usign/b5043e70f9a75cde
# Public usign key for unattended snapshot builds
curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=usign/b5043e70f9a75cde' --create-dirs \
-o ./usign/b5043e70f9a75cde
# Public usign key for 19.07 release builds
curl 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=usign/f94b9dd6febac963' --create-dirs \
-o ./usign/f94b9dd6febac963

View File

@ -14,10 +14,15 @@ fi
[ ! -f sha256sums.asc ] || gpg --with-fingerprint --verify sha256sums.asc sha256sums
if [ -f sha256sums.sig ]; then
if hash signify-openbsd 2>/dev/null; then
SIGNIFY_BIN=signify-openbsd # debian
else
SIGNIFY_BIN=signify # alpine
fi
VERIFIED=
for KEY in ~/usign/*; do
for KEY in ./usign/*; do
echo "Trying $KEY..."
if signify-openbsd -V -q -p "$KEY" -x sha256sums.sig -m sha256sums; then
if "$SIGNIFY_BIN" -V -q -p "$KEY" -x sha256sums.sig -m sha256sums; then
echo "...verified"
VERIFIED=1
break

View File

@ -18,11 +18,6 @@ for TARGET in $TARGETS ; do
fi
./docker-download.sh || exit 1
docker build -t "$DOCKER_IMAGE:$TARGET-$BRANCH" -f Dockerfile ./build
rm -rf ./build
[ -n "$DOCKER_USER" ] && [ -n "$DOCKER_PASS" ] && ./docker-upload.sh || true
./docker-build.sh || exit 1
done
done

View File

@ -17,10 +17,6 @@ for TARGET in $TARGETS ; do
cp -r ./rootfs/* ./build
docker build -t "$DOCKER_IMAGE:$TARGET-$BRANCH" -f Dockerfile.rootfs ./build
rm -rf ./build
[ -n "$DOCKER_USER" ] && [ -n "$DOCKER_PASS" ] && ./docker-upload.sh || true
./docker-build.sh || exit 1
done
done

View File

@ -8,7 +8,9 @@ export DOCKER_IMAGE="${DOCKER_IMAGE:-openwrt-sdk}"
export DOWNLOAD_FILE="openwrt-sdk-*.Linux-x86_64.tar.xz"
for TARGET in $TARGETS ; do
export TARGET
for BRANCH in $BRANCHES; do
export BRANCH
if [ "$BRANCH" == "master" ]; then
export DOWNLOAD_PATH="snapshots/targets/$(echo $TARGET | tr '-' '/')"
else
@ -16,11 +18,6 @@ for TARGET in $TARGETS ; do
fi
./docker-download.sh || exit 1
docker build -t "$DOCKER_IMAGE:$TARGET-$BRANCH" -f Dockerfile ./build
rm -rf ./build
[ -n "$DOCKER_USER" ] && [ -n "$DOCKER_PASS" ] && ./docker-upload.sh || true
./docker-build.sh || exit 1
done
done

View File

@ -1,14 +0,0 @@
#!/bin/bash
set -ex
if [ "$BRANCH" == "master" ]; then
docker tag "$DOCKER_IMAGE:$TARGET-$BRANCH" "$DOCKER_IMAGE:$TARGET"
docker push "$DOCKER_IMAGE:$TARGET"
if [ "$TARGET" == "x86-64" ]; then
docker tag "$DOCKER_IMAGE:$TARGET-$BRANCH" "$DOCKER_IMAGE:latest"
docker push "$DOCKER_IMAGE:latest"
fi
else
docker push "$DOCKER_IMAGE:$TARGET-$BRANCH"
fi