From 342e470fb931c53f32b4e042ac1d0593877a7d98 Mon Sep 17 00:00:00 2001 From: yann Date: Thu, 11 Jan 2024 15:32:47 +0100 Subject: [PATCH 1/3] feat(deps)(automation): dynamic sync deps --- .github/workflows/sync-deps.yaml | 5 +---- deps/others/.gitignore | 3 ++- deps/others/build.sbt | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sync-deps.yaml b/.github/workflows/sync-deps.yaml index 3428e442b..a68cc2ab2 100644 --- a/.github/workflows/sync-deps.yaml +++ b/.github/workflows/sync-deps.yaml @@ -34,7 +34,4 @@ jobs: BUCKET: ${{ secrets.AWS_RAW_S3_BIN_BUCKET }} run: | M2_HOME=/home/sbtuser/.m2/repository - aws s3 sync $M2_HOME s3://$BUCKET/maven --exclude '*' --include '**kiama**' - aws s3 sync $M2_HOME s3://$BUCKET/maven --exclude '*' --include '**jackson**' - aws s3 sync $M2_HOME s3://$BUCKET/maven --exclude '*' --include '**scala-logging**' - aws s3 sync $M2_HOME s3://$BUCKET/maven --exclude '*' --include '**jwt-core**' + sbt createS3SyncScript diff --git a/deps/others/.gitignore b/deps/others/.gitignore index 1770d7204..9a99535dc 100644 --- a/deps/others/.gitignore +++ b/deps/others/.gitignore @@ -1,2 +1,3 @@ *.jar -manifest.txt \ No newline at end of file +manifest.txt +s3-sync-deps.sh \ No newline at end of file diff --git a/deps/others/build.sbt b/deps/others/build.sbt index d4f4f90a5..b60472156 100644 --- a/deps/others/build.sbt +++ b/deps/others/build.sbt @@ -169,5 +169,28 @@ patchDependencies := { } +val createS3SyncScript = taskKey[Unit]("Create a bash script for syncing dependencies to S3") +val scriptFile = "s3-sync-deps.sh" +createS3SyncScript := { + val dependencies = libraryDependencies.value + + val writer = new BufferedWriter(new FileWriter(scriptFile)) + + try { + writer.write("#!/bin/bash\n\n") + dependencies.foreach { dep => + writer.write(s"aws s3 sync $$M2_HOME s3://$$BUCKET/maven --exclude '*' --include '**${dep.name}**'\n") + } + } finally { + // Always close the writer to release resources + writer.close() + } + + // Make the script executable + new File(scriptFile).setExecutable(true) + + // Notify that the task is completed + println(s"Bash script created: $scriptFile") +} \ No newline at end of file From 0c96ad0e5fad04f57f390ba3c0049b5585f97214 Mon Sep 17 00:00:00 2001 From: yann Date: Thu, 11 Jan 2024 15:37:22 +0100 Subject: [PATCH 2/3] fixup! feat(deps)(automation): dynamic sync deps --- .github/workflows/sync-deps.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sync-deps.yaml b/.github/workflows/sync-deps.yaml index a68cc2ab2..a6e35e4d2 100644 --- a/.github/workflows/sync-deps.yaml +++ b/.github/workflows/sync-deps.yaml @@ -34,4 +34,7 @@ jobs: BUCKET: ${{ secrets.AWS_RAW_S3_BIN_BUCKET }} run: | M2_HOME=/home/sbtuser/.m2/repository + aws s3 sync $M2_HOME s3://$BUCKET/maven --exclude '*' --include '**kiama**' + cd deps/others sbt createS3SyncScript + ./s3-sync-deps.sh From b18ca9fb921ea3a034e3d559a9c3a9c040706912 Mon Sep 17 00:00:00 2001 From: yann Date: Thu, 11 Jan 2024 15:40:51 +0100 Subject: [PATCH 3/3] fixup! fixup! feat(deps)(automation): dynamic sync deps --- .github/workflows/sync-deps.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sync-deps.yaml b/.github/workflows/sync-deps.yaml index a6e35e4d2..ac7a0b627 100644 --- a/.github/workflows/sync-deps.yaml +++ b/.github/workflows/sync-deps.yaml @@ -37,4 +37,5 @@ jobs: aws s3 sync $M2_HOME s3://$BUCKET/maven --exclude '*' --include '**kiama**' cd deps/others sbt createS3SyncScript + export M2_HOME BUCKET ./s3-sync-deps.sh