Browse Source

stx tool: control: Add the support of control module

Implement the stx control module so that the developer could
manage the four containers with the 'stx control xxx' command.
Containers: (stx-builder|stx-pkgbuilder|stx-lat-tool|stx-repomgr)

Now we assume that we have a minikube env to be ready for this
module, we can use it directly. For the minikube env installation
we can build it with the stx-init-env script later.

Now support the action: [status|start|stop|enter|upgrade]

stx control status:  Check status of the containers
stx control start:   Boot the containers up
stx control stop:    Shutdown the containers
stx control enter:   Login the container(default builder)
stx control upgrade: Upgrade the containers

This module will be used after the developer have a minikube env,

Please refer to the more help information with the command
'stx control --help'

Story: 2008862
Task: 42514

Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
Change-Id: I0c25e0f784671e90c56d5d367b12a27c3f3fa7cf
changes/40/807840/7
Zhixiong Chi 5 months ago
parent
commit
8bcee26f1a
  1. 15
      .yamllint
  2. 23
      stx-init-env
  3. 32
      stx.conf
  4. 98
      stx/lib/stx/command.py
  5. 264
      stx/lib/stx/stx_control.py
  6. 75
      stx/lib/stx/stx_main.py
  7. 23
      stx/stx-build-tools-chart/stx-builder/.helmignore
  8. 35
      stx/stx-build-tools-chart/stx-builder/Chart.yaml
  9. 47
      stx/stx-build-tools-chart/stx-builder/configmap/localrc.sample
  10. 14
      stx/stx-build-tools-chart/stx-builder/configmap/stx-cleanup
  11. 32
      stx/stx-build-tools-chart/stx-builder/configmap/stx-deb.list
  12. 21
      stx/stx-build-tools-chart/stx-builder/configmap/stx-dsc.list
  13. 54
      stx/stx-build-tools-chart/stx-builder/configmap/stx-prepare-build
  14. 4
      stx/stx-build-tools-chart/stx-builder/configmap/stx-sources.list
  15. 25
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-aptly/stx-repomgr/Chart.yaml
  16. 62
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-aptly/stx-repomgr/templates/_helpers.tpl
  17. 60
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-aptly/stx-repomgr/templates/deployment.yaml
  18. 20
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-aptly/stx-repomgr/templates/service.yaml
  19. 71
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-aptly/stx-repomgr/values.yaml
  20. 23
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-lat-tool/.helmignore
  21. 24
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-lat-tool/Chart.yaml
  22. 63
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-lat-tool/templates/_helpers.tpl
  23. 60
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-lat-tool/templates/deployment.yaml
  24. 64
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-lat-tool/values.yaml
  25. 24
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pkgbuilder/Chart.yaml
  26. 63
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pkgbuilder/templates/_helpers.tpl
  27. 7
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pkgbuilder/templates/configmap.yaml
  28. 65
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pkgbuilder/templates/deployment.yaml
  29. 16
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pkgbuilder/templates/service.yaml
  30. 73
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pkgbuilder/values.yaml
  31. 24
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pulp/stx-repomgr/Chart.yaml
  32. 3
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pulp/stx-repomgr/configmap/changepasswd
  33. 4
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pulp/stx-repomgr/configmap/settings.py
  34. 63
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pulp/stx-repomgr/templates/_helpers.tpl
  35. 7
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pulp/stx-repomgr/templates/configmap.yaml
  36. 75
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pulp/stx-repomgr/templates/deployment.yaml
  37. 16
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pulp/stx-repomgr/templates/service.yaml
  38. 81
      stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pulp/stx-repomgr/values.yaml
  39. 52
      stx/stx-build-tools-chart/stx-builder/templates/_helpers.tpl
  40. 7
      stx/stx-build-tools-chart/stx-builder/templates/configmap.yaml
  41. 65
      stx/stx-build-tools-chart/stx-builder/templates/deployment.yaml
  42. 67
      stx/stx-build-tools-chart/stx-builder/values.yaml
  43. 1
      test-requirements.txt
  44. 7
      tox.ini

15
.yamllint

@ -0,0 +1,15 @@
---
extends: default
rules:
# 80 chars should be enough, but don't fail if a line is longer
line-length:
max: 200
level: warning
braces:
min-spaces-inside: 0
max-spaces-inside: 2
indentation:
spaces: consistent
indent-sequences: whatever
check-multi-line-strings: false

23
stx-init-env

