Add debian package for registry-token-server

Keep the go dependencies instead of updating to Debian Bullseye
versions.
Did build-pkgs. Did build-iso.

StarlingX mirror needs to be mounted inside the build container.
Build tools don't have support for the mirror yet. The way
dl_hook is written is such that the StarlingX mirror is manually mounted
to /import/mirrors/.

Story: 2009101
Task: 43592
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: Ic312094647fe44801d1f8894a31b7f418fc8cf74
This commit is contained in:
Dan Voiculeasa 2021-10-01 13:39:03 +03:00 committed by Dan Voiculeasa
parent 87c4393414
commit b2601f2d3b
12 changed files with 167 additions and 0 deletions

1
debian_pkg_dirs Normal file
View File

@ -0,0 +1 @@
registry-token-server

View File

@ -0,0 +1,5 @@
registry-token-server (1.0-1) unstable; urgency=medium
* Initial release.
-- Dan Voiculeasa <dan.voiculeasa@windriver.com> Wed, 18 Aug 2021 14:41:40 -0400

View File

@ -0,0 +1,17 @@
Source: registry-token-server
Section: admin
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13),
dh-golang,
golang-any (>= 2:1.13~)
Standards-Version: 4.4.1
XS-Go-Import-Path: registry-token-server
Package: registry-token-server
Architecture: amd64
Multi-Arch: no
Depends: ${misc:Depends},
${shlibs:Depends}
Description: Token server
Token server for use with Docker registry with Openstack Keystone backend

View File

