Use repo.build.vm as local build host
This commit is contained in:
parent
0351abcb92
commit
9532bc7405
@ -1 +1 @@
|
||||
Subproject commit ca10263696d9488ee384430b2e2a0bc55e877b77
|
||||
Subproject commit ad1bfc8860b84148794f26c437a42b932087495f
|
@ -44,16 +44,13 @@ cat <<EOF >/etc/hosts
|
||||
127.0.0.1 localhost
|
||||
::1 localhost
|
||||
172.17.0.1 host
|
||||
172.17.0.1 repo.spotter.cz
|
||||
172.17.0.1 repo.build.vm
|
||||
EOF
|
||||
|
||||
# Reset vmmgr config
|
||||
export ADMINPWD=$(python3 -c "import json; f = open('/etc/vmmgr/config.json'); j = json.load(f); print(j['host']['adminpwd'])")
|
||||
envsubst </etc/vmmgr/config.default.json >/etc/vmmgr/config.json
|
||||
|
||||
# Reset lxcmgr config
|
||||
echo '{"url":"https://repo.spotter.cz/lxc","user":"","pwd":""}' >/etc/lxcmgr/repo.json
|
||||
|
||||
# Clean locally installed LXC packages
|
||||
rm -rf /var/lib/lxcmgr/storage/*
|
||||
rm -rf /var/lib/lxcmgr/cache/apps/*
|
||||
|
@ -1,6 +1,6 @@
|
||||
server {
|
||||
listen [::]:80;
|
||||
server_name repo.spotter.cz;
|
||||
server_name repo.build.vm;
|
||||
|
||||
location / {
|
||||
root /srv/build;
|
||||
|
@ -28,9 +28,12 @@ mkdir -p /srv/build/lxc/apps /srv/build/lxc/images
|
||||
|
||||
# Prepare local APK repository
|
||||
cp etc/nginx/conf.d/apkrepo.conf /etc/nginx/conf.d/apkrepo.conf
|
||||
echo "172.17.0.1 repo.spotter.cz" >>/etc/hosts
|
||||
echo "172.17.0.1 repo.build.vm" >>/etc/hosts
|
||||
service nginx reload
|
||||
|
||||
# Change LXCMgr repository
|
||||
echo '{"url":"http://repo.build.vm/lxc","user":"","pwd":""}' >/etc/lxcmgr/repo.json
|
||||
|
||||
# Supply abuild key
|
||||
# echo '/srv/build/repokey.rsa' | abuild-keygen
|
||||
|
||||
|
@ -8,19 +8,6 @@ from lxcbuild.app import App
|
||||
from lxcbuild.image import Image
|
||||
from lxcbuild.imagebuilder import BuildType
|
||||
|
||||
parser = argparse.ArgumentParser(description='VM application builder and packager')
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
group.add_argument('-f', '--force', action='store_true', help='Force rebuild already built package')
|
||||
group.add_argument('-s', '--scratch', action='store_true', help='Build container for testing purposes, i.e. without cleanup on failure and packaging')
|
||||
group.add_argument('-r', '--remove-image', action='store_true', help='Delete image (including scratch) from build repository')
|
||||
group.add_argument('-e', '--remove-app', action='store_true', help='Delete application from build repository')
|
||||
parser.add_argument('buildarg', help='Either specific "lxcfile" or "meta" file or a directory containing at least one of them')
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
parser.print_usage()
|
||||
sys.exit(1)
|
||||
args = parser.parse_args()
|
||||
|
||||
def build_and_pack_image(path, args):
|
||||
image = Image()
|
||||
if args.scratch:
|
||||
@ -33,15 +20,16 @@ def pack_app(path):
|
||||
app = App()
|
||||
app.pack(path)
|
||||
|
||||
if args.remove_image:
|
||||
def main(args):
|
||||
if args.remove_image:
|
||||
image = Image()
|
||||
image.name = args.buildarg
|
||||
image.remove()
|
||||
elif args.remove_app:
|
||||
elif args.remove_app:
|
||||
app = App()
|
||||
app.name = args.buildarg
|
||||
app.remove()
|
||||
else:
|
||||
else:
|
||||
buildpath = os.path.realpath(args.buildarg)
|
||||
# If the buildpath is a file, determine type from filename
|
||||
if os.path.isfile(buildpath):
|
||||
@ -75,3 +63,17 @@ else:
|
||||
pack_app(meta)
|
||||
if not valid_dir:
|
||||
print('Directory {} doesn\'t contain anything to build, skipping'.format(buildpath))
|
||||
|
||||
parser = argparse.ArgumentParser(description='VM application builder and packager')
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
group.add_argument('-f', '--force', action='store_true', help='Force rebuild already built package')
|
||||
group.add_argument('-s', '--scratch', action='store_true', help='Build container for testing purposes, i.e. without cleanup on failure and packaging')
|
||||
group.add_argument('-r', '--remove-image', action='store_true', help='Delete image (including scratch) from build repository')
|
||||
group.add_argument('-e', '--remove-app', action='store_true', help='Delete application from build repository')
|
||||
parser.add_argument('buildarg', help='Either specific "lxcfile" or "meta" file or a directory containing at least one of them')
|
||||
|
||||
args = parser.parse_args()
|
||||
if hasattr(args, 'buildarg'):
|
||||
main(args)
|
||||
else:
|
||||
parser.print_usage()
|
||||
|
@ -20,7 +20,7 @@ setup-interfaces
|
||||
ifup eth0
|
||||
|
||||
# Download and launch the setup script
|
||||
wget repo.spotter.cz/vm.sh
|
||||
wget https://repo.spotter.cz/vm.sh
|
||||
sh vm.sh
|
||||
```
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
http://dl-cdn.alpinelinux.org/alpine/v3.9/main
|
||||
http://dl-cdn.alpinelinux.org/alpine/v3.9/community
|
||||
@vm http://repo.spotter.cz/alpine/v3.9/apk
|
||||
@vm http://repo.build.vm/alpine/v3.9/apk
|
||||
|
@ -1,3 +1,3 @@
|
||||
http://dl-cdn.alpinelinux.org/alpine/v3.9/main
|
||||
http://dl-cdn.alpinelinux.org/alpine/v3.9/community
|
||||
@vm http://repo.spotter.cz/alpine/v3.9/apk
|
||||
@vm https://repo.spotter.cz/alpine/v3.9/apk
|
||||
|
Loading…
Reference in New Issue
Block a user