@ -1,2 +1,25 @@
#!/bin/bash
if [ -z "$MINIKUBE_HOME" ];then
MINIKUBE_HOME=$HOME
else
if [ ! -d "$MINIKUBE_HOME" ]; then
echo "The directory defined by \$MINIKUBE_HOME doesn't exist"
return 1
fi
fi
FSTYPE=$(stat -f -L -c %T $MINIKUBE_HOME)
if [ x"$FSTYPE" == x"nfs" ]; then
echo ""
echo "Warning: stx minikube doesn't allow \$MINIKUBE_HOME or \$HOME directory as nfs mount point!!!"
echo " Please set non-nfs MINIKUBE_HOME with the command 'export MINIKUBE_HOME=XXX/YYY'"
echo ""
unset MINIKUBE_HOME
return 1
fi
export PRJDIR=$(pwd)
export PATH=$PRJDIR/stx/bin:$PATH
export MINIKUBENAME=minikube-$USER-upstream
export KUBECONFIG=$MINIKUBE_HOME/.kube/config

32
stx.conf

@ -1,14 +1,36 @@
[user]
name =
project =
[project]
name = stx
gituser = STX Builder
gitemail = stx.builder@opendev.org
proxy = false
proxyserver = opendev.org
proxyport = 8080
[builder]
uid = 1000
myuname = builder
release = 6.0
dist = bullseye
stx_dist = .stx
debfullname = STX Builder
debemail = stx.builder@opendev.org
[pkgbuilder]
mode = local
[repomgr]
name = aptly
type = aptly
cengnurl =
sourceslist =
deblist =
dsclist =
[aptly]
mode = local
[pulp]
mode = local
[default]
project = stx-build
name = stx

98
stx/lib/stx/command.py

@ -0,0 +1,98 @@
# Copyright (c) 2021 Wind River Systems, Inc.
#
# 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
#
# http://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.
import logging
import os
from stx import utils # pylint: disable=E0611
import subprocess
import sys
logger = logging.getLogger('STX-Command')
utils.set_logger(logger)
def check_prjdir_env():
prjdir_value = os.getenv('PRJDIR', '')
if not prjdir_value:
logger.warning('Please source the file stx-init-env to export the \
PRJDIR variable.')
logger.warning('If the minikube had already started, please source \
the file import-stx instead.')
sys.exit(0)
def get_pods_info():
'''Get all pods information of the stx building tools.'''
cmd = 'minikube -p $MINIKUBENAME kubectl -- get pods '
logger.info('stx-tools pods list:')
subprocess.check_call(cmd, shell=True)
def get_deployment_info():
'''Get all deployment information of the stx building tools.'''
cmd = 'minikube -p $MINIKUBENAME kubectl -- get deployment'
logger.info('stx-tools deployments list:')
subprocess.check_call(cmd, shell=True)
def get_helm_info():
'''Get the helm list information of the stx building tools.'''
cmd = 'helm ls'
logger.info('helm list:\n')
subprocess.check_call(cmd, shell=True)
def get_pod_name(dockername):
'''get the detailed pod name from the four pods.'''
cmd = 'minikube -p $MINIKUBENAME kubectl -- get pods | grep Running| \
grep stx-' + dockername + ' | awk \'{print $1}\' '
output = subprocess.check_output(cmd, shell=True)
podname = str(output.decode('utf8').strip())
return podname
def helm_release_exists(projectname):
'''Check if the helm release exists'''
cmd = 'helm ls | grep ' + projectname
ret = subprocess.getoutput(cmd)
if ret:
return True
else:
return False
def generatePrefixCommand(podname, command, enableuser):
'''Generate the command executed in the host'''
prefix_exec_cmd = 'minikube -p $MINIKUBENAME kubectl -- exec -ti '
builder_exec_cmd = prefix_exec_cmd + podname
prefix_bash_cmd = ' -- bash -l -c '
prefix_bash_with_user_cmd = ' -- bash -l -c \'sudo -u ${MYUNAME} bash \
--rcfile /home/$MYUNAME/userenv -i -c '
builder_exec_bash_cmd = builder_exec_cmd + prefix_bash_cmd
builder_exec_bash_with_user_cmd = builder_exec_cmd + \
prefix_bash_with_user_cmd
if enableuser:
cmd = builder_exec_bash_with_user_cmd + command
else:
cmd = builder_exec_bash_cmd + command
return cmd

264
stx/lib/stx/stx_control.py

