From 67099e220a7f396b964cdd7aa144a2d26f3e99dc Mon Sep 17 00:00:00 2001 From: Amichai Date: Mon, 9 Sep 2024 10:56:55 +0300 Subject: [PATCH 1/9] Deprecating CircleCI to migrate to GA --- .github/workflows/full_build.yml | 26 ++++++++++++++++++++++++++ .github/workflows/nightly.yml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/full_build.yml create mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/full_build.yml b/.github/workflows/full_build.yml new file mode 100644 index 00000000..938fb0db --- /dev/null +++ b/.github/workflows/full_build.yml @@ -0,0 +1,26 @@ +name: demisto/dockerfiles-info/full_build +on: + push: + branches: + - master +jobs: + update_repo_info: + runs-on: ubuntu-latest + container: + image: devdemisto/dockerbuild:1.0.0.25778 + steps: + - uses: actions/checkout@v4.1.0 +# # 'setup_remote_docker' was not transformed because there is no suitable equivalent in GitHub Actions + # Ensure parameter if_key_exists is set correctly + - name: Install SSH key + uses: shimataro/ssh-key-action@v2.6.1 + with: + key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" + name: circle_ci_id_rsa + known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}" + if_key_exists: fail + - name: Update Docker Repo Info + run: "./update-repository-info.sh" + - uses: actions/upload-artifact@v4.1.0 + with: + path: artifacts diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..a9702c1e --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,31 @@ +name: demisto/dockerfiles-info/nightly + +on: + schedule: + - cron: '0 1 * * *' # Runs at 01:00 every day + +jobs: + update_repo_info: + runs-on: ubuntu-latest + container: + image: devdemisto/dockerbuild:1.0.0.25778 + steps: + - uses: actions/checkout@v4.1.0 + + # Ensure parameter if_key_exists is set correctly + - name: Install SSH key + uses: shimataro/ssh-key-action@v2.6.1 + with: + key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" + name: circle_ci_id_rsa + known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}" + if_key_exists: fail + + # Add conditional check for the master branch + - name: Update Docker Repo Info + if: github.ref == 'refs/heads/master' + run: "./update-repository-info.sh" + + - uses: actions/upload-artifact@v4.1.0 + with: + path: artifacts \ No newline at end of file From 2ba1e7ca67af082d2a032a55486def2da60a8cd5 Mon Sep 17 00:00:00 2001 From: Amichai Date: Mon, 9 Sep 2024 10:58:44 +0300 Subject: [PATCH 2/9] Testing on push --- .github/workflows/full_build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/full_build.yml b/.github/workflows/full_build.yml index 938fb0db..9ae4f61c 100644 --- a/.github/workflows/full_build.yml +++ b/.github/workflows/full_build.yml @@ -2,7 +2,8 @@ name: demisto/dockerfiles-info/full_build on: push: branches: - - master +# - master + - '**' jobs: update_repo_info: runs-on: ubuntu-latest From 2bdb30f8552924684cfa4c9d818d9faa60bf0853 Mon Sep 17 00:00:00 2001 From: Amichai Date: Tue, 10 Sep 2024 10:38:16 +0300 Subject: [PATCH 3/9] New approach --- .github/workflows/full_build.yml | 81 +++++++++++++++++++++++--------- .github/workflows/nightly.yml | 31 ------------ 2 files changed, 60 insertions(+), 52 deletions(-) delete mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/full_build.yml b/.github/workflows/full_build.yml index 9ae4f61c..79693824 100644 --- a/.github/workflows/full_build.yml +++ b/.github/workflows/full_build.yml @@ -1,27 +1,66 @@ -name: demisto/dockerfiles-info/full_build +name: Docker Repository Update + on: push: branches: -# - master - - '**' + - master + pull_request: + branches: + - master + schedule: + - cron: '0 1 * * *' + jobs: - update_repo_info: + update_docker_repo_info: runs-on: ubuntu-latest - container: - image: devdemisto/dockerbuild:1.0.0.25778 + steps: - - uses: actions/checkout@v4.1.0 -# # 'setup_remote_docker' was not transformed because there is no suitable equivalent in GitHub Actions - # Ensure parameter if_key_exists is set correctly - - name: Install SSH key - uses: shimataro/ssh-key-action@v2.6.1 - with: - key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" - name: circle_ci_id_rsa - known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}" - if_key_exists: fail - - name: Update Docker Repo Info - run: "./update-repository-info.sh" - - uses: actions/upload-artifact@v4.1.0 - with: - path: artifacts + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python environment + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Set up pipenv + run: | + python -m pip install --upgrade pip + pip install pipenv + + - name: Install dependencies + run: pipenv install + + - name: Run update-docker-repo-info script + run: pipenv run ./update-docker-repo-info.py + + - name: Configure Git for commit + run: | + git config --global user.email "dc-builder@users.noreply.github.com" + git config --global user.name "dc-builder" + + - name: Check for changes + id: git_status + run: | + git status --short > git_changes.txt + cat git_changes.txt + + - name: Upload artifacts (if changes) + if: steps.git_status.outputs.changes != '' + run: | + mkdir -p artifacts + cat git_changes.txt | awk '{print $2}' | sed 's:/*$::' | xargs -I {} cp -rf {} artifacts/. || echo "cp failed for some reason. continue..." + continue-on-error: true + + - name: Commit and push changes + if: steps.git_status.outputs.changes != '' + run: | + git add . + git commit -m "$(date): auto repo info update [skip ci]" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + continue-on-error: true + + - name: Print completion message + run: echo "Docker repository update complete." \ No newline at end of file diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index a9702c1e..00000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: demisto/dockerfiles-info/nightly - -on: - schedule: - - cron: '0 1 * * *' # Runs at 01:00 every day - -jobs: - update_repo_info: - runs-on: ubuntu-latest - container: - image: devdemisto/dockerbuild:1.0.0.25778 - steps: - - uses: actions/checkout@v4.1.0 - - # Ensure parameter if_key_exists is set correctly - - name: Install SSH key - uses: shimataro/ssh-key-action@v2.6.1 - with: - key: "${{ secrets.CIRCLE_CI_SSH_KEY }}" - name: circle_ci_id_rsa - known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}" - if_key_exists: fail - - # Add conditional check for the master branch - - name: Update Docker Repo Info - if: github.ref == 'refs/heads/master' - run: "./update-repository-info.sh" - - - uses: actions/upload-artifact@v4.1.0 - with: - path: artifacts \ No newline at end of file From c00cc5b8cfd23f445bfedea9a69499fee9ace812 Mon Sep 17 00:00:00 2001 From: Amichai Date: Tue, 10 Sep 2024 10:38:54 +0300 Subject: [PATCH 4/9] New approach --- .github/workflows/full_build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/full_build.yml b/.github/workflows/full_build.yml index 79693824..9e0ea2fe 100644 --- a/.github/workflows/full_build.yml +++ b/.github/workflows/full_build.yml @@ -4,6 +4,7 @@ on: push: branches: - master + - '**' pull_request: branches: - master From 24b22ee48c432ba809a222981fd08053459a04f1 Mon Sep 17 00:00:00 2001 From: Amichai Date: Tue, 10 Sep 2024 10:40:44 +0300 Subject: [PATCH 5/9] New approach --- .github/workflows/full_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/full_build.yml b/.github/workflows/full_build.yml index 9e0ea2fe..ec85eee9 100644 --- a/.github/workflows/full_build.yml +++ b/.github/workflows/full_build.yml @@ -13,7 +13,7 @@ on: jobs: update_docker_repo_info: - runs-on: ubuntu-latest + runs-on: devdemisto/dockerbuild:1.0.0.25778 steps: - name: Checkout repository From 32a2fd3117b00fa477709467b38baad1f90fe5f6 Mon Sep 17 00:00:00 2001 From: Amichai Date: Tue, 10 Sep 2024 10:44:15 +0300 Subject: [PATCH 6/9] Per commit, not pr --- .github/workflows/full_build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/full_build.yml b/.github/workflows/full_build.yml index ec85eee9..f4aff9cc 100644 --- a/.github/workflows/full_build.yml +++ b/.github/workflows/full_build.yml @@ -5,9 +5,6 @@ on: branches: - master - '**' - pull_request: - branches: - - master schedule: - cron: '0 1 * * *' From bc9671bcecf101d912d9edad57902f90d8194fcc Mon Sep 17 00:00:00 2001 From: Amichai Date: Tue, 10 Sep 2024 10:48:59 +0300 Subject: [PATCH 7/9] Docker issue --- .github/workflows/full_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/full_build.yml b/.github/workflows/full_build.yml index f4aff9cc..8fb78b57 100644 --- a/.github/workflows/full_build.yml +++ b/.github/workflows/full_build.yml @@ -10,7 +10,7 @@ on: jobs: update_docker_repo_info: - runs-on: devdemisto/dockerbuild:1.0.0.25778 + runs-on: ubuntu-latest steps: - name: Checkout repository @@ -19,7 +19,7 @@ jobs: - name: Set up Python environment uses: actions/setup-python@v4 with: - python-version: '3.x' + python-version: '3.9' - name: Set up pipenv run: | From ddb731bfa6cabe73853ab16499da08a45ed004c9 Mon Sep 17 00:00:00 2001 From: Amichai Date: Tue, 10 Sep 2024 10:51:54 +0300 Subject: [PATCH 8/9] revert all branch rule --- .github/workflows/full_build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/full_build.yml b/.github/workflows/full_build.yml index 8fb78b57..5f984d18 100644 --- a/.github/workflows/full_build.yml +++ b/.github/workflows/full_build.yml @@ -4,7 +4,6 @@ on: push: branches: - master - - '**' schedule: - cron: '0 1 * * *' From 9258b4622da5c6b697532de9d8a3e13bd0927ab4 Mon Sep 17 00:00:00 2001 From: Amichai Date: Tue, 10 Sep 2024 10:52:28 +0300 Subject: [PATCH 9/9] remove circle yml --- .circleci/config.yml | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 82c47a27..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,32 +0,0 @@ -jobs: - update_repo_info: - docker: - - image: devdemisto/dockerbuild:1.0.0.25778 - resource_class: small - steps: - - checkout - - setup_remote_docker - - add_ssh_keys: - fingerprints: - - SHA256:HDjXb+EIco/xPtCiblLoN2WDyjfRl8488OsY+JW0EoM - - run: - name: Update Docker Repo Info - command: | - ./update-repository-info.sh - - store_artifacts: - path: artifacts -workflows: - version: 2 - full_build: - jobs: - - update_repo_info - nightly: - jobs: - - update_repo_info - triggers: - - schedule: - cron: "0 1 * * *" - filters: - branches: - only: - - master