From 953e5702bec00bad616683b4a4722d9cb4857200 Mon Sep 17 00:00:00 2001 From: "Devang Mehta (C)" Date: Fri, 12 Feb 2021 15:48:02 +0530 Subject: [PATCH] test: updated review comments --- .github/workflows/sc4s_matrix.yml | 4 ++-- .github/workflows/splunk_matrix.yml | 4 ++-- sc4s_sync.sh | 14 +++++++------- splunk_sync.sh | 15 ++++++--------- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.github/workflows/sc4s_matrix.yml b/.github/workflows/sc4s_matrix.yml index c2bec4f..71f1fc4 100644 --- a/.github/workflows/sc4s_matrix.yml +++ b/.github/workflows/sc4s_matrix.yml @@ -1,7 +1,7 @@ name: Check Package Version on: schedule: - - cron: "0 22 * * SAT" + - cron: "0 15 * * SAT" jobs: build: @@ -33,7 +33,7 @@ jobs: test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile - - name: Run Test + - name: Update SC4S Version env: GITHUB_USER: ${{ secrets.GH_USER }} GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/splunk_matrix.yml b/.github/workflows/splunk_matrix.yml index c0b66d5..7baa313 100644 --- a/.github/workflows/splunk_matrix.yml +++ b/.github/workflows/splunk_matrix.yml @@ -1,7 +1,7 @@ name: Check Package Version on: schedule: - - cron: "0 22 * * SUN" + - cron: "0 15 * * SUN" jobs: build: @@ -33,7 +33,7 @@ jobs: test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile - - name: Run Test + - name: Update Splunk Builds env: GITHUB_USER: ${{ secrets.GH_USER }} GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/sc4s_sync.sh b/sc4s_sync.sh index 5e804be..28d121f 100644 --- a/sc4s_sync.sh +++ b/sc4s_sync.sh @@ -7,14 +7,14 @@ if [[ $GITHUB_USER && ${GITHUB_USER-x} ]] then echo "GITHUB_USER Found" else - echo "GITHUB_USER Not found" + echo "GITHUB_USER Not Found" exit 1 fi if [[ $GITHUB_TOKEN && ${GITHUB_TOKEN-x} ]] then echo "GITHUB_TOKEN Found" else - echo "GITHUB_TOKEN Not found" + echo "GITHUB_TOKEN Not Found" exit 1 fi @@ -25,18 +25,16 @@ latest_tag=$(curl -s https://api.github.com/repos/splunk/splunk-connect-for-sysl new_value=$(echo $latest_tag | rev | cut -c3- | rev) new_value=$(echo $new_value | cut -c3-) echo $new_value -sudo apt-get install -y python3 python3.7 python3-pip + pip install pip --upgrade python -m pip install packaging -git checkout test/version-change var=`python -c "from packaging import version; print('True' if(version.parse(str('$new_value')) > version.parse(str('$current_tag'))) else 'False')"` echo $var if [ "$var" = "True" ]; then - # Logic for to raise pull request git config --global user.email "addonfactory@splunk.com" git config --global user.name "Addon Factory template" BRANCH=test/sc4s-version-update @@ -45,11 +43,13 @@ then git diff git add SC4S_matrix.conf git status - git commit -m "test: updated new $new_value version to matrix file" + git commit -m "test: new sc4s version $new_value update" git push -f --set-upstream origin $BRANCH git log | head git checkout master git merge test/sc4s-version-update + git push origin master + git branch -d test/sc4s-version-update else - echo "Latest $new_value version is only available in Matrix" + echo "SC4S version update not required" fi diff --git a/splunk_sync.sh b/splunk_sync.sh index a010ba2..e00106d 100644 --- a/splunk_sync.sh +++ b/splunk_sync.sh @@ -7,22 +7,18 @@ if [[ $GITHUB_USER && ${GITHUB_USER-x} ]] then echo "GITHUB_USER Found" else - echo "GITHUB_USER Not found" + echo "GITHUB_USER Not Found" exit 1 fi if [[ $GITHUB_TOKEN && ${GITHUB_TOKEN-x} ]] then echo "GITHUB_TOKEN Found" else - echo "GITHUB_TOKEN Not found" + echo "GITHUB_TOKEN Not Found" exit 1 fi -sudo apt-get install -y python3 python3.7 python3-pip pip install pip --upgrade - -git checkout test/version-change - python -m pip install -r requirements.txt splunk_version=$(python splunk_matrix_update.py) echo $splunk_version @@ -30,7 +26,6 @@ echo $splunk_version if [ "$splunk_version" = "True" ]; then - # Logic for to raise pull request git config --global user.email "addonfactory@splunk.com" git config --global user.name "Addon Factory template" BRANCH=test/splunk-version-update @@ -38,10 +33,12 @@ then git diff git add . git status - git commit -m "test: updated new Splunk version to matrix file" + git commit -m "test: splunk build update" git push -f --set-upstream origin $BRANCH git checkout master git merge test/splunk-version-update + git push origin master + git branch -d test/splunk-version-update else - echo "Latest Splunk version is only available in Matrix" + echo "Splunk build update not required" fi