From 22a6e8bd4d0ee75ec39c69ee5a8a6d581ff6e547 Mon Sep 17 00:00:00 2001 From: Jacob Blain Christen Date: Wed, 19 Aug 2020 14:45:34 -0700 Subject: [PATCH] package: add tarball bundle to dist/artifacts (#202) --- .gitmodules | 3 +++ Makefile | 6 +++++- packaging | 1 + scripts/package-airgap | 4 +--- scripts/package-bundle | 41 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 .gitmodules create mode 160000 packaging create mode 100755 scripts/package-bundle diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..3934805b2e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "packaging"] + path = packaging + url = https://github.com/rancher/rke2-packaging.git diff --git a/Makefile b/Makefile index b13c07f920..a77b493c31 100644 --- a/Makefile +++ b/Makefile @@ -106,13 +106,17 @@ download-charts: ## Download packaged helm charts ./scripts/download-charts .PHONY: package -package: download-charts package-airgap ## Package the rke2 binary +package: | download-charts package-airgap package-bundle ## Package the rke2 binary ./scripts/package .PHONY: package-airgap package-airgap: build/images/airgap.tar ## Package docker images for airgap environment ./scripts/package-airgap +.PHONY: package-bundle +package-bundle: ## Package the tarball bundle + ./scripts/package-bundle + ./.dapper: @echo Downloading dapper @curl -sL https://releases.rancher.com/dapper/v0.5.0/dapper-$$(uname -s)-$$(uname -m) > .dapper.tmp diff --git a/packaging b/packaging new file mode 160000 index 0000000000..6d2390a3ce --- /dev/null +++ b/packaging @@ -0,0 +1 @@ +Subproject commit 6d2390a3ce8d4b9fa316561bc1820af4a93e9285 diff --git a/scripts/package-airgap b/scripts/package-airgap index db3b096d58..78fed5ccf8 100755 --- a/scripts/package-airgap +++ b/scripts/package-airgap @@ -5,7 +5,5 @@ cd $(dirname $0)/.. airgap_image_file='scripts/airgap/image-list.txt' mkdir -p dist/artifacts -cp build/images/airgap.tar dist/artifacts/rke2-airgap-images-amd64.tar cp "${airgap_image_file}" dist/artifacts/rke2-images.txt -gzip dist/artifacts/rke2-airgap-images-amd64.tar - +gzip < build/images/airgap.tar > dist/artifacts/rke2-airgap-images-amd64.tar.gz diff --git a/scripts/package-bundle b/scripts/package-bundle new file mode 100755 index 0000000000..b2a7b9f368 --- /dev/null +++ b/scripts/package-bundle @@ -0,0 +1,41 @@ +#!/bin/bash +set -e -x + +cd $(dirname $0)/.. + +. scripts/version.sh + +if [ ! -d packaging/rpm ]; then + git submodule update --recursive --remote --init packaging +fi + +find packaging +mkdir -p dist/bundle/{bin,etc/rancher/${PROG},usr/share/${PROG}/rpm} + +### bin/rke2 +cp -f bin/${PROG} dist/bundle/bin/ + +### etc/environment +cat << EOF > dist/bundle/etc/environment +KUBECONFIG=/etc/rancher/${PROG}/${PROG}.yaml +EOF + +### etc/rancher/rke2/README.md +cat << EOF > dist/bundle/etc/rancher/${PROG}/README.md +# RKE2 FILES + +- **\`${PROG}.yaml\`** + \`${PROG} server\` will place this KUBECONFIG on successful start-up. + +- **\`registries.yaml\`** + The \`k3s\` subsystem embedded in \`${PROG}\` will look for this file on all agents (i.e. including servers) as configuration + for custom/private registries a la https://rancher.com/docs/k3s/latest/en/installation/private-registry/ +EOF + +### usr/share/rke2/rpm +rsync -a packaging/rpm/ dist/bundle/usr/share/${PROG}/rpm/ + +### + +mkdir -p dist/artifacts +tar -cvzf dist/artifacts/${RELEASE}.tar.gz -C dist/bundle .