Commit 142bcd67 authored by Carlo Landmeter's avatar Carlo Landmeter

initial commit

parents
---
kind: pipeline
name: edge-x86
platform:
os: linux
arch: amd64
steps:
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
repo: alpinelinux/alpine-drone-ci
tags: edge-x86
dockerfile: dockerfiles/edge/x86/Dockerfile
---
kind: pipeline
name: v3.9-x86
platform:
os: linux
arch: amd64
steps:
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
repo: alpinelinux/alpine-drone-ci
tags: v3.9-x86
dockerfile: dockerfiles/v3.9/x86/Dockerfile
---
kind: pipeline
name: edge-x86_64
platform:
os: linux
arch: amd64
steps:
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
repo: alpinelinux/alpine-drone-ci
tags: edge-x86_64
dockerfile: dockerfiles/edge/x86_64/Dockerfile
---
kind: pipeline
name: v3.9-x86_64
platform:
os: linux
arch: amd64
steps:
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
repo: alpinelinux/alpine-drone-ci
tags: v3.9-x86_64
dockerfile: dockerfiles/v3.9/x86_64/Dockerfile
---
kind: pipeline
name: edge-aarch64
platform:
os: linux
arch: arm64
steps:
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
repo: alpinelinux/alpine-drone-ci
tags: edge-aarch64
dockerfile: dockerfiles/edge/aarch64/Dockerfile
---
kind: pipeline
name: v3.9-aarch64
platform:
os: linux
arch: arm64
steps:
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
repo: alpinelinux/alpine-drone-ci
tags: v3.9-aarch64
dockerfile: dockerfiles/v3.9/aarch64/Dockerfile
---
kind: pipeline
name: edge-armhf
platform:
os: linux
arch: arm
steps:
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
repo: alpinelinux/alpine-drone-ci
tags: edge-armhf
dockerfile: dockerfiles/edge/armhf/Dockerfile
---
kind: pipeline
name: v3.9-armhf
platform:
os: linux
arch: arm
steps:
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
repo: alpinelinux/alpine-drone-ci
tags: v3.9-armhf
dockerfile: dockerfiles/v3.9/armhf/Dockerfile
---
kind: pipeline
name: edge-armv7
platform:
os: linux
arch: arm
steps:
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
repo: alpinelinux/alpine-drone-ci
tags: edge-armv7
dockerfile: dockerfiles/edge/armv7/Dockerfile
---
kind: pipeline
name: v3.9-armv7
platform:
os: linux
arch: arm
steps:
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
repo: alpinelinux/alpine-drone-ci
tags: v3.9-armv7
dockerfile: dockerfiles/v3.9/armv7/Dockerfile
MIT License
Copyright (c) 2019 Carlo Landmeter
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# alpine-drone-ci
Build Alpine Linux packages with drone CI
[![Build Status](https://cloud.drone.io/api/badges/clandmeter/alpine-drone-ci/status.svg)](https://cloud.drone.io/clandmeter/alpine-drone-ci)
FROM arm64v8/alpine:latest
COPY scripts/*.sh /usr/local/bin/
COPY files/etc/ /etc/
RUN ["setup.sh", "edge" ]
USER buildozer
ENTRYPOINT [ "/bin/sh" ]
FROM arm32v6/alpine:latest
COPY scripts/*.sh /usr/local/bin/
COPY files/etc/ /etc/
RUN ["setup.sh", "edge" ]
USER buildozer
ENTRYPOINT [ "/bin/sh" ]
FROM arm32v6/alpine:latest
COPY scripts/*.sh /usr/local/bin/
COPY files/etc/ /etc/
# hack to force system to upgrade to armv7
COPY dockerfiles/edge/armv7/arch /etc/apk/
RUN ["setup.sh", "edge" ]
USER buildozer
ENTRYPOINT [ "/bin/sh" ]
FROM i386/alpine:latest
COPY scripts/*.sh /usr/local/bin/
COPY files/etc/ /etc/
RUN ["setup.sh", "edge" ]
USER buildozer
ENTRYPOINT [ "/bin/sh" ]
FROM amd64/alpine:latest
COPY scripts/*.sh /usr/local/bin/
COPY files/etc/ /etc/
RUN ["setup.sh", "edge" ]
USER buildozer
ENTRYPOINT [ "/bin/sh" ]
FROM arm64v8/alpine:3.9
COPY scripts/*.sh /usr/local/bin/
COPY files/etc/ /etc/
RUN ["setup.sh", "v3.9" ]
USER buildozer
ENTRYPOINT [ "/bin/sh" ]
FROM arm32v6/alpine:3.9
COPY scripts/*.sh /usr/local/bin/
COPY files/etc/ /etc/
RUN ["setup.sh", "v3.9" ]
USER buildozer
ENTRYPOINT [ "/bin/sh" ]
FROM arm32v6/alpine:3.9
COPY scripts/*.sh /usr/local/bin/
COPY files/etc/ /etc/
# hack to force system to upgrade to armv7
COPY dockerfiles/v3.9/armv7/arch /etc/apk/
RUN ["setup.sh", "v3.9" ]
USER buildozer
ENTRYPOINT [ "/bin/sh" ]
FROM i386/alpine:3.9
COPY scripts/*.sh /usr/local/bin/
COPY files/etc/ /etc/
RUN ["setup.sh", "v3.9" ]
USER buildozer
ENTRYPOINT [ "/bin/sh" ]
FROM amd64/alpine:3.9
COPY scripts/*.sh /usr/local/bin/
COPY files/etc/ /etc/
RUN ["setup.sh", "v3.9" ]
USER buildozer
ENTRYPOINT [ "/bin/sh" ]
# buildozer abuild settings
PACKAGER="buildozer <alpine-infra@lists.alpinelinux.org>"
REPODEST="$HOME/drone/packages"
%wheel ALL=(ALL) NOPASSWD: ALL
#!/bin/sh
set -eu
readonly APORTSDIR=$HOME/drone/aports
readonly REPOS="main community testing"
readonly MIRROR=http://dl-cdn.alpinelinux.org/alpine
msg() {
local color=${2:-green}
case "$color" in
red) color="31";;
green) color="32";;
yellow) color="33";;
blue) color="34";;
*) color="32";;
esac
printf "\033[1;%sm>>>\033[1;0m %s\n" "$color" "$1" | xargs >&2
}
die() {
msg "$1" red
exit 1
}
get_release() {
local branch=$DRONE_COMMIT_BRANCH
case $branch in
*-stable) echo v${branch%-*};;
master) echo edge;;
*) die "Branch \"$branch\" not supported!"
esac
}
build_aport() {
local repo="$1" aport="$2"
cd "$APORTSDIR/$repo/$aport"
sudo chown buildozer .
abuild -r
}
changed_repos() {
local repo= range="$1"
cd "$APORTSDIR"
for repo in $REPOS; do
git diff --exit-code $range -- $repo >/dev/null \
|| echo "$repo"
done
}
get_commit_range() {
local pr=$DRONE_PULL_REQUEST
local repo=$DRONE_REPO
local token=$GH_TOKEN
local json=$(set +x; curl -H "Authorization: token $token" \
-fsL https://api.github.com/repos/$repo/pulls/$pr)
[ "$?" != 0 ] && die "Failed to fetch PR data"
local base_sha=$(echo "$json" | jq -r .base.sha)
local head_sha=$(echo "$json" | jq -r .head.sha)
printf "%s..%s\n" "$base_sha" "$head_sha"
}
set_repositories_for() {
local target_repo="$1" repos= repo=
local release=$(get_release)
for repo in $REPOS; do
repos="$repos $MIRROR/$release/$repo"
[ "$repo" = "$target_repo" ] && break
done
sudo sh -c "printf '%s\n' $repos > /etc/apk/repositories"
sudo apk update
}
changed_aports() {
cd "$APORTSDIR"
local repo="$1" range="$2"
local aports=$(git diff --name-only --diff-filter=ACMR --relative="$repo" \
$range -- "*/APKBUILD" | xargs -I% dirname %)
ap builddirs -d "$APORTSDIR/$repo" $aports 2>/dev/null | xargs -I% basename % | xargs
}
setup_system() {
sudo sh -c "echo $MIRROR/$(get_release)/main > /etc/apk/repositories"
sudo apk -U upgrade -a || apk fix || die "Failed to up/downgrade system"
abuild-keygen -ain
sudo sed -i 's/JOBS=[0-9]*/JOBS=$(nproc)/' /etc/abuild.conf
sudo install -do buildozer "$HOME"/drone/packages
}
sysinfo() {
printf ">>> Host system information (arch: %s, release: %s) <<<\n" "$(apk --print-arch)" "$(get_release)"
printf "- Number of Cores: %s\n" $(nproc)
printf "- Memory: %s Gb\n" $(awk '/^MemTotal/ {print ($2/1024/1024)}' /proc/meminfo)
printf "- Free space: %s\n" $(df -hP / | awk '/\/$/ {print $4}')
}
aport_ok=
aport_ng=
sysinfo || true
setup_system
commit_range=$(get_commit_range)
for repo in $(changed_repos "$commit_range"); do
set_repositories_for "$repo"
for pkgname in $(changed_aports "$repo" "$commit_range"); do
if build_aport "$repo" "$pkgname"; then
checkapk || true
aport_ok="$aport_ok $repo/$pkgname"
else
aport_ng="$aport_ng $repo/$pkgname"
fi
done
done
echo "### Build summary ###"
for ok in $aport_ok; do
msg "$ok: build succesfully"
done
if [ -n "$aport_ng" ]; then
die "Failed to build packages:$aport_ng"
elif [ -z "$aport_ok" ]; then
die "No packages found to be built."
fi
#!/bin/sh
set -eu
release=${1:-edge}
echo "http://dl-cdn.alpinelinux.org/alpine/$release/main" > /etc/apk/repositories
apk -U upgrade -a
apk add alpine-sdk lua-aports curl jq pigz
rm -rf /var/cache/apk/*
# use buildozer for building
adduser -D buildozer
adduser buildozer abuild
adduser buildozer wheel
# default distfiles location
install -d -g abuild -m 775 /var/cache/distfiles
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