@ -0,0 +1,28 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: registry-token-server
Source: https://opendev.org/starlingx/containers
Files: *
Copyright: (c) 2018-2021 Wind River Systems, Inc
(c) 2019 Intel Corporation
License: Apache-2
Files: debian/*
Copyright: 2021 Wind River Systems, Inc
License: Apache-2
License: Apache-2
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
https://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian-based systems the full text of the Apache version 2.0 license
can be found in `/usr/share/common-licenses/Apache-2.0'.

View File

@ -0,0 +1 @@
LICENSE

View File

@ -0,0 +1 @@
token_server.conf etc/registry-token-server/registry/

View File

@ -0,0 +1 @@
no-manual-page

View File

@ -0,0 +1,19 @@
[Unit]
Description=v2 Registry token server for Docker
[Service]
Type=simple
EnvironmentFile=/etc/docker-distribution/registry/token_server.conf
ExecStart=/usr/bin/registry-token-server -addr=${REGISTRY_TOKEN_SERVER_ADDR} \
-issuer=${REGISTRY_TOKEN_SERVER_ISSUER} \
-endpoint=${REGISTRY_TOKEN_SERVER_KS_ENDPOINT} \
-tlscert=${REGISTRY_TOKEN_SERVER_TLSCERT} \
-tlskey=${REGISTRY_TOKEN_SERVER_TLSKEY} \
-realm=${REGISTRY_TOKEN_SERVER_REALM} \
-key=${REGISTRY_TOKEN_SERVER_KEY}
Restart=on-failure
ExecStartPost=/bin/bash -c 'echo $MAINPID > /var/run/registry-token-server.pid'
ExecStopPost=/bin/rm -f /var/run/registry-token-server.pid
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,31 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
export DH_VERBOSE = 1
export DH_GOLANG_GO_GENERATE := 1
%:
dh $@ --builddirectory=_build --buildsystem=golang --with=golang
override_dh_auto_build:
# Can't unpack in download hook step, because debian build system will mess the go build environment
gzip -dc Sirupsen-logrus-3d4380f53a34dcdc95f0c1db702615992b38d9a4.tar.gz | tar -xvvf -
gzip -dc docker-distribution-v2.7.1.tar.gz | tar -xvvf -
gzip -dc docker-libtrust-fa567046d9b14f6aa788882a950d69651d230b21.tar.gz | tar -xvvf -
gzip -dc gophercloud-gophercloud-aa00757ee3ab58e53520b6cb910ca0543116400a.tar.gz | tar -xvvf -
gzip -dc gorilla-mux-599cba5e7b6137d46ddf58fb1765f5d928e69604.tar.gz | tar -xvvf -
rm Sirupsen-logrus-3d4380f53a34dcdc95f0c1db702615992b38d9a4.tar.gz
rm docker-distribution-v2.7.1.tar.gz
rm docker-libtrust-fa567046d9b14f6aa788882a950d69651d230b21.tar.gz
rm gophercloud-gophercloud-aa00757ee3ab58e53520b6cb910ca0543116400a.tar.gz
rm gorilla-mux-599cba5e7b6137d46ddf58fb1765f5d928e69604.tar.gz
mkdir -p _build/src/github.com/gorilla/ && mv gorilla-mux _build/src/github.com/gorilla/mux
mkdir -p _build/src/github.com/docker/ && mv docker-distribution-2.7.1 _build/src/github.com/docker/distribution
mkdir -p _build/src/github.com/docker/ && mv docker-libtrust _build/src/github.com/docker/libtrust
mkdir -p _build/src/github.com/sirupsen/ && mv Sirupsen-logrus _build/src/github.com/sirupsen/logrus
mkdir -p _build/src/github.com/gophercloud && mv gophercloud-gophercloud _build/src/github.com/gophercloud/gophercloud
dh_auto_build

View File

@ -0,0 +1 @@
3.0 (quilt)

View File

@ -0,0 +1,55 @@
#!/bin/bash
set -x
pull_source() {
if [ "$1" = "" ] ; then
exit 1
fi
cp -r $1 ${PKG_BUILD_ROOT}/
}
############################################
### WORKAROUND until build tools support ###
############################################
STX_MIRROR=$(realpath "/import/mirrors/starlingx")
######################
### END WORKAROUND ###
######################
STX_BASE=$(realpath ${MY_REPO}/stx)
STX_SOURCES=$(realpath ${STX_BASE}/containers/registry-token-server)
SRC=$(realpath ${STX_BASE}/containers/registry-token-server/src)
EXTRA_FILE_SRC1=$(realpath ${STX_SOURCES}/centos/files/token_server.conf)
SUBMODULE_SRC1=$(realpath ${STX_MIRROR}/downloads/Sirupsen-logrus-3d4380f53a34dcdc95f0c1db702615992b38d9a4.tar.gz)
SUBMODULE_SRC2=$(realpath ${STX_MIRROR}/downloads/docker-distribution-v2.7.1.tar.gz)
SUBMODULE_SRC3=$(realpath ${STX_MIRROR}/downloads/docker-libtrust-fa567046d9b14f6aa788882a950d69651d230b21.tar.gz)
SUBMODULE_SRC4=$(realpath ${STX_MIRROR}/downloads/gophercloud-gophercloud-aa00757ee3ab58e53520b6cb910ca0543116400a.tar.gz)
SUBMODULE_SRC5=$(realpath ${STX_MIRROR}/downloads/gorilla-mux-599cba5e7b6137d46ddf58fb1765f5d928e69604.tar.gz)
PKG_BUILD_NAME=$1
PKG_BUILD_ROOT=$(realpath `pwd`/${PKG_BUILD_NAME})
mkdir ${PKG_BUILD_NAME}
pushd ${PKG_BUILD_NAME}
# Get main package sources
cp -r ${SRC}/* ${PKG_BUILD_ROOT}/
# Get extra files
pull_source ${EXTRA_FILE_SRC1}
# Get submodules
pull_source ${SUBMODULE_SRC1} && \
pull_source ${SUBMODULE_SRC2} && \
pull_source ${SUBMODULE_SRC3} && \
pull_source ${SUBMODULE_SRC4} && \
pull_source ${SUBMODULE_SRC5}
rc=$(echo $?)
if [ "${rc}" != "0" ] ; then
exit ${rc}
fi
# Workaround go install issue
# case-insensitive import collision: "github.com/sirupsen/logrus" and "github.com/Sirupsen/logrus"
# Before implementing the fix by transforming to lowercase Sirupsen, this needs to be tested CentOS side.
sed -i 's@github.com/Sirupsen/logrus@github.com/sirupsen/logrus@g' main.go

View File

@ -0,0 +1,7 @@
---
debname: registry-token-server
debver: 1.0-1
dl_hook: dl_hook
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true