Skip to content

Commit

Permalink
Support LTS related stuff to convert (#544)
Browse files Browse the repository at this point in the history
Before:

  ./convert-artifacts-layout.sh apt
  ./convert-artifacts-layout.sh yum

After:

  ./convert-artifacts-layout.sh apt
  ./convert-artifacts-layout.sh yum
  ./convert-artifacts-layout.sh apt lts
  ./convert-artifacts-layout.sh yum lts

Then
  artifacts/5 or artifacts/lts/5 will be used for output.

---------

Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
  • Loading branch information
kenhys authored Jul 26, 2023
1 parent 32645ab commit f94d651
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 15 deletions.
50 changes: 37 additions & 13 deletions fluent-package/convert-artifacts-layout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@
# Utility script to convert repository layout for packages.treasuredata.com
#
# Usage:
#
# For https://td-agent-package-browser.herokuapp.com/5
#
# $ convert-artifacts-layout.sh apt
# $ convert-artifacts-layout.sh yum
#
# For https://td-agent-package-browser.herokuapp.com/lts/5
#
# $ convert-artifacts-layout.sh apt lts
# $ convert-artifacts-layout.sh yum lts

set -ex

FLUENT_PACKAGE_DIR=$(dirname $(realpath $0))
REPOSITORY_TYPE=""
ARTIFACTS_DIR="artifacts"
if [ "$2" = "lts" ]; then
ARTIFACTS_DIR="artifacts/lts"
else
ARTIFACTS_DIR="artifacts"
fi
case $1 in
apt|deb)
REPOSITORY_TYPE=apt
Expand All @@ -20,28 +32,38 @@ case $1 in
bullseye|bookworm)
# e.g. mapping debian/pool/buster/main/t/td-agent/ => 5/debian/buster/pool/contrib/t/td-agent
# mapping debian/pool/buster/main/f/fluent-package/ => 5/debian/buster/pool/contrib/f/fluent-package
mkdir -p $ARTIFACTS_DIR/5/debian/$d/pool/contrib/t/td-agent
mkdir -p $ARTIFACTS_DIR/5/debian/$d/pool/contrib/f/fluent-package
mkdir -p $ARTIFACTS_DIR/5/debian/$d/pool/contrib/f/fluent-apt-source
find $REPOSITORY_PATH/debian/pool/$d -name 'td-agent*.deb' -not -name '*dbgsym*' \
-exec cp {} $ARTIFACTS_DIR/5/debian/$d/pool/contrib/f/fluent-package \;
find $REPOSITORY_PATH/debian/pool/$d -name 'fluent-package*.deb' -not -name '*dbgsym*' \
-exec cp {} $ARTIFACTS_DIR/5/debian/$d/pool/contrib/f/fluent-package \;
find $REPOSITORY_PATH/debian/pool/$d -name 'fluent*-apt-source*.deb' -not -name '*dbgsym*' \
-exec cp {} $ARTIFACTS_DIR/5/debian/$d/pool/contrib/f/fluent-apt-source \;
if [ "$2" = "lts" ]; then
mkdir -p $ARTIFACTS_DIR/5/debian/$d/pool/contrib/f/fluent-lts-apt-source
find $REPOSITORY_PATH/debian/pool/$d -name 'fluent*-apt-source*.deb' -not -name '*dbgsym*' \
-exec cp {} $ARTIFACTS_DIR/5/debian/$d/pool/contrib/f/fluent-lts-apt-source \;
else
mkdir -p $ARTIFACTS_DIR/5/debian/$d/pool/contrib/f/fluent-apt-source
find $REPOSITORY_PATH/debian/pool/$d -name 'fluent*-apt-source*.deb' -not -name '*dbgsym*' \
-exec cp {} $ARTIFACTS_DIR/5/debian/$d/pool/contrib/f/fluent-apt-source \;
fi
;;
focal|jammy)
# e.g. mapping ubuntu/pool/.../main/t/td-agent/ => 5/ubuntu/.../pool/contrib/t/td-agent
# mapping ubuntu/pool/.../main/f/fluent-package/ => 5/ubuntu/.../pool/contrib/f/fluent-package
mkdir -p $ARTIFACTS_DIR/5/ubuntu/$d/pool/contrib/t/td-agent
mkdir -p $ARTIFACTS_DIR/5/ubuntu/$d/pool/contrib/f/fluent-package
mkdir -p $ARTIFACTS_DIR/5/ubuntu/$d/pool/contrib/f/fluent-apt-source
find $REPOSITORY_PATH/ubuntu/pool/$d -name 'td-agent*.deb' \
-exec cp {} $ARTIFACTS_DIR/5/ubuntu/$d/pool/contrib/f/fluent-package \;
find $REPOSITORY_PATH/ubuntu/pool/$d -name 'fluent-package*.deb' \
-exec cp {} $ARTIFACTS_DIR/5/ubuntu/$d/pool/contrib/f/fluent-package \;
find $REPOSITORY_PATH/ubuntu/pool/$d -name 'fluent*-apt-source*.deb' \
-exec cp {} $ARTIFACTS_DIR/5/ubuntu/$d/pool/contrib/f/fluent-apt-source \;
if [ "$2" = "lts" ]; then
mkdir -p $ARTIFACTS_DIR/5/ubuntu/$d/pool/contrib/f/fluent-lts-apt-source
find $REPOSITORY_PATH/ubuntu/pool/$d -name 'fluent*-apt-source*.deb' \
-exec cp {} $ARTIFACTS_DIR/5/ubuntu/$d/pool/contrib/f/fluent-lts-apt-source \;
else
mkdir -p $ARTIFACTS_DIR/5/ubuntu/$d/pool/contrib/f/fluent-apt-source
find $REPOSITORY_PATH/ubuntu/pool/$d -name 'fluent*-apt-source*.deb' \
-exec cp {} $ARTIFACTS_DIR/5/ubuntu/$d/pool/contrib/f/fluent-apt-source \;
fi
;;
*)
exit 1
Expand All @@ -57,10 +79,12 @@ case $1 in
if [ $dist = "centos" -o $dist = "rocky" -o $dist = "almalinux" ]; then
dist_dest="redhat"
fi
for release in 2 7 8 9; do
if [ $dist = "amazon" -a $release -ne 2 ]; then
echo "skip $dist:$release"
continue
for release in 2 7 8 9 2023; do
if [ $dist = "amazon" ]; then
if [ $release -ne 2 -a $release -ne 2023 ]; then
echo "skip $dist:$release"
continue
fi
fi
if [ $dist = "centos" -a $release -ne 7 ]; then
echo "skip $dist:$release"
Expand Down
18 changes: 16 additions & 2 deletions fluent-package/manage-fluent-repositories.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ case $COMMAND in
DRYRUN_OPTION=""
fi
for target in $TARGETS; do
command="aws s3 sync $DRYRUN_OPTION --delete $FLUENT_RELEASE_DIR/5/$target s3://packages.treasuredata.com/5/$target --profile $FLUENT_RELEASE_PROFILE"
case $FLUENT_RELEASE_DIR in
*lts)
command="aws s3 sync $DRYRUN_OPTION --delete $FLUENT_RELEASE_DIR/5/$target s3://packages.treasuredata.com/lts/5/$target --profile $FLUENT_RELEASE_PROFILE"
;;
*)
command="aws s3 sync $DRYRUN_OPTION --delete $FLUENT_RELEASE_DIR/5/$target s3://packages.treasuredata.com/5/$target --profile $FLUENT_RELEASE_PROFILE"
;;
esac
echo $command
$command
done
Expand All @@ -82,7 +89,14 @@ case $COMMAND in
DRYRUN_OPTION=""
fi
for target in $VERSIONS; do
command="aws s3 sync $DRYRUN_OPTION --delete s3://packages.treasuredata.com/$target $FLUENT_RELEASE_DIR/$target --profile $FLUENT_RELEASE_PROFILE"
case $FLUENT_RELEASE_DIR in
*lts)
command="aws s3 sync $DRYRUN_OPTION --delete s3://packages.treasuredata.com/lts/$target $FLUENT_RELEASE_DIR/$target --profile $FLUENT_RELEASE_PROFILE"
;;
*)
command="aws s3 sync $DRYRUN_OPTION --delete s3://packages.treasuredata.com/$target $FLUENT_RELEASE_DIR/$target --profile $FLUENT_RELEASE_PROFILE"
;;
esac
echo $command
$command
done
Expand Down

0 comments on commit f94d651

Please sign in to comment.