@ -0,0 +1,264 @@
#!/usr/bin/env python3
#
# Copyright (c) 2021 Wind River Systems, Inc.
#
# 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
#
# http://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.
import getpass
import logging
import os
import subprocess
import sys
import time
from stx import command # pylint: disable=E0611
from stx import helper # pylint: disable=E0611
from stx import stx_configparser # pylint: disable=E0611
from stx import utils # pylint: disable=E0611
helmchartdir = 'stx/stx-build-tools-chart/stx-builder'
class HandleControlTask:
'''Handle the task for the control sub-command'''
def __init__(self):
self.stxconfig = stx_configparser.STXConfigParser()
self.projectname = self.stxconfig.getConfig('project', 'name')
self.helm_status = command.helm_release_exists(self.projectname)
self.logger = logging.getLogger('STX-Control')
utils.set_logger(self.logger)
def configurePulp(self):
'''Initial the password of the pulp service.'''
# wait three times when the pulp service is not initialized yet.
count = 3
remote_cmd = ' -- bash /etc/pulp/changepasswd'
pulpname = ' stx-pulp'
while count:
podname = command.get_pod_name(pulpname)
if podname:
cmd = 'minikube -p $MINIKUBENAME kubectl -- exec -ti '
cmd = cmd + podname + remote_cmd
subprocess.call(cmd, shell=True)
count = 0
else:
self.logger.info('Waiting for pulp to finish the setup...')
time.sleep(60)
count = count - 1
if count == 0:
self.logger.error('Pulp service initialization failed.\n')
sys.exit(1)
def finish_configure(self):
'''Before starting, we need to finish the setup'''
projectname = self.stxconfig.getConfig('project', 'name')
builder_uid = self.stxconfig.getConfig('builder', 'uid')
builder_myuname = self.stxconfig.getConfig('builder', 'myuname')
builder_release = self.stxconfig.getConfig('builder', 'release')
builder_dist = self.stxconfig.getConfig('builder', 'dist')
builder_stx_dist = self.stxconfig.getConfig('builder', 'stx_dist')
builder_debfullname = self.stxconfig.getConfig('builder',
'debfullname')
builder_debemail = self.stxconfig.getConfig('builder', 'debemail')
repomgr_type = self.stxconfig.getConfig('repomgr', 'type')
gituser = self.stxconfig.getConfig('project', 'gituser')
gitemail = self.stxconfig.getConfig('project', 'gitemail')
proxy = self.stxconfig.getConfig('project', 'proxy')
proxyserver = self.stxconfig.getConfig('project', 'proxyserver')
proxyport = self.stxconfig.getConfig('project', 'proxyport')
cengnurl = self.stxconfig.getConfig('repomgr', 'cengnurl')
sourceslist = self.stxconfig.getConfig('repomgr', 'sourceslist')
deblist = self.stxconfig.getConfig('repomgr', 'deblist')
dsclist = self.stxconfig.getConfig('repomgr', 'dsclist')
if sourceslist:
if not (deblist or dsclist):
self.logger.warning('*************************************\
*********************************')
self.logger.warning('Either Deblist or Dsclist must exist \
when sourceslist is enabled!!!')
self.logger.warning('*************************************\
*********************************')
sys.exit(1)
repomgr_type = self.stxconfig.getConfig('repomgr', 'type')
if repomgr_type not in ('aptly', 'pulp'):
self.logger.warning('Repomgr type only supports [aptly] or [pulp],\
please modify the value with config command!!!')
sys.exit(1)
builder_chartfile = os.path.join(os.environ['PRJDIR'],
helmchartdir, 'Chart.yaml')
cmd = 'sed -i -e "s:aptly:%s:g" %s' % (repomgr_type, builder_chartfile)
self.logger.debug('Write the repomgr type [%s] to the chart file \
with the command [%s]', repomgr_type, cmd)
# Fix Me:
# Now we always use aptly as the repomgr.
# Don't switch to pulp, since it will trigger the sshd block issue.
# Later if we find the root cause and fix it, we will enable the
# following function.
# os.system(cmd)
builderhelmchartdir = os.path.join(os.environ['PRJDIR'], helmchartdir)
configmap_dir = os.path.join(builderhelmchartdir, 'configmap/')
self.logger.debug('builder localrc file is located at %s',
configmap_dir)
pkgbuilder_configmap_dir = os.path.join(builderhelmchartdir,
'dependency_chart/\
stx-pkgbuilder/configmap/')
self.logger.debug('pkgbuilder localrc file is located at %s',
pkgbuilder_configmap_dir)
if not os.path.exists(pkgbuilder_configmap_dir):
os.mkdir(pkgbuilder_configmap_dir)
localrcsample = os.path.join(configmap_dir, 'localrc.sample')
localrc = os.path.join(configmap_dir, 'stx-localrc')
if os.path.exists(localrc):
os.remove(localrc)
hostusername = getpass.getuser()
with open(localrcsample, "r") as rf:
message = ''
for line in rf:
line = line.replace("@PROJECT@", projectname)
line = line.replace("@MYUID@", builder_uid)
line = line.replace("@MYUNAME@", builder_myuname)
line = line.replace("@MY_RELEASE@", builder_release)
line = line.replace("@DIST@", builder_dist)
line = line.replace("@STX_DIST@", builder_stx_dist)
line = line.replace("@DEBFULLNAME@", builder_debfullname)
line = line.replace("@DEBEMAIL@", builder_debemail)
line = line.replace("@REPOMGR_TYPE@", repomgr_type)
line = line.replace("@GITUSER@", gituser)
line = line.replace("@GITEMAIL@", gitemail)
line = line.replace("@PROXY@", proxy)
line = line.replace("@PROXYSERVER@", proxyserver)
line = line.replace("@PROXYPORT@", proxyport)
line = line.replace("@HOSTUSERNAME@", hostusername)
line = line.replace("@CENGNURL@", cengnurl)
if sourceslist:
line = line.replace("@fetch@", "true")
line = line.replace("@SOURCESLIST@", sourceslist)
line = line.replace("@DEBLIST@", deblist)
line = line.replace("@DSCLIST@", dsclist)
message += line
with open(localrc, "w") as wf:
wf.write(message)
# Copy stx-localrc file of builder container to pkgbuilder
cmd = 'cp -f %s %s' % (localrc, pkgbuilder_configmap_dir)
os.system(cmd)
# Update the dependency charts
cmd = 'helm dependency update ' + helmchartdir
self.logger.debug('Dependency build command: %s', cmd)
subprocess.call(cmd, shell=True)
return repomgr_type
def handleStartTask(self, helmstatus, projectname):
cmd = 'helm install ' + projectname + ' ' + helmchartdir
self.logger.debug('Execute the helm start command: %s', cmd)
if helmstatus:
self.logger.error('The helm release %s already exists.',
projectname)
sys.exit(1)
else:
repomgr_type = self.finish_configure()
subprocess.check_call(cmd, shell=True, cwd=os.environ['PRJDIR'])
if repomgr_type == 'pulp':
self.configurePulp()
def handleStopTask(self, helmstatus, projectname):
if helmstatus:
cmd = 'helm uninstall ' + projectname
self.logger.debug('Execute the helm stop command: %s', cmd)
subprocess.check_call(cmd, shell=True)
else:
self.logger.error('The helm release %s does not exist.',
projectname)
sys.exit(1)
def handleUpgradeTask(self, helmstatus, projectname):
command.check_prjdir_env()
self.finish_configure()
if helmstatus:
cmd = 'helm upgrade ' + projectname + ' ' + helmchartdir
self.logger.debug('Execute the upgrade command: %s', cmd)
subprocess.call(cmd, shell=True, cwd=os.environ['PRJDIR'])
else:
self.logger.error('The helm release %s does not exist.',
projectname)
sys.exit(1)
def handleEnterTask(self, args):
default_docker = 'builder'
container_list = ['builder', 'pkgbuilder', 'repomgr', 'lat']
prefix_exec_cmd = 'minikube -p $MINIKUBENAME kubectl -- exec -ti '
if args.dockername:
if args.dockername not in container_list:
self.logger.error('Please input the correct docker name \
argument. eg: %s \n', container_list)
sys.exit(1)
default_docker = args.dockername
podname = command.get_pod_name(default_docker)
if podname:
if default_docker == 'builder':
cmd = prefix_exec_cmd + podname
cmd = cmd + ' -- bash -l -c \'sudo -u ${MYUNAME} bash \
--rcfile /home/$MYUNAME/userenv\''
else:
cmd = prefix_exec_cmd + podname + ' -- bash'
self.logger.debug('Execute the enter command: %s', cmd)
subprocess.call(cmd, shell=True)
else:
self.logger.error('Please ensure the docker container you want to \
enter has been started!!!\n')
sys.exit(1)
def handleControl(self, args):
self.logger.setLevel(args.loglevel)
projectname = self.stxconfig.getConfig('project', 'name')
if not projectname:
projectname = 'stx'
if args.ctl_task == 'start':
self.handleStartTask(self.helm_status, projectname)
elif args.ctl_task == 'stop':
self.handleStopTask(self.helm_status, projectname)
elif args.ctl_task == 'upgrade':
self.handleUpgradeTask(self.helm_status, projectname)
elif args.ctl_task == 'enter':
self.handleEnterTask(args)
elif args.ctl_task == 'status':
command.get_helm_info()
command.get_deployment_info()
command.get_pods_info()
else:
self.logger.error('Control module doesn\'t support your \
subcommand: [%s].\n', args.ctl_task)
print(helper.help_control())

