update(scripts): allow regenerating signatures without publishing new packages

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
Jason Dellaluce 2023-01-19 10:52:14 +00:00 committed by poiana
parent 61bc6c8d32
commit 1d0c50e272
2 changed files with 40 additions and 36 deletions

View File

@ -136,7 +136,7 @@ done
shift $((OPTIND-1)) shift $((OPTIND-1))
# check options # check options
if [ ${#files[@]} -eq 0 ] || [ -z "${repo}" ]; then if ([ ${#files[@]} -eq 0 ] && [ -z "${sign_all}" ]) || [ -z "${repo}" ]; then
usage usage
fi fi
@ -177,23 +177,25 @@ if [ "${sign_all}" ]; then
fi fi
# update the repo by adding new packages # update the repo by adding new packages
for file in "${files[@]}"; do if ! [ ${#files[@]} -eq 0 ]; then
echo "Adding ${file}..." for file in "${files[@]}"; do
add_deb ${tmp_repo_path} ${debSuite} ${file} echo "Adding ${file}..."
done add_deb ${tmp_repo_path} ${debSuite} ${file}
update_repo ${tmp_repo_path} ${debSuite} done
update_repo ${tmp_repo_path} ${debSuite}
# publish # publish
for file in "${files[@]}"; do for file in "${files[@]}"; do
package=$(basename -- ${file}) package=$(basename -- ${file})
echo "Publishing ${package} to ${s3_bucket_repo}..." echo "Publishing ${package} to ${s3_bucket_repo}..."
aws s3 cp ${tmp_repo_path}/${debSuite}/${package} ${s3_bucket_repo}/${debSuite}/${package} --acl public-read aws s3 cp ${tmp_repo_path}/${debSuite}/${package} ${s3_bucket_repo}/${debSuite}/${package} --acl public-read
aws s3 cp ${tmp_repo_path}/${debSuite}/${package}.asc ${s3_bucket_repo}/${debSuite}/${package}.asc --acl public-read aws s3 cp ${tmp_repo_path}/${debSuite}/${package}.asc ${s3_bucket_repo}/${debSuite}/${package}.asc --acl public-read
aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/${debSuite}/${package} aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/${debSuite}/${package}
aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/${debSuite}/${package}.asc aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/${debSuite}/${package}.asc
done done
# sync dists # sync dists
aws s3 sync ${tmp_repo_path}/dists ${s3_bucket_repo}/dists --delete --acl public-read aws s3 sync ${tmp_repo_path}/dists ${s3_bucket_repo}/dists --delete --acl public-read
aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/dists/* aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/dists/*
fi

View File

@ -71,7 +71,7 @@ while getopts ":f::r::s" opt; do
done done
shift $((OPTIND-1)) shift $((OPTIND-1))
if [ ${#files[@]} -eq 0 ] || [ -z "${repo}" ]; then if ([ ${#files[@]} -eq 0 ] && [ -z "${sign_all}" ]) || [ -z "${repo}" ]; then
usage usage
fi fi
@ -108,23 +108,25 @@ if [ "${sign_all}" ]; then
fi fi
# update the repo by adding new packages # update the repo by adding new packages
for file in "${files[@]}"; do if ! [ ${#files[@]} -eq 0 ]; then
echo "Adding ${file}..." for file in "${files[@]}"; do
add_rpm ${tmp_repo_path} ${file} echo "Adding ${file}..."
done add_rpm ${tmp_repo_path} ${file}
update_repo ${tmp_repo_path} done
update_repo ${tmp_repo_path}
# publish # publish
for file in "${files[@]}"; do for file in "${files[@]}"; do
package=$(basename -- ${file}) package=$(basename -- ${file})
echo "Publishing ${package} to ${s3_bucket_repo}..." echo "Publishing ${package} to ${s3_bucket_repo}..."
aws s3 cp ${tmp_repo_path}/${package} ${s3_bucket_repo}/${package} --acl public-read aws s3 cp ${tmp_repo_path}/${package} ${s3_bucket_repo}/${package} --acl public-read
aws s3 cp ${tmp_repo_path}/${package}.asc ${s3_bucket_repo}/${package}.asc --acl public-read aws s3 cp ${tmp_repo_path}/${package}.asc ${s3_bucket_repo}/${package}.asc --acl public-read
aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/${package} aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/${package}
aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/${package}.asc aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/${package}.asc
done done
# sync repodata # sync repodata
aws s3 sync ${tmp_repo_path}/repodata ${s3_bucket_repo}/repodata --delete --acl public-read aws s3 sync ${tmp_repo_path}/repodata ${s3_bucket_repo}/repodata --delete --acl public-read
aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/repodata/* aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/repodata/*
fi