Try to build :latest using docker-dind
This commit is contained in:
parent
c3013e3944
commit
5aa1e4efcb
35
.woodpecker/build.yaml
Normal file
35
.woodpecker/build.yaml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
matrix:
|
||||||
|
platform:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
|
||||||
|
labels:
|
||||||
|
platform: ${platform}
|
||||||
|
|
||||||
|
when:
|
||||||
|
branch: main
|
||||||
|
event: [push, pull_request, tag]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
test-build:
|
||||||
|
image: docker:27-dind
|
||||||
|
commands:
|
||||||
|
- docker build -t source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-${platform} .
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
when:
|
||||||
|
event: pull_request
|
||||||
|
|
||||||
|
build-to-registry:
|
||||||
|
image: docker:27-dind
|
||||||
|
environment:
|
||||||
|
CI_USER_PASSWORD:
|
||||||
|
from_secret: registry_token
|
||||||
|
commands:
|
||||||
|
- docker login -u ${CI_REPO_OWNER} -p $${CI_USER_PASSWORD} source.hodakov.me
|
||||||
|
- docker build -t source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-${platform} .
|
||||||
|
- docker push source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-${platform}
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
when:
|
||||||
|
event: [push, tag]
|
@ -1,40 +0,0 @@
|
|||||||
matrix:
|
|
||||||
platform:
|
|
||||||
- linux/amd64
|
|
||||||
- linux/arm64
|
|
||||||
|
|
||||||
labels:
|
|
||||||
platform: ${platform}
|
|
||||||
|
|
||||||
when:
|
|
||||||
branch: main
|
|
||||||
event: [push, pull_request, tag]
|
|
||||||
|
|
||||||
variables:
|
|
||||||
- &repo source.hodakov.me/${CI_REPO_OWNER}/phpbb
|
|
||||||
|
|
||||||
steps:
|
|
||||||
test-build:
|
|
||||||
image: woodpeckerci/plugin-docker-buildx:5.1.0
|
|
||||||
privileged: true
|
|
||||||
settings:
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
dry_run: true
|
|
||||||
repo: *repo
|
|
||||||
auto_tag: true
|
|
||||||
when:
|
|
||||||
event: pull_request
|
|
||||||
|
|
||||||
publish:
|
|
||||||
image: woodpeckerci/plugin-docker-buildx:5.1.0
|
|
||||||
privileged: true
|
|
||||||
settings:
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
repo: *repo
|
|
||||||
registry: source.hodakov.me
|
|
||||||
auto_tag: true
|
|
||||||
username: ${CI_REPO_OWNER}
|
|
||||||
password:
|
|
||||||
from_secret: registry_token
|
|
||||||
when:
|
|
||||||
event: [push, tag]
|
|
17
.woodpecker/tag.yaml
Normal file
17
.woodpecker/tag.yaml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
when:
|
||||||
|
branch: main
|
||||||
|
event: [push, tag]
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- build
|
||||||
|
|
||||||
|
steps:
|
||||||
|
tag:
|
||||||
|
image: docker:27-dind
|
||||||
|
commands:
|
||||||
|
- docker pull source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-amd64
|
||||||
|
- docker pull source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-arm64
|
||||||
|
- docker manifest create source.hodakov.me/hdkv/phpbb:latest source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-amd64 source.hodakov.me/hdkv/phpbb:${CI_COMMIT_SHA:0:10}-arm64
|
||||||
|
- docker manifest push source.hodakov.me/hdkv/phpbb:latest
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
83
scripts/semver.sh
Executable file
83
scripts/semver.sh
Executable file
@ -0,0 +1,83 @@
|
|||||||
|
#!/bin/bash -eu
|
||||||
|
|
||||||
|
# This script prints out git metadata information for a given commit (or head by default)
|
||||||
|
# It assumes tags of the form `v1.2.3`, and will print prerelease versions when
|
||||||
|
# not on an exact tag.
|
||||||
|
#
|
||||||
|
# It is intended to be used like so:
|
||||||
|
#
|
||||||
|
# cd <some-git-repo>
|
||||||
|
# $(../semver-from-git.sh)
|
||||||
|
#
|
||||||
|
# or
|
||||||
|
#
|
||||||
|
# $(../semver-from-git.sh <COMMIT_HASH>)
|
||||||
|
#
|
||||||
|
# For prerelease, it prints:
|
||||||
|
#
|
||||||
|
# export GIT_BRANCH="master"
|
||||||
|
# export GIT_SEMVER_FROM_TAG="1.0.1-master+3.ge675710"
|
||||||
|
#
|
||||||
|
# where GIT_BRANCH is the first branch it finds with the given commit, and the version string is:
|
||||||
|
# <MAJOR>.<MINOR>.<PATCH>-<BRANCH>+<COMMITS-SINCE-TAG>.<COMMIT_HASH>
|
||||||
|
#
|
||||||
|
# When on an exact tag, it prints:
|
||||||
|
#
|
||||||
|
# export GIT_BRANCH="master"
|
||||||
|
# export GIT_EXACT_TAG=v1.0.2
|
||||||
|
# export GIT_SEMVER_FROM_TAG=1.0.2
|
||||||
|
#
|
||||||
|
# When the working tree is dirty, it will also put ".SNAPSHOT.<HOSTNAME>" on the end of the version
|
||||||
|
# This is useful if someone has deployed something from their local machine.
|
||||||
|
|
||||||
|
# (C) Timothy Jones, 2019, released under BSD License 2.0 (3-clause BSD license)
|
||||||
|
# https://github.com/TimothyJones
|
||||||
|
|
||||||
|
if [ -z "${1:-}" ]; then
|
||||||
|
COMMIT="HEAD"
|
||||||
|
|
||||||
|
# Test whether the working tree is dirty or not
|
||||||
|
if [ -z "$(git status -s)" ]; then
|
||||||
|
STATUS=""
|
||||||
|
else
|
||||||
|
STATUS=".SNAPSHOT.$(hostname -s)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
COMMIT="$1"
|
||||||
|
STATUS="" # When looking at an exact commit, the working tree is irrelevant
|
||||||
|
fi
|
||||||
|
|
||||||
|
DESCRIBE=$(git describe --always --tags "$COMMIT")
|
||||||
|
VERSION=$(echo "$DESCRIBE" | sed 's/\(.*\)-\(.*\)-g\(.*\)/\1+\2.\3/' | sed 's/v\(.*\)/\1/')
|
||||||
|
BRANCH=$(git branch --contains "$COMMIT" | grep -e "^\*" | sed 's/^\* //')
|
||||||
|
|
||||||
|
echo "export GIT_BRANCH=$BRANCH"
|
||||||
|
export GIT_BRANCH=$BRANCH
|
||||||
|
|
||||||
|
EXACT_TAG=$(git describe --always --exact-match --tags "$COMMIT" 2> /dev/null || true)
|
||||||
|
if [ ! -z "$EXACT_TAG" ] ; then
|
||||||
|
echo "export GIT_EXACT_TAG=${EXACT_TAG}"
|
||||||
|
echo "export GIT_SEMVER_FROM_TAG=$VERSION$STATUS"
|
||||||
|
export GIT_EXACT_TAG=${EXACT_TAG}
|
||||||
|
export GIT_SEMVER_FROM_TAG=$VERSION$STATUS
|
||||||
|
else
|
||||||
|
# We split up the prefix and suffix so that we don't accidentally
|
||||||
|
# give sed commands via the branch name
|
||||||
|
PREFIX="$(echo "$VERSION" | sed 's/\(.*\)\(\+.*\)/\1/')"
|
||||||
|
SUFFIX="$(echo "$VERSION" | sed 's/\(.*\)\(\+.*\)/\2/')"
|
||||||
|
if [ -z $(echo "$PREFIX" | grep "-") ]; then
|
||||||
|
echo "export GIT_SEMVER_FROM_TAG=$PREFIX-$BRANCH""$SUFFIX$STATUS"
|
||||||
|
export GIT_SEMVER_FROM_TAG=$PREFIX-$BRANCH""$SUFFIX$STATUS
|
||||||
|
else
|
||||||
|
echo "export GIT_SEMVER_FROM_TAG=$PREFIX.$BRANCH""$SUFFIX$STATUS"
|
||||||
|
export GIT_SEMVER_FROM_TAG=$PREFIX.$BRANCH""$SUFFIX$STATUS
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
### Add docker tags
|
||||||
|
echo "export DOCKER_EXACT_TAG=${GIT_EXACT_TAG/v}"
|
||||||
|
export DOCKER_EXACT_TAG=${GIT_EXACT_TAG/v}
|
||||||
|
echo "export DOCKER_MAJOR_TAG=${DOCKER_EXACT_TAG%.*.*}"
|
||||||
|
export DOCKER_MAJOR_TAG=${DOCKER_EXACT_TAG%.*.*}
|
||||||
|
echo "export DOCKER_MINOR_TAG=${DOCKER_EXACT_TAG%.*}"
|
||||||
|
export DOCKER_MINOR_TAG=${DOCKER_EXACT_TAG%.*}
|
Loading…
Reference in New Issue
Block a user