From 39367403900a4590225e2be955477667f21521de Mon Sep 17 00:00:00 2001 From: Leonardo Grasso Date: Fri, 12 Mar 2021 13:23:04 +0100 Subject: [PATCH] build(scripts): add cloudfront invalidation for publishing scripts Signed-off-by: Leonardo Grasso --- scripts/publish-bin | 4 ++++ scripts/publish-deb | 5 +++++ scripts/publish-rpm | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/scripts/publish-bin b/scripts/publish-bin index 9607b0d6..1f1c7e84 100755 --- a/scripts/publish-bin +++ b/scripts/publish-bin @@ -35,9 +35,13 @@ if [ -z "${file}" ] || [ -z "${repo}" ] || [ -z "${arch}" ]; then usage fi +# settings s3_bucket_repo="s3://falco-distribution/packages/${repo}/${arch}" +cloudfront_path="/packages/${repo}/${arch}" # publish package=$(basename -- ${file}) echo "Publishing ${package} to ${s3_bucket_repo}..." aws s3 cp ${file} ${s3_bucket_repo}/${package} --acl public-read + +aws cloudfront create-invalidation --distribution-id ${AWS_CLOUDFRONT_DIST_ID} --paths ${cloudfront_path}/${package} \ No newline at end of file diff --git a/scripts/publish-deb b/scripts/publish-deb index 44c1f779..7f07d3d7 100755 --- a/scripts/publish-deb +++ b/scripts/publish-deb @@ -107,6 +107,7 @@ check_program aws # settings debSuite=stable s3_bucket_repo="s3://falco-distribution/packages/${repo}" +cloudfront_path="/packages/${repo}" tmp_repo_path=/tmp/falco-$repo # prepere repository local copy @@ -125,3 +126,7 @@ 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}.asc ${s3_bucket_repo}/${debSuite}/${package}.asc --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}/${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}/dists/* \ No newline at end of file diff --git a/scripts/publish-rpm b/scripts/publish-rpm index 08783bf5..323ea485 100755 --- a/scripts/publish-rpm +++ b/scripts/publish-rpm @@ -71,6 +71,7 @@ check_program aws # settings s3_bucket_repo="s3://falco-distribution/packages/${repo}" +cloudfront_path="/packages/${repo}" tmp_repo_path=/tmp/falco-$repo # prepere repository local copy @@ -89,3 +90,7 @@ 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}.asc ${s3_bucket_repo}/${package}.asc --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}/${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}/repodata/* \ No newline at end of file