Add debian publishing
Use brenard/debian-python-deb docker image to speedup pipeline
This commit is contained in:
parent
03668e7003
commit
bf37e6223e
2 changed files with 57 additions and 19 deletions
|
@ -5,11 +5,11 @@ clone:
|
|||
|
||||
pipeline:
|
||||
test:
|
||||
image: debian
|
||||
image: brenard/debian-python-deb
|
||||
commands:
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -qq update < /dev/null > /dev/null
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y -qq upgrade < /dev/null > /dev/null
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -qq -y install --no-install-recommends python3-all python3-dev python3-pip python3-venv build-essential pkg-config libsystemd-dev libldap2-dev libsasl2-dev libpq-dev libmariadb-dev wget unzip < /dev/null > /dev/null
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -qq -y install --no-install-recommends pkg-config libsystemd-dev libldap2-dev libsasl2-dev libpq-dev libmariadb-dev wget unzip < /dev/null > /dev/null
|
||||
- wget --no-verbose -O /opt/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip
|
||||
- unzip -qq -d /opt /opt/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip
|
||||
- echo /opt/instantclient_* > /etc/ld.so.conf.d/oracle-instantclient.conf
|
||||
|
@ -17,25 +17,26 @@ pipeline:
|
|||
- ./tests.sh --quiet
|
||||
|
||||
build:
|
||||
image: debian
|
||||
image: brenard/debian-python-deb
|
||||
when:
|
||||
event: tag
|
||||
commands:
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -qq update < /dev/null > /dev/null
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -y -qq upgrade < /dev/null > /dev/null
|
||||
- DEBIAN_FRONTEND=noninteractive apt-get -qq -y install --no-install-recommends git sed python3-all python3-dev python3-pip python3-venv dpkg-dev build-essential debhelper dh-python bash-completion lsb-release < /dev/null > /dev/null
|
||||
- echo "$GPG_KEY"|base64 -d|gpg --import
|
||||
- ./build.sh --quiet
|
||||
- rm -fr deb_dist/mylib-*
|
||||
secrets: [ maintainer_name, maintainer_email, gpg_key, debian_codename ]
|
||||
|
||||
publish-dryrun:
|
||||
image: debian
|
||||
group: publish
|
||||
image: alpine
|
||||
when:
|
||||
event: tag
|
||||
commands:
|
||||
- ls dist/*
|
||||
- ls deb_dist/*
|
||||
- ls deb_dist/*.deb
|
||||
|
||||
publish:
|
||||
publish-gitea:
|
||||
group: publish
|
||||
image: plugins/gitea-release
|
||||
when:
|
||||
event: tag
|
||||
|
@ -49,3 +50,23 @@ pipeline:
|
|||
checksum:
|
||||
- md5
|
||||
- sha512
|
||||
|
||||
publish-apt:
|
||||
group: publish
|
||||
image: brenard/curl
|
||||
when:
|
||||
event: tag
|
||||
commands:
|
||||
- curl -u $APT_CREDS -X POST -F file=@$( ls dist/python3-mylib_*_all.deb ) $APT_API_URL/files/python3-mylib
|
||||
- curl -u $APT_CREDS -X POST -F file=@$( ls dist/mylib_*.dsc ) $APT_API_URL/files/python3-mylib
|
||||
- curl -u $APT_CREDS -X POST -F file=@$( ls dist/mylib_*.orig.tar.gz ) $APT_API_URL/files/python3-mylib
|
||||
- curl -u $APT_CREDS -X POST -F file=@$( ls dist/mylib_*.debian.tar.xz ) $APT_API_URL/files/python3-mylib
|
||||
- curl -u $APT_CREDS -X POST -F file=@$( ls dist/mylib_*.buildinfo ) $APT_API_URL/files/python3-mylib
|
||||
- curl -u $APT_CREDS -X POST -F file=@$( ls dist/mylib_*.changes ) $APT_API_URL/files/python3-mylib
|
||||
- curl -u $APT_CREDS -X POST $APT_API_URL/repos/$APT_REPO_NAME/include/python3-mylib
|
||||
- APT_SNAP_NAME=$(date +%s)_$APT_REPO_NAME
|
||||
- >
|
||||
curl -u $APT_CREDS -X POST -H 'Content-Type: application/json' --data "{\"Name\":\"$APT_SNAP_NAME\"}" $APT_API_URL/repos/$APT_REPO_NAME/snapshots
|
||||
- >
|
||||
curl -u $APT_CREDS -X PUT -H 'Content-Type: application/json' --data "{\"Snapshots\": [{\"Component\": \"main\", \"Name\": \"$APT_SNAP_NAME\"}]}" $APT_API_URL/publish/:./$APT_REPO_NAME
|
||||
secrets: [ apt_api_url, apt_creds, apt_repo_name ]
|
||||
|
|
37
build.sh
37
build.sh
|
@ -28,7 +28,7 @@ else
|
|||
fi
|
||||
|
||||
echo "Install dependencies in virtualenv using pip..."
|
||||
$VENV/bin/python3 -m pip install stdeb GitPython wheel $QUIET_ARG
|
||||
$VENV/bin/python3 -m pip install stdeb wheel $QUIET_ARG
|
||||
|
||||
echo "Build wheel package..."
|
||||
$VENV/bin/python3 setup.py bdist_wheel
|
||||
|
@ -41,7 +41,9 @@ then
|
|||
TMP_GITDCH=$(mktemp -d)
|
||||
echo "Temporary install gitdch in $TMP_GITDCH..."
|
||||
git clone $QUIET_ARG https://gitea.zionetrix.net/bn8/gitdch.git $TMP_GITDCH/gitdch
|
||||
GITDCH=$TMP_GITDCH/gitdch/gitdch
|
||||
GITDCH="$VENV/bin/python3 $TMP_GITDCH/gitdch/gitdch"
|
||||
echo "Install gitdch dependencies in $VENV..."
|
||||
$VENV/bin/python3 -m pip install GitPython $QUIET_ARG
|
||||
else
|
||||
TMP_GITDCH=""
|
||||
echo "Use existing installation of gitdch ($GITDCH)"
|
||||
|
@ -61,20 +63,35 @@ find deb_dist/ -maxdepth 1 -type f ! -name '*.orig.tar.gz' -delete
|
|||
echo "Enter in debian package directory..."
|
||||
cd deb_dist/mylib-$VERSION
|
||||
|
||||
echo "Retreive debian codename using lsb_release..."
|
||||
DEBIAN_CODENAME=$( lsb_release -c -s )
|
||||
[ $( lsb_release -r -s ) -ge 9 ] && DEBIAN_CODENAME="${DEBIAN_CODENAME}-ee"
|
||||
if [ -z "$DEBIAN_CODENAME" ]
|
||||
then
|
||||
echo "Retreive debian codename using lsb_release..."
|
||||
DEBIAN_CODENAME=$( lsb_release -c -s )
|
||||
[ $( lsb_release -r -s ) -ge 9 ] && DEBIAN_CODENAME="${DEBIAN_CODENAME}-ee"
|
||||
else
|
||||
echo "Use debian codename from environment ($DEBIAN_CODENAME)"
|
||||
fi
|
||||
|
||||
echo "Generate debian changelog using gitdch..."
|
||||
GITDCH_LOG_ARG='--verbose'
|
||||
[ -n "$QUIET_ARG" ] && GITDCH_LOG_ARG='--warning'
|
||||
$VENV/bin/python3 $GITDCH \
|
||||
GITDCH_ARGS='--verbose'
|
||||
[ -n "$QUIET_ARG" ] && GITDCH_ARGS='--warning'
|
||||
if [ -n "$MAINTAINER_NAME" ]
|
||||
then
|
||||
echo "Use maintainer name from environment ($MAINTAINER_NAME)"
|
||||
GITDCH_ARGS="$GITDCH_ARGS --maintainer-name '$MAINTAINER_NAME'"
|
||||
fi
|
||||
if [ -n "$MAINTAINER_EMAIL" ]
|
||||
then
|
||||
echo "Use maintainer email from environment ($MAINTAINER_EMAIL)"
|
||||
GITDCH_ARGS="$GITDCH_ARGS --maintainer-email '$MAINTAINER_EMAIL'"
|
||||
fi
|
||||
$GITDCH \
|
||||
--package-name mylib \
|
||||
--version "${VERSION}" \
|
||||
--code-name $DEBIAN_CODENAME \
|
||||
--output debian/changelog \
|
||||
--path ../../ \
|
||||
$GITDCH_LOG_ARG
|
||||
$GITDCH_ARGS
|
||||
|
||||
echo "Add custom package name for dependencies..."
|
||||
cat << EOF > debian/py3dist-overrides
|
||||
|
@ -86,4 +103,4 @@ EOF
|
|||
[ -n "$TMP_GITDCH" ] && echo "Clean temporary gitdch installation..." && rm -fr $TMP_GITDCH
|
||||
|
||||
echo "Build debian package..."
|
||||
dpkg-buildpackage --no-sign
|
||||
dpkg-buildpackage
|
||||
|
|
Loading…
Reference in a new issue