[Action] delete old packages
authorYelin Jeong <yelini.jeong@samsung.com>
Wed, 6 Jul 2022 01:37:41 +0000 (10:37 +0900)
committer추지호/NPU Lab(SR)/삼성전자 <jiho.chu@samsung.com>
Mon, 11 Jul 2022 00:30:13 +0000 (09:30 +0900)
This patch deletes old packages which uploaded 3 weeks ago.

Signed-off-by: Yelin Jeong <yelini.jeong@samsung.com>
.github/actions/delete-package-with-spec/action.yml [new file with mode: 0644]
.github/actions/delete-package-with-spec/before3weeks.json [new file with mode: 0644]
.github/workflows/delete-old-package.yml [new file with mode: 0644]

diff --git a/.github/actions/delete-package-with-spec/action.yml b/.github/actions/delete-package-with-spec/action.yml
new file mode 100644 (file)
index 0000000..4034997
--- /dev/null
@@ -0,0 +1,21 @@
+name: delete package with spec
+description: delete packages using spec json file
+
+inputs:
+  spec_path:
+    description: path of spec file
+    required: true
+  art_id:
+    description: artifactory id
+    required: true
+  art_pw:
+    description: artifactory password
+    required: true
+
+runs:
+  using: composite
+  steps:
+    - run : |
+        jf c add art --artifactory-url https://art.sec.samsung.net/artifactory --user ${{ inputs.art_id }} --password ${{ inputs.art_pw }} --interactive=false
+        jf rt del --spec=${{ inputs.spec_path }}
+      shell: bash
diff --git a/.github/actions/delete-package-with-spec/before3weeks.json b/.github/actions/delete-package-with-spec/before3weeks.json
new file mode 100644 (file)
index 0000000..628f2bd
--- /dev/null
@@ -0,0 +1,15 @@
+{
+    "files": [
+      {
+        "aql": {
+          "items.find": {
+            "repo": {"$eq":"aip_generic"},
+            "path": {"$match":"*NPU_SystemService*"},
+            "name": {"$match":"*"},
+            "type" : "any",
+            "created": { "$before":"3weeks" }
+          }
+        }
+      }
+    ]
+}
diff --git a/.github/workflows/delete-old-package.yml b/.github/workflows/delete-old-package.yml
new file mode 100644 (file)
index 0000000..44e2a43
--- /dev/null
@@ -0,0 +1,31 @@
+name: delete old package
+
+on:
+  schedule:
+    # scheduled workflow run on the latest commit on the default or base
+    # branch.
+    - cron: '00 01 * * 0-5'
+
+env:
+  ART_ID: ${{ secrets.ARTIFACTORY_ID }}
+  ART_PW: ${{ secrets.ARTIFACTORY_PW }}
+
+jobs:
+  delete-old-package:
+    runs-on: [ code-large ]
+    container:
+      image: art.sec.samsung.net/aip_docker/n2s2_docker/bionic:latest
+      # for chroot-based build system
+      options: --privileged
+
+    timeout-minutes: 30
+
+    steps:
+      - name: Clone your repository
+        uses: CODE-Actions/checkout@v2
+      - name: Delete old pacakges
+        uses: ./.github/actions/delete-package-with-spec
+        with:
+          spec_path: $GITHUB_WORKSPACE/.github/actions/delete-package-with-spec/before3weeks.json
+          art_id: $ART_ID
+          art_pw: $ART_PW