diff options
Diffstat (limited to 'packages/aws-gateway-load-balancer-tunnel-handler')
3 files changed, 91 insertions, 0 deletions
diff --git a/packages/aws-gateway-load-balancer-tunnel-handler/.gitignore b/packages/aws-gateway-load-balancer-tunnel-handler/.gitignore new file mode 100644 index 00000000..a3e428dc --- /dev/null +++ b/packages/aws-gateway-load-balancer-tunnel-handler/.gitignore @@ -0,0 +1 @@ +aws-gwlbtun/ diff --git a/packages/aws-gateway-load-balancer-tunnel-handler/Jenkinsfile b/packages/aws-gateway-load-balancer-tunnel-handler/Jenkinsfile new file mode 100644 index 00000000..cbf5a407 --- /dev/null +++ b/packages/aws-gateway-load-balancer-tunnel-handler/Jenkinsfile @@ -0,0 +1,33 @@ +// Copyright (C) 2023 VyOS maintainers and contributors +// +// This program is free software; you can redistribute it and/or modify +// in order to easy exprort images built to "external" world +// it under the terms of the GNU General Public License version 2 or later as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see <http://www.gnu.org/licenses/>. +@NonCPS + +// Using a version specifier library, use 'current' branch. The underscore (_) +// is not a typo! You need this underscore if the line immediately after the +// @Library annotation is not an import statement! +@Library('vyos-build@current')_ + +def timestamp = new Date().format('yyyyMMddhhmmss') +def commit_id = 'f78058a' + +def pkgList = [ + ['name': "aws-gwlbtun-${timestamp}-${commit_id}", + 'scmCommit': commit_id, + 'scmUrl': 'https://github.com/aws-samples/aws-gateway-load-balancer-tunnel-handler', + 'buildCmd': "../build.py --package aws-gwlbtun --version ${timestamp}-${commit_id}"], +] + +// Start package build using library function from https://github.com/vyos/vyos-build +buildPackage('aws-gateway-load-balancer-tunnel-handler', pkgList, null, true, "**/packages/aws-gateway-load-balancer-tunnel-handler/**") diff --git a/packages/aws-gateway-load-balancer-tunnel-handler/build.py b/packages/aws-gateway-load-balancer-tunnel-handler/build.py new file mode 100755 index 00000000..a8c75aab --- /dev/null +++ b/packages/aws-gateway-load-balancer-tunnel-handler/build.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 + +from argparse import ArgumentParser +from pathlib import Path +from subprocess import run + + +def prepare_package() -> None: + """Prepare a package + """ + install_file = Path('./debian/install') + install_data = 'obj-*-linux-gnu/gwlbtun usr/sbin' + install_file.touch() + install_file.write_text(install_data) + + +def build_package(package_name: str, package_ver: str) -> bool: + """Build a package using commands from external file + + Args: + package_name (str): package name + package_ver (str): package version + + Returns: + bool: build status + """ + # prepare sources + debmake_cmd = [ + 'debmake', '-e', 'support@vyos.io', '-f', 'VyOS Support', '-p', + package_name, '-u', package_ver, '-t' + ] + run(debmake_cmd) + + prepare_package() + + # build a package + run('debuild') + + return True + + +# build a package +if __name__ == '__main__': + # prepare argument parser + arg_parser = ArgumentParser() + arg_parser.add_argument('--package', + required=True, + help='Package name to build') + arg_parser.add_argument('--version', + required=True, + help='Version for the package') + args = arg_parser.parse_args() + + if not build_package(args.package, args.version): + exit(1) + + exit() |