Skip to content

Commit

Permalink
ci: split SC4S and Splunk updates (#163)
Browse files Browse the repository at this point in the history
This PR splits PR creation for SC4S and Splunk updates so those could be
merged independently.
  • Loading branch information
artemrys authored Jun 18, 2024
1 parent c3718a2 commit 7f82e50
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 35 deletions.
19 changes: 1 addition & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
# ########################################################################
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ########################################################################
on:
push:
branches:
Expand All @@ -37,9 +22,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.7"
- uses: pre-commit/[email protected]

build_release:
runs-on: ubuntu-latest
needs: pre-commit
Expand All @@ -50,7 +34,6 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- run: sudo snap install yq
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
Expand Down
50 changes: 37 additions & 13 deletions .github/workflows/update_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,68 @@ on:
- cron: "0 05 * * SUN"

jobs:
build:
sc4s:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- run: ./sc4s_sync.sh
- uses: crazy-max/ghaction-import-gpg@v6
with:
python-version: "3.7"
- name: Update SC4S Version
run: |
./sc4s_sync.sh
- name: Update Splunk Builds
gpg_private_key: ${{ secrets.SA_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.SA_GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Create PR with new version
run: |
./splunk_sync.sh
git config --global user.email ${{ secrets.GH_USER_EMAIL }}
git config --global user.name ${{ secrets.GH_USER_ADMIN }}
git config --global commit.gpgsign true
BRANCH_NAME="fix/update-sc4s-version"
( git checkout "$BRANCH_NAME" && git checkout main && git branch -D "$BRANCH_NAME" ) || true
git checkout -B "$BRANCH_NAME"
git add . || exit 1
git commit -am "fix: update SC4S version" || true
git push -f --set-upstream origin "$BRANCH_NAME" || true
sleep 10s
gh pr create \
--title "fix: bump SC4S version" --fill --head "$BRANCH_NAME" || true
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_ADMIN }}

splunk:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: ./splunk_sync.sh
- uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.SA_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.SA_GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Create PR with new versions
- name: Create PR with new version
run: |
git config --global user.email ${{ secrets.GH_USER_EMAIL }}
git config --global user.name ${{ secrets.GH_USER_ADMIN }}
git config --global commit.gpgsign true
BRANCH_NAME="fix/update-versions"
BRANCH_NAME="fix/update-splunk-version"
( git checkout "$BRANCH_NAME" && git checkout main && git branch -D "$BRANCH_NAME" ) || true
git checkout -B "$BRANCH_NAME"
git add . || exit 1
git commit -am "fix: update sc4s/splunk versions" || true
git commit -am "fix: update Splunk version" || true
git push -f --set-upstream origin "$BRANCH_NAME" || true
sleep 10s
gh pr create \
--title "fix: bump sc4s/splunk versions" --fill --head "$BRANCH_NAME" || true
--title "fix: bump Splunk version" --fill --head "$BRANCH_NAME" || true
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_ADMIN }}
5 changes: 1 addition & 4 deletions splunk_matrix_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ def get_latest_image(stanza, images):


def check_image_version(latest_image, stanza_image):
if version.parse(latest_image) > version.parse(stanza_image):
return True
else:
return False
return version.parse(latest_image) > version.parse(stanza_image)


def filter_image_list(images_list):
Expand Down

0 comments on commit 7f82e50

Please sign in to comment.