From 08118de56803fed83d3df22f064082fccf60defd Mon Sep 17 00:00:00 2001 From: Rahul Date: Fri, 6 Oct 2023 20:16:42 +0530 Subject: [PATCH] ci: reduce artifacts size (#2403) * ci: reduce artifacts size * ci: include prom-stack for rpm/deb * ci: address review comments --- Makefile | 2 +- deb/build-deb.sh | 13 +++++++++++-- rpm/build-rpm.sh | 14 +++++++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 81dc22aaa..7e890b1b8 100644 --- a/Makefile +++ b/Makefile @@ -129,7 +129,7 @@ dist-tar: @rm -rf ${DIST} @mkdir ${TMP} @mkdir ${DIST} - @cp -r .git cmd bin conf container docs grafana pkg service cert autosupport go.mod go.sum Makefile README.md LICENSE prom-stack.tmpl harvest.cue ${TMP} + @cp -r bin conf container grafana service cert autosupport README.md LICENSE prom-stack.tmpl ${TMP} @cp harvest.yml ${TMP}/harvest.yml @tar --directory /tmp --create --gzip --file ${DIST}/${HARVEST_PACKAGE}.tar.gz ${HARVEST_PACKAGE} @rm -rf ${TMP} diff --git a/deb/build-deb.sh b/deb/build-deb.sh index d3dad0d15..1c49ff7dc 100755 --- a/deb/build-deb.sh +++ b/deb/build-deb.sh @@ -60,13 +60,22 @@ else make build VERSION="$HARVEST_VERSION" RELEASE="$HARVEST_RELEASE" fi -rm -rf $BUILD/opt/harvest/asup/* - if [ ! $? -eq 0 ]; then error " build failed" exit 1 fi +rm -rf $BUILD/opt/harvest/asup +rm -rf $BUILD/opt/harvest/.git +rm -rf $BUILD/opt/harvest/vendor +rm -rf $BUILD/opt/harvest/cmd +rm -rf $BUILD/opt/harvest/package +rm -rf $BUILD/opt/harvest/go.mod +rm -rf $BUILD/opt/harvest/go.sum +rm -rf $BUILD/opt/harvest/harvest.cue +rm -rf $BUILD/opt/harvest/Makefile +rm -rf $BUILD/opt/harvest/.github + # build deb package PACKAGE_DIR="$SRC/dist/$HARVEST_VERSION-$HARVEST_RELEASE" PACKAGE_NAME="harvest-${HARVEST_VERSION}-${HARVEST_RELEASE}.${HARVEST_ARCH}.deb" diff --git a/rpm/build-rpm.sh b/rpm/build-rpm.sh index 28382c0f6..45baafbf7 100755 --- a/rpm/build-rpm.sh +++ b/rpm/build-rpm.sh @@ -20,7 +20,6 @@ cp -r "$SRC/.git" "$BUILD/harvest" cp -r "$SRC/cmd/" "$BUILD/harvest/" cp -r "$SRC/conf/" "$BUILD/harvest/" cp -r "$SRC/container/" "$BUILD/harvest/" -cp -r "$SRC/docs/" "$BUILD/harvest/" cp -r "$SRC/grafana/" "$BUILD/harvest/" cp -r "$SRC/pkg/" "$BUILD/harvest/" cp -r "$SRC/rpm/" "$BUILD/harvest/" @@ -52,13 +51,22 @@ else make build VERSION=$HARVEST_VERSION RELEASE=$HARVEST_RELEASE fi -rm -rf $BUILD/harvest/asup/* - if [ ! $? -eq 0 ]; then echo "build failed, aborting" exit 1 fi +rm -rf $BUILD/harvest/asup +rm -rf $BUILD/harvest/.git +rm -rf $BUILD/harvest/vendor +rm -rf $BUILD/harvest/cmd +rm -rf $BUILD/harvest/package +rm -rf $BUILD/harvest/go.mod +rm -rf $BUILD/harvest/go.sum +rm -rf $BUILD/harvest/harvest.cue +rm -rf $BUILD/harvest/Makefile +rm -rf $BUILD/harvest/.github + # create rpm build package cd "$BUILD" rm -rf "rpm"