75
stx/lib/stx/stx_main.py

@ -1,4 +1,3 @@
#
# Copyright (c) 2021 Wind River Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -16,10 +15,11 @@
import argparse
import logging
from stx import command # pylint: disable=E0611
from stx import stx_configparser # pylint: disable=E0611
from stx import stx_control # pylint: disable=E0611
from stx import utils # pylint: disable=E0611
logger = logging.getLogger('STX')
utils.set_logger(logger)
@ -32,7 +32,9 @@ class CommandLine:
'''Handles parsing the commandline parameters for stx tool'''
def __init__(self):
command.check_prjdir_env()
self.handleconfig = stx_configparser.HandleConfigTask()
self.handlecontrol = stx_control.HandleControlTask()
self.parser = self.parseCommandLine()
def parseCommandLine(self):
@ -43,25 +45,65 @@ class CommandLine:
epilog='''Tips:
Use %(prog)s --help to get help for all of parameters\n\n''')
subparsers = parser.add_subparsers(title='Builtin Commands:', help='sub-command for stx\n\n')
config_subparser = subparsers.add_parser('config', help='Change stx configuration settings. eg: [--show|--get|--add|--unset|--remove-section]')
config_subparser.add_argument('--show', help='Show all the content of the config file\n\n', action='store_true')
config_subparser.add_argument('--add', help='Add the setting section.key and the value into the config file.\n\n', nargs=2, required=False)
config_subparser.add_argument('--get', help='Get the value of the section.key from the config file.\n\n', nargs=1, required=False)
config_subparser.add_argument('--unset', help='Remove value of the section.key from the config file.\n\n', nargs=1, required=False)
config_subparser.add_argument('--removesection', help='Remove the section from the config file.\n\n', nargs=1, required=False)
subparsers = parser.add_subparsers(title='Builtin Commands:',
help='sub-command for stx\n\n')
control_subparser = subparsers.add_parser('control',
help='Execute the control \
task.\t\teg: [start|enter|stop|status|upgrade]')
control_subparser.add_argument('ctl_task',
help='[ start|stop|enter|status|upgrade\
]: Create or Stop or Enter or List or \
Upgrade the stx-builder/obs/lat/pulp \
containers.\n\n')
control_subparser.add_argument('--dockername',
help='[ builder|pkgbuilder|repomgr|lat \
], the four dockers you can enter, if \
there is no this argument for enter \
task, default enter the stx-builder \
container\n\n', required=False)
control_subparser.set_defaults(handle=self.handlecontrol.handleControl)
config_subparser = subparsers.add_parser('config',
help='Change stx config \
settings.\t\teg: [ --show|--get|--add|--unset|--remove-section ]')
config_subparser.add_argument('--show',
help='Show all the content of the config\
file\n\n', action='store_true')
config_subparser.add_argument('--add',
help='Add the setting section.key and \
value into the config file.\n\n',
nargs=2, required=False)
config_subparser.add_argument('--get',
help='Get the value of the section.key \
from the config file.\n\n', nargs=1,
required=False)
config_subparser.add_argument('--unset',
help='Remove value of the section.key \
from the config file.\n\n', nargs=1,
required=False)
config_subparser.add_argument('--removesection',
help='Remove the section from the \
config file.\n\n', nargs=1,
required=False)
config_subparser.set_defaults(handle=self.handleconfig.handleConfig)
parser.add_argument('-d', '--debug', help='Enable debug output\n\n',
action='store_const', const=logging.DEBUG, dest='loglevel', default=logging.INFO)
parser.add_argument('-d', '--debug',
help='Enable debug output\n\n',
action='store_const', const=logging.DEBUG,
dest='loglevel', default=logging.INFO)
parser.add_argument('-h', '--help', help='Show this help message and exit\n\n', action='help')
parser.add_argument('-h', '--help',
help='Show this help message and exit\n\n',
action='help')
parser.add_argument('-q', '--quiet', help='Hide all output except error messages\n\n',
action='store_const', const=logging.ERROR, dest='loglevel')
parser.add_argument('-q', '--quiet',
help='Hide all output except error messages\n\n',
action='store_const', const=logging.ERROR,
dest='loglevel')
parser.add_argument('-v', '--version', help='Stx build tools version\n\n',
parser.add_argument('-v', '--version',
help='Stx build tools version\n\n',
action='version', version='%(prog)s 1.0.0')
return parser
@ -72,7 +114,6 @@ Use %(prog)s --help to get help for all of parameters\n\n''')
def stx_main():
command_line = CommandLine()
args = command_line.parseArgs()

23
stx/stx-build-tools-chart/stx-builder/.helmignore

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

35
stx/stx-build-tools-chart/stx-builder/Chart.yaml

@ -0,0 +1,35 @@
---
apiVersion: v2
name: stx-builder
description: A Helm chart for Starlingx Building Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0
dependencies:
- name: stx-pkgbuilder
version: "0.1.0"
repository: "file://dependency_chart/stx-pkgbuilder"
- name: stx-lat-tool
version: "0.1.0"
repository: "file://dependency_chart/stx-lat-tool"
- name: stx-repomgr
version: "0.1.0"
repository: "file://dependency_chart/stx-aptly/stx-repomgr"

47
stx/stx-build-tools-chart/stx-builder/configmap/localrc.sample

@ -0,0 +1,47 @@
# Release Variable
export MY_RELEASE=@MY_RELEASE@
# avoid calling your project 'build' it will break some SDEBs
export PROJECT=@PROJECT@
# uid
export MYUID=@MYUID@
# These are used in the Dockerfile, not sure where else
export MYUNAME=@MYUNAME@
export DIST=@DIST@
export STX_DIST=@STX_DIST@
export REPOMGR_TYPE=@REPOMGR_TYPE@
export GITUSER="@GITUSER@"
export GITEMAIL=@GITEMAIL@
export DEBFULLNAME="@DEBFULLNAME@"
export DEBEMAIL=@DEBEMAIL@
export PROXY=@PROXY@
export PROXYSERVER=@PROXYSERVER@
export PROXYPORT=@PROXYPORT@
export HOSTUSERNAME=@HOSTUSERNAME@
export CENGNURL=@CENGNURL@
if [[ x"@fetch@" == x"true" ]];then
export SOURCESLIST=/usr/local/bin/stx/@SOURCESLIST@
export DEBLIST=/usr/local/bin/stx/@DEBLIST@
export DSCLIST=/usr/local/bin/stx/@DSCLIST@
fi
export REPOMGR_URL=http://@PROJECT@-stx-repomgr:8080
export REPOMGR_DEPLOY_URL=http://@PROJECT@-stx-repomgr:80/
export BUILDER_URL=http://@PROJECT@-stx-pkgbuilder:8080/pkgbuilder/

14
stx/stx-build-tools-chart/stx-builder/configmap/stx-cleanup

@ -0,0 +1,14 @@
#!/bin/bash
if [ -f "$MY_REPO_ROOT_DIR/cgcs-root/build-tools/stx/repo_manage.py" ]; then
repo_manage.py clean
fi
rm -rf $MY_REPO_ROOT_DIR/stx-tools
rm -rf $MY_REPO_ROOT_DIR/cgcs-root
rm -rf $MY_REPO_ROOT_DIR/.repo
rm -f /home/$MYUNAME/prepare-build.done
echo "**************************************************************************"
echo "Cleanup Finished!"
echo "**************************************************************************"

32
stx/stx-build-tools-chart/stx-builder/configmap/stx-deb.list

@ -0,0 +1,32 @@
zomg 0.8.1-2
#zonemaster-cli 1.0.5-1.1
zoneminder 1.34.23-1
#zoneminder-doc #1.34.23-1
zookeeper 3.4.13-6
#zookeeper-bin 3.4.13-6
zookeeperd 3.4.13-6
#zoom-player 1.1.5~dfsg-6
zopfli# 1.0.3-1
#zoph 0.9.16-1
wpasupplicant 2:2.9.0-21
#wpd2epub 0.9.6-2
wpd2odt #0.9.6-2
wpewebkit-driver# 2.32.1-1
wpg2odg 0.9.6-2
wpolish #20210105-1
tryton-modules-all 47
#tryton-modules-analytic-account 5.0.3-1
tryton-modules-analytic-invoice# 1:5.0.3-1
#tryton-modules-analytic-purchase 5.0.2-1
tryton-modules-analytic-sale 5.0.2-1
#science-physics 1.14.1
science-physics-dev# 1.14.1
#science-presentation 1.14.1
science-psychophysics# 1.14.1
#science-robotics 1.14.1
science-robotics-dev# 1.14.1
#science-simulations 1.14.1
science-statistics# 1.14.1
#science-tasks 1.14.1
science-typesetting# 1.14.1
libdns-export1110

21
stx/stx-build-tools-chart/stx-builder/configmap/stx-dsc.list

@ -0,0 +1,21 @@
yorick 2.2.04+dfsg1-12
yorick-full #2.2.04+dfsg1+full
xzgv 0.9.2-2
xzip# 1:1.8.2-4
#xvkbd #4.1-1
#xwallpaper 0.6.5-1
#ipolish #20210105-1
#ispell.pt 20210112-1
#tesseract-lang 1:4.00~git30-7274cfa-1.1
#swish-e #2.4.7-6
#swisswatch 0.6-18
#switchconf 0.0.17-1
#ruby-mechanize 2.7.7-1
#ruby-memoist 0.16.2-2
#zookeeper 3.4.13-6
#zookeeper 3.4.13-2
#0ad 0.0.23.1-2
#2vcard 0.6-1
#3270font #2.0.0-1
#389-ds-base 1.4.0.21-1
#openssl

54
stx/stx-build-tools-chart/stx-builder/configmap/stx-prepare-build

@ -0,0 +1,54 @@
#!/bin/bash
git config --global user.name "$GITUSER"
git config --global user.email "$GITEMAIL"
git config --global color.ui false
cd $MY_REPO_ROOT_DIR
if [[ x"$PROXY" == x"true" ]]; then
ps aux|grep ssh|grep qTfnN 2>&1>/dev/null
ret=$?
if [[ x"$ret" != x"0" ]];then
echo "*************************************************************************************"
echo "Note: Next we will create the proxy and connect the proxyserver $PROXYSERVER!!!"
echo ""
echo ""
echo "*************************************************************************************"
ssh -D 8080 -qTfnN $HOSTUSERNAME@$PROXYSERVER
fi
proxychains repo init -u git://lxgit.wrs.com/stx-debian/manifest.git
proxychains repo sync
else
repo init -u git://lxgit.wrs.com/stx-debian/manifest.git
repo sync
fi
sudo apt-get update
if [[ x"$CENGNURL" != x"" ]]; then
repo_manage.py mirror --url $CENGNURL
fi
if [[ x"$SOURCESLIST" != x"" ]]; then
if [[ x"$DEBLIST" == x"" ]]; then
if [[ x"$DSCLIST" == x"" ]]; then
echo "Either deblist or dsclist must not NULL!!!!"
return 1
else
repo_manage.py download --sources_list=$SOURCESLIST --dsc_list=$DSCLIST
fi
else
if [[ x"$DSCLIST" == x"" ]]; then
repo_manage.py download --sources_list=$SOURCESLIST --deb_list=$DEBLIST
else
repo_manage.py download --sources_list=$SOURCESLIST --deb_list=$DEBLIST --dsc_list=$DSCLIST
fi
fi
fi
touch /home/$MYUNAME/prepare-build.done
echo "************************************************************************************************"
echo "Prepare Done!"
echo "************************************************************************************************"

4
stx/stx-build-tools-chart/stx-builder/configmap/stx-sources.list

@ -0,0 +1,4 @@
deb [trusted=yes] http://mirror.starlingx.cengn.ca/mirror/debian/debian/ftp.ca.debian.org/debian/ bullseye main
deb-src [trusted=yes] http://mirror.starlingx.cengn.ca/mirror/debian/debian/ftp.ca.debian.org/debian/ bullseye main
deb [trusted=yes] http://mirror.starlingx.cengn.ca/mirror/debian/debian/ftp.ca.debian.org/debian/ buster main
deb-src [trusted=yes] http://mirror.starlingx.cengn.ca/mirror/debian/debian/ftp.ca.debian.org/debian/ buster main

25
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-aptly/stx-repomgr/Chart.yaml

@ -0,0 +1,25 @@
---
apiVersion: v2
name: stx-repomgr
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

62
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-aptly/stx-repomgr/templates/_helpers.tpl

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "stx-repomgr.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "stx-repomgr.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "stx-repomgr.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "stx-repomgr.labels" -}}
helm.sh/chart: {{ include "stx-repomgr.chart" . }}
{{ include "stx-repomgr.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "stx-repomgr.selectorLabels" -}}
app.kubernetes.io/name: {{ include "stx-repomgr.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "stx-repomgr.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "stx-repomgr.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

60
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-aptly/stx-repomgr/templates/deployment.yaml

@ -0,0 +1,60 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "stx-repomgr.fullname" . }}
labels:
{{- include "stx-repomgr.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "stx-repomgr.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "stx-repomgr.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
tty: true
volumeMounts:
- name: {{ .Values.volumeMounts.name }}
mountPath: {{ .Values.volumeMounts.mountPath}}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: {{ .Values.volumes.name }}
hostPath:
path: {{ .Values.volumes.hostPath.path }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

20
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-aptly/stx-repomgr/templates/service.yaml

@ -0,0 +1,20 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "stx-repomgr.fullname" . }}
labels:
{{- include "stx-repomgr.labels" . | nindent 4 }}
spec:
type: {{ .Values.sendservice.type }}
ports:
- port: {{ .Values.sendservice.port }}
targetPort: 80
protocol: TCP
name: http-send
- port: {{ .Values.recvservice.port }}
targetPort: 8080
protocol: TCP
name: http-recv
selector:
{{- include "stx-repomgr.selectorLabels" . | nindent 4 }}

71
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-aptly/stx-repomgr/values.yaml

@ -0,0 +1,71 @@
# Default values for stx-repomgr.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
---
replicaCount: 1
image:
repository: stx-aptly
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "v0.1.0"
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
volumeMounts:
name: shared-workspace
mountPath: /var/aptly
volumes:
name: shared-workspace
hostPath:
path: /workspace/aptly
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
sendservice:
type: ClusterIP
port: 80
recvservice:
type: ClusterIP
port: 8080
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}

23
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-lat-tool/.helmignore

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

24
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-lat-tool/Chart.yaml

@ -0,0 +1,24 @@
---
apiVersion: v2
name: stx-lat-tool
description: A Helm chart for LAT Tool of the StarlingX Building Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

63
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-lat-tool/templates/_helpers.tpl

@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "stx-lat-tool.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "stx-lat-tool.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "stx-lat-tool.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "stx-lat-tool.labels" -}}
helm.sh/chart: {{ include "stx-lat-tool.chart" . }}
{{ include "stx-lat-tool.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "stx-lat-tool.selectorLabels" -}}
app.kubernetes.io/name: {{ include "stx-lat-tool.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "stx-lat-tool.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "stx-lat-tool.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

60
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-lat-tool/templates/deployment.yaml

@ -0,0 +1,60 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "stx-lat-tool.fullname" . }}
labels:
{{- include "stx-lat-tool.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "stx-lat-tool.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "stx-lat-tool.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
tty: true
volumeMounts:
- name: {{ .Values.volumes.name }}
mountPath: {{ .Values.volumeMounts.mountPath}}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: {{ .Values.volumes.name }}
hostPath:
path: {{ .Values.volumes.hostPath.path }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

64
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-lat-tool/values.yaml

@ -0,0 +1,64 @@
# Default values for stx-lat-tool.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
---
replicaCount: 1
image:
repository: stx-lat-tool
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "v0.1.0"
volumeMounts:
name: latd-shared-workspace
mountPath: /localdisk
volumes:
name: latd-shared-workspace
hostPath:
path: /workspace/localdisk
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext:
privileged: true
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}

24
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pkgbuilder/Chart.yaml

@ -0,0 +1,24 @@
---
apiVersion: v2
name: stx-pkgbuilder
description: A Helm chart for Starlingx Building Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

63
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pkgbuilder/templates/_helpers.tpl

@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "stx-pkgbuilder.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "stx-pkgbuilder.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "stx-pkgbuilder.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "stx-pkgbuilder.labels" -}}
helm.sh/chart: {{ include "stx-pkgbuilder.chart" . }}
{{ include "stx-pkgbuilder.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "stx-pkgbuilder.selectorLabels" -}}
app.kubernetes.io/name: {{ include "stx-pkgbuilder.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "stx-pkgbuilder.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "stx-pkgbuilder.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

7
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pkgbuilder/templates/configmap.yaml

@ -0,0 +1,7 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.volumes.configmapname }}
data:
{{ (.Files.Glob "configmap/stx*").AsConfig | indent 2 }}

65
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pkgbuilder/templates/deployment.yaml

@ -0,0 +1,65 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "stx-pkgbuilder.fullname" . }}
labels:
{{- include "stx-pkgbuilder.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "stx-pkgbuilder.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "stx-pkgbuilder.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
tty: true
volumeMounts:
- name: {{ .Values.volumeMounts.name }}
mountPath: {{ .Values.volumeMounts.mountPath}}
- name: {{ .Values.volumeMounts.envsetupname }}
mountPath: {{ .Values.volumeMounts.envsetupmountPath}}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: {{ .Values.volumes.name }}
hostPath:
path: {{ .Values.volumes.hostPath.path }}
- name: {{ .Values.volumes.envsetupname }}
configMap:
name: {{ .Values.volumes.configmapname }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

16
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pkgbuilder/templates/service.yaml

@ -0,0 +1,16 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "stx-pkgbuilder.fullname" . }}
labels:
{{- include "stx-pkgbuilder.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: 80
protocol: TCP
name: http
selector:
{{- include "stx-pkgbuilder.selectorLabels" . | nindent 4 }}

73
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pkgbuilder/values.yaml

@ -0,0 +1,73 @@
# Default values for stx-pkgbuilder.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
---
replicaCount: 1
image:
repository: stx-pkgbuilder
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "v0.1.0"
volumeMounts:
name: shared-workspace
mountPath: /localdisk
envsetupname: env-setting
envsetupmountPath: /usr/local/bin/stx
volumes:
name: shared-workspace
hostPath:
path: /workspace/localdisk
envsetupname: env-setting
configmapname: pkgbuilder
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext:
privileged: true
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 8080
resources: {}
# We usually recommend not to specify default resources and to leave this as
# a conscious choice for the user. This also increases chances charts run on
# environments with little resources, such as Minikube. If you do want to
# specify resources, uncomment the following lines, adjust them as necessary,
# and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}

24
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pulp/stx-repomgr/Chart.yaml

@ -0,0 +1,24 @@
---
apiVersion: v2
name: stx-repomgr
description: A Helm chart for Starlingx Building Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

3
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pulp/stx-repomgr/configmap/changepasswd

@ -0,0 +1,3 @@
#!/bin/bash
pulpcore-manager reset-admin-password -p admin

4
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pulp/stx-repomgr/configmap/settings.py

@ -0,0 +1,4 @@
CONTENT_ORIGIN = 'http://${PROJECT}-stx-pulp:8080'
ANSIBLE_API_HOSTNAME = 'http://${PROJECT}-stx-pulp:8080'
ANSIBLE_CONTENT_HOSTNAME = 'http://${PROJECT}-stx-pulp:8080/pulp/content'
TOKEN_AUTH_DISABLED = True

63
stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-pulp/stx-repomgr/templates/_helpers.tpl

@ -0,0 +1,63 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "stx-repomgr.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*