diff --git a/debian_pkg_dirs b/debian_pkg_dirs new file mode 100644 index 0000000..c24cfab --- /dev/null +++ b/debian_pkg_dirs @@ -0,0 +1 @@ +registry-token-server diff --git a/registry-token-server/debian/deb_folder/changelog b/registry-token-server/debian/deb_folder/changelog new file mode 100644 index 0000000..9961286 --- /dev/null +++ b/registry-token-server/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +registry-token-server (1.0-1) unstable; urgency=medium + + * Initial release. + + -- Dan Voiculeasa Wed, 18 Aug 2021 14:41:40 -0400 diff --git a/registry-token-server/debian/deb_folder/control b/registry-token-server/debian/deb_folder/control new file mode 100644 index 0000000..c7143e5 --- /dev/null +++ b/registry-token-server/debian/deb_folder/control @@ -0,0 +1,17 @@ +Source: registry-token-server +Section: admin +Priority: optional +Maintainer: StarlingX Developers +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 diff --git a/registry-token-server/debian/deb_folder/copyright b/registry-token-server/debian/deb_folder/copyright new file mode 100644 index 0000000..754bf52 --- /dev/null +++ b/registry-token-server/debian/deb_folder/copyright @@ -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'. diff --git a/registry-token-server/debian/deb_folder/registry-token-server.docs b/registry-token-server/debian/deb_folder/registry-token-server.docs new file mode 100644 index 0000000..6b1d0bf --- /dev/null +++ b/registry-token-server/debian/deb_folder/registry-token-server.docs @@ -0,0 +1 @@ +LICENSE diff --git a/registry-token-server/debian/deb_folder/registry-token-server.install b/registry-token-server/debian/deb_folder/registry-token-server.install new file mode 100644 index 0000000..9f08ea0 --- /dev/null +++ b/registry-token-server/debian/deb_folder/registry-token-server.install @@ -0,0 +1 @@ +token_server.conf etc/registry-token-server/registry/ diff --git a/registry-token-server/debian/deb_folder/registry-token-server.lintian-overrides b/registry-token-server/debian/deb_folder/registry-token-server.lintian-overrides new file mode 100644 index 0000000..7662288 --- /dev/null +++ b/registry-token-server/debian/deb_folder/registry-token-server.lintian-overrides @@ -0,0 +1 @@ +no-manual-page diff --git a/registry-token-server/debian/deb_folder/registry-token-server.service b/registry-token-server/debian/deb_folder/registry-token-server.service new file mode 100644 index 0000000..477e85d --- /dev/null +++ b/registry-token-server/debian/deb_folder/registry-token-server.service @@ -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 diff --git a/registry-token-server/debian/deb_folder/rules b/registry-token-server/debian/deb_folder/rules new file mode 100755 index 0000000..288b2f9 --- /dev/null +++ b/registry-token-server/debian/deb_folder/rules @@ -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 diff --git a/registry-token-server/debian/deb_folder/source/format b/registry-token-server/debian/deb_folder/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/registry-token-server/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/registry-token-server/debian/dl_hook b/registry-token-server/debian/dl_hook new file mode 100755 index 0000000..73b336e --- /dev/null +++ b/registry-token-server/debian/dl_hook @@ -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 diff --git a/registry-token-server/debian/meta_data.yaml b/registry-token-server/debian/meta_data.yaml new file mode 100644 index 0000000..32e70ca --- /dev/null +++ b/registry-token-server/debian/meta_data.yaml @@ -0,0 +1,7 @@ +--- +debname: registry-token-server +debver: 1.0-1 +dl_hook: dl_hook +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true