From b25f4a944b090021267f09e7b79b6a4f046dc560 Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Wed, 20 Mar 2024 08:47:47 -0600 Subject: [PATCH 01/14] Create 'ac-ansible-test.yml' --- .github/workflows/ac-ansible-test-sanity.yml | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/ac-ansible-test-sanity.yml diff --git a/.github/workflows/ac-ansible-test-sanity.yml b/.github/workflows/ac-ansible-test-sanity.yml new file mode 100644 index 000000000..364431a3f --- /dev/null +++ b/.github/workflows/ac-ansible-test-sanity.yml @@ -0,0 +1,38 @@ +name: AC Ansible sanity + +on: + pull_request: + branches: + - dev + - staging* + +jobs: + ansible-sanity: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Set up venv + run: | + python -m pip install --upgrade pip + pip install virtualenv + mkdir venv + virtualenv venv/venv-2.16 + + - name: Install dependencies + run: | + source venv/venv-2.16/bin/activate + python -m pip install --upgrade pip + pip install ansible + + - name: Run ac-sanity + run: | + source venv/venv-2.16/bin/activate + ./ac --ac-sanity From 78491b82bda7d12c3aa23363bb5ddb9d7941e8e6 Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Wed, 20 Mar 2024 09:36:00 -0600 Subject: [PATCH 02/14] Test --- changelogs/fragments/algo | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 changelogs/fragments/algo diff --git a/changelogs/fragments/algo b/changelogs/fragments/algo new file mode 100644 index 000000000..e69de29bb From 4245d3682879216ba7e806186385578e2a3d35b1 Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Wed, 20 Mar 2024 10:03:24 -0600 Subject: [PATCH 03/14] Add check changelog command to the ac tools --- .github/workflows/ac-ansible-test-sanity.yml | 38 -------------------- ac | 38 ++++++++++++++++++++ 2 files changed, 38 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/ac-ansible-test-sanity.yml diff --git a/.github/workflows/ac-ansible-test-sanity.yml b/.github/workflows/ac-ansible-test-sanity.yml deleted file mode 100644 index 364431a3f..000000000 --- a/.github/workflows/ac-ansible-test-sanity.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: AC Ansible sanity - -on: - pull_request: - branches: - - dev - - staging* - -jobs: - ansible-sanity: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.11 - - - name: Set up venv - run: | - python -m pip install --upgrade pip - pip install virtualenv - mkdir venv - virtualenv venv/venv-2.16 - - - name: Install dependencies - run: | - source venv/venv-2.16/bin/activate - python -m pip install --upgrade pip - pip install ansible - - - name: Run ac-sanity - run: | - source venv/venv-2.16/bin/activate - ./ac --ac-sanity diff --git a/ac b/ac index dad00194c..ab0dee94f 100755 --- a/ac +++ b/ac @@ -241,6 +241,28 @@ ac_build(){ $VENV_BIN/ansible-galaxy collection install -f ibm-ibm_zos_core-* } +# ------------------------------------------------------------------------------ +# Check for new files in the changelog. +# Comparing it to another branch. +# ------------------------------------------------------------------------------ +#->ac-check-changelog: +## Check for new files in the changelog. +## Usage: ac [--ac-check-changelog ] +## - Branch to compare with +## - This branch +## Example: +## $ ac-check-changelog --base dev --head test +ac_check_changelog(){ + option_base=$1 + option_head=$2 + if [ ! "$option_base" ]; then + option_base="dev" + fi + message "Check for new files in the changelog." + . $VENV_BIN/activate && git fetch && git checkout origin/"$option_base" && cd changelogs/fragments/ && LS_BASE="$(ls)" && cd .. && cd .. && git checkout "$option_head" ./changelogs/fragments/ && cd changelogs/fragments/ && LS_ALL="$(ls)" && [ "${#LS_ALL}" -gt "${#LS_BASE}" ] || echo "No new changelog file was found" && git checkout "$option_head" + +} + # ------------------------------------------------------------------------------ # Install an ibm_zos_core collection from galaxy (or how you have ansible.cfg configured) # ------------------------------------------------------------------------------ @@ -653,6 +675,10 @@ while true; do ensure_managed_venv_exists $1 option_submitted="--ac-build" ;; + --ac-check-changelog) # Command + ensure_managed_venv_exists $1 + option_submitted="--ac-check-changelog" + ;; --ac-install) ensure_managed_venv_exists $1 # Command option_submitted="--ac-install" @@ -716,6 +742,11 @@ while true; do ensure_managed_venv_exists $1 option_submitted="--venv-stop" ;; + --base|--base=?*) # option + base=`option_processor $1 $2` + option_sanitize $base + shift + ;; --debug|--debug=?*) # option debug=`option_processor $1 $2` option_sanitize $debug @@ -726,6 +757,11 @@ while true; do option_sanitize $file shift ;; + --head|--head=?*) # option + head=`option_processor $1 $2` + option_sanitize $head + shift + ;; --host|--host=?*) # option host=`option_processor $1 $2` option_sanitize $host @@ -800,6 +836,8 @@ if [ "$option_submitted" ] && [ "$option_submitted" = "--ac-bandit" ] ; then ac_bandit $level elif [ "$option_submitted" ] && [ "$option_submitted" = "--ac-build" ] ; then ac_build +elif [ "$option_submitted" ] && [ "$option_submitted" = "--ac-check-changelog" ] ; then + ac_check_changelog $base $head elif [ "$option_submitted" ] && [ "$option_submitted" = "--ac-install" ] ; then ac_install $version elif [ "$option_submitted" ] && [ "$option_submitted" = "--ac-lint" ] ; then From 4047bb2473e7b7331989c9aa8ed6989dc6802d5e Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Wed, 20 Mar 2024 10:10:35 -0600 Subject: [PATCH 04/14] Create ac-check-changelog.yml --- .github/workflows/ac-check-changelog.yml | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/ac-check-changelog.yml diff --git a/.github/workflows/ac-check-changelog.yml b/.github/workflows/ac-check-changelog.yml new file mode 100644 index 000000000..ac499445a --- /dev/null +++ b/.github/workflows/ac-check-changelog.yml @@ -0,0 +1,35 @@ +name: AC Check Changelog + +on: + pull_request: + branches: + - dev + - staging* + + +jobs: + check-changelog: + runs-on: ubuntu-latest + env: + PR_BASE: ${{ github.event.pull_request.base.ref }} + PR_HEAD: ${{ github.event.pull_request.head.ref }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Set up venv + run: | + python -m pip install --upgrade pip + pip install virtualenv + mkdir venv + virtualenv venv/venv-2.16 + + - name: Run ac-check-changelog + run: | + source venv/venv-2.16/bin/activate + ./ac --ac-check-changelog --base "$PR_BASE" --head "$PR_HEAD" \ No newline at end of file From ad355ba0241566cfb13b2cc772567998c99c4c7c Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Wed, 20 Mar 2024 10:25:57 -0600 Subject: [PATCH 05/14] Fix --- .github/workflows/ac-check-changelog.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ac-check-changelog.yml b/.github/workflows/ac-check-changelog.yml index ac499445a..47a740475 100644 --- a/.github/workflows/ac-check-changelog.yml +++ b/.github/workflows/ac-check-changelog.yml @@ -31,5 +31,4 @@ jobs: - name: Run ac-check-changelog run: | - source venv/venv-2.16/bin/activate ./ac --ac-check-changelog --base "$PR_BASE" --head "$PR_HEAD" \ No newline at end of file From b314a87de153c27fba390f8d9ffc72e117876f4f Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Wed, 20 Mar 2024 10:27:34 -0600 Subject: [PATCH 06/14] Fix --- .github/workflows/ac-check-changelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ac-check-changelog.yml b/.github/workflows/ac-check-changelog.yml index 47a740475..b277984e9 100644 --- a/.github/workflows/ac-check-changelog.yml +++ b/.github/workflows/ac-check-changelog.yml @@ -31,4 +31,4 @@ jobs: - name: Run ac-check-changelog run: | - ./ac --ac-check-changelog --base "$PR_BASE" --head "$PR_HEAD" \ No newline at end of file + ./ac --ac-check-changelog --base "$PR_BASE" --head origin/"$PR_HEAD" \ No newline at end of file From a709205513d034e6cf22b2ad3e443f8c14ad9b9a Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Wed, 20 Mar 2024 10:40:21 -0600 Subject: [PATCH 07/14] Change ac command --- ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ac b/ac index ab0dee94f..915418606 100755 --- a/ac +++ b/ac @@ -259,7 +259,7 @@ ac_check_changelog(){ option_base="dev" fi message "Check for new files in the changelog." - . $VENV_BIN/activate && git fetch && git checkout origin/"$option_base" && cd changelogs/fragments/ && LS_BASE="$(ls)" && cd .. && cd .. && git checkout "$option_head" ./changelogs/fragments/ && cd changelogs/fragments/ && LS_ALL="$(ls)" && [ "${#LS_ALL}" -gt "${#LS_BASE}" ] || echo "No new changelog file was found" && git checkout "$option_head" + . $VENV_BIN/activate && git fetch && git checkout origin/"$option_base" && cd changelogs/fragments/ && LS_BASE="$(ls)" && cd .. && cd .. && git checkout "$option_head" ./changelogs/fragments/ && cd changelogs/fragments/ && LS_ALL="$(ls)" && [ "${#LS_ALL}" -gt "${#LS_BASE}" ] && VAR="No new changelog file was found" && echo $VAR && [ "$VAR" = "No new changelog file was found" ] return 1 && git checkout "$option_head" } From 65d0e6cf5421b10c91d0b7da8725f73b5f7417c3 Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Wed, 20 Mar 2024 10:44:19 -0600 Subject: [PATCH 08/14] Change ac command --- ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ac b/ac index 915418606..1a8dbfeae 100755 --- a/ac +++ b/ac @@ -259,7 +259,7 @@ ac_check_changelog(){ option_base="dev" fi message "Check for new files in the changelog." - . $VENV_BIN/activate && git fetch && git checkout origin/"$option_base" && cd changelogs/fragments/ && LS_BASE="$(ls)" && cd .. && cd .. && git checkout "$option_head" ./changelogs/fragments/ && cd changelogs/fragments/ && LS_ALL="$(ls)" && [ "${#LS_ALL}" -gt "${#LS_BASE}" ] && VAR="No new changelog file was found" && echo $VAR && [ "$VAR" = "No new changelog file was found" ] return 1 && git checkout "$option_head" + . $VENV_BIN/activate && git fetch && git checkout origin/"$option_base" && cd changelogs/fragments/ && LS_BASE="$(ls)" && cd .. && cd .. && git checkout "$option_head" ./changelogs/fragments/ && cd changelogs/fragments/ && LS_ALL="$(ls)" && [ "${#LS_ALL}" -gt "${#LS_BASE}" ] && VAR="No new changelog file was found" && echo $VAR && [ "$VAR" != "No new changelog file was found" ] || return 1 && git checkout "$option_head" } From b221687e91da6ab52bbece6b7b49b1452f5e39e9 Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Wed, 20 Mar 2024 10:46:37 -0600 Subject: [PATCH 09/14] Change ac command --- ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ac b/ac index 1a8dbfeae..afb131054 100755 --- a/ac +++ b/ac @@ -259,7 +259,7 @@ ac_check_changelog(){ option_base="dev" fi message "Check for new files in the changelog." - . $VENV_BIN/activate && git fetch && git checkout origin/"$option_base" && cd changelogs/fragments/ && LS_BASE="$(ls)" && cd .. && cd .. && git checkout "$option_head" ./changelogs/fragments/ && cd changelogs/fragments/ && LS_ALL="$(ls)" && [ "${#LS_ALL}" -gt "${#LS_BASE}" ] && VAR="No new changelog file was found" && echo $VAR && [ "$VAR" != "No new changelog file was found" ] || return 1 && git checkout "$option_head" + . $VENV_BIN/activate && git fetch && git checkout origin/"$option_base" && cd changelogs/fragments/ && LS_BASE="$(ls)" && cd .. && cd .. && git checkout "$option_head" ./changelogs/fragments/ && cd changelogs/fragments/ && LS_ALL="$(ls)" && git checkout "$option_head" && [ "${#LS_ALL}" -gt "${#LS_BASE}" ] && VAR="No new changelog file was found" && echo $VAR && [ "$VAR" != "No new changelog file was found" ] || return 1 } From f8de9edb9e61dca8afeca7a5af45b5aced6af1df Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Wed, 20 Mar 2024 10:48:31 -0600 Subject: [PATCH 10/14] Change ac command --- ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ac b/ac index afb131054..da8de8f69 100755 --- a/ac +++ b/ac @@ -259,7 +259,7 @@ ac_check_changelog(){ option_base="dev" fi message "Check for new files in the changelog." - . $VENV_BIN/activate && git fetch && git checkout origin/"$option_base" && cd changelogs/fragments/ && LS_BASE="$(ls)" && cd .. && cd .. && git checkout "$option_head" ./changelogs/fragments/ && cd changelogs/fragments/ && LS_ALL="$(ls)" && git checkout "$option_head" && [ "${#LS_ALL}" -gt "${#LS_BASE}" ] && VAR="No new changelog file was found" && echo $VAR && [ "$VAR" != "No new changelog file was found" ] || return 1 + . $VENV_BIN/activate && git fetch && git checkout origin/"$option_base" && cd changelogs/fragments/ && LS_BASE="$(ls)" && cd .. && cd .. && git checkout "$option_head" ./changelogs/fragments/ && cd changelogs/fragments/ && LS_ALL="$(ls)" && git checkout "$option_head" && [ "${#LS_ALL}" -gt "${#LS_BASE}" ] || (echo "No new changelog file was found" && return 1) #echo $VAR && [ "$VAR" != "No new changelog file was found" ] || } From e0ab06476655c76bf706778c167d5ab62e20faf4 Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Wed, 20 Mar 2024 10:51:11 -0600 Subject: [PATCH 11/14] Delete test changelog --- changelogs/fragments/algo | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 changelogs/fragments/algo diff --git a/changelogs/fragments/algo b/changelogs/fragments/algo deleted file mode 100644 index e69de29bb..000000000 From 12673db0c180caa59ce01a8dc14fa9affadab147 Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Fri, 5 Apr 2024 12:32:54 -0600 Subject: [PATCH 12/14] Delete some blank spaces --- .github/workflows/ac-check-changelog.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ac-check-changelog.yml b/.github/workflows/ac-check-changelog.yml index b277984e9..aafbcd4dd 100644 --- a/.github/workflows/ac-check-changelog.yml +++ b/.github/workflows/ac-check-changelog.yml @@ -6,13 +6,12 @@ on: - dev - staging* - jobs: check-changelog: runs-on: ubuntu-latest env: PR_BASE: ${{ github.event.pull_request.base.ref }} - PR_HEAD: ${{ github.event.pull_request.head.ref }} + PR_HEAD: ${{ github.event.pull_request.head.ref }} steps: - name: Checkout repository uses: actions/checkout@v4 From b2c602210cc8329827e217cd62ee3059f12c4562 Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Thu, 11 Apr 2024 08:57:41 -0600 Subject: [PATCH 13/14] Add paths-ignore --- .github/workflows/ac-check-changelog.yml | 32 +++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ac-check-changelog.yml b/.github/workflows/ac-check-changelog.yml index aafbcd4dd..c4c85a7e7 100644 --- a/.github/workflows/ac-check-changelog.yml +++ b/.github/workflows/ac-check-changelog.yml @@ -5,6 +5,36 @@ on: branches: - dev - staging* + paths-ignore: + - '**.tar.gz' + - 'pycache/**' + - '.ansible-lint' + - 'cache/**' + - '.DS_Store' + - '.git/**' + - '.github/**' + - '.gitignore' + - '.python-version' + - '.pytest_cache/**' + - '.vscode/**' + - 'Jenkinsfile' + - 'ac' + - 'ansible.cfg' + - 'changelogs/**' + - 'collections/**' + - 'docs/**' + - 'scripts/**' + - 'test_config.yml' + - 'tests/*.ini' + - 'tests/*.py' + - 'tests/.pytest_cache' + - 'tests/pycache' + - 'tests/functional' + - 'tests/helpers' + - 'tests/requirements.txt' + - 'tests/unit' + - 'tests/sanity/ignore-*' + - 'venv*' jobs: check-changelog: @@ -30,4 +60,4 @@ jobs: - name: Run ac-check-changelog run: | - ./ac --ac-check-changelog --base "$PR_BASE" --head origin/"$PR_HEAD" \ No newline at end of file + ./ac --ac-check-changelog --base "$PR_BASE" --head origin/"$PR_HEAD" From e3ea200d964cab068efa1d365ed946a10d358c97 Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Thu, 11 Apr 2024 08:58:29 -0600 Subject: [PATCH 14/14] Update ac-check-changelog.yml --- .github/workflows/ac-check-changelog.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ac-check-changelog.yml b/.github/workflows/ac-check-changelog.yml index c4c85a7e7..7042b4ad3 100644 --- a/.github/workflows/ac-check-changelog.yml +++ b/.github/workflows/ac-check-changelog.yml @@ -20,7 +20,6 @@ on: - 'Jenkinsfile' - 'ac' - 'ansible.cfg' - - 'changelogs/**' - 'collections/**' - 'docs/**' - 'scripts/**'