Skip to content

Pre Release Workflow #49

Pre Release Workflow

Pre Release Workflow #49

name: Pre Release Workflow
on:
workflow_dispatch:
inputs:
release_version:
description: 'Version of Splunk Operator Release'
required: true
old_operator_version:
description: 'OLD OPERATOR VERSION'
required: true
new_operator_version:
description: 'NEW OPERATOR VERSION'
required: true
old_operator_image_version:
description: 'OLD OPERATOR IMAGE VERSION'
required: true
new_operator_image_version:
description: 'NEW OPERATOR IMAGE VERSION'
required: true
old_enterprise_version:
description: 'OLD ENTERPRISE IMAGE VERSION'
required: true
new_enterprise_version:
description: 'NEW ENTERPRISE IMAGE VERSION'
required: true
jobs:
automated-release:
name: Automated Pre Release
permissions:
# Need the write permission because this job commits changes to some folders like dist
contents: write
pull-requests: write
runs-on: ubuntu-latest
if:
contains('
refs/heads/develop
', github.ref)
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Deep Fetch
run: |
git fetch --prune --unshallow
- name: Create ChangeLog since last release
run: |
git log $(git describe --tags --abbrev=0)..HEAD --oneline >> docs/ChangeLog-NEW.md
- name: Dotenv Action
id: dotenv
uses: falti/dotenv-action@d4d12eaa0e1dd06d5bdc3d7af3bf4c8c93cb5359
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0
- name: Configure Docker Credentials
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PUSH_TOKEN}}
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.dotenv.outputs.GO_VERSION }}
- name: Install goveralls
run: |
go get github.com/mattn/goveralls@latest
- name: Update Operator Image name in Helm
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3
with:
find: "splunk-operator:${{ github.event.inputs.old_operator_version }}"
replace: "splunk-operator:${{ github.event.inputs.new_operator_version }}"
exclude: "ChangeLog.md"
include: "values.yaml"
- name: Update Helm Version
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3
with:
find: "version: ${{ github.event.inputs.old_operator_version }}"
replace: "version: ${{ github.event.inputs.new_operator_version }}"
exclude: "ChangeLog.md"
include: "Chart.yaml"
- name: Update Helm App Version
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3
with:
find: "appVersion: ${{ github.event.inputs.old_operator_version }}"
replace: "appVersion: ${{ github.event.inputs.new_operator_version }}"
exclude: "ChangeLog.md"
include: "Chart.yaml"
- name: Update Operator Image name in DOCS
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3
with:
find: "splunk-operator:${{ github.event.inputs.old_operator_version }}"
replace: "splunk-operator:${{ github.event.inputs.new_operator_version }}"
exclude: "ChangeLog.md"
include: "**.md"
- name: Update Splunk Operator Install URL in DOCS
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3
with:
find: "/download/${{ github.event.inputs.old_operator_version }}/splunk-operator"
replace: "/download/${{ github.event.inputs.new_operator_version }}/splunk-operator"
exclude: "ChangeLog.md"
include: "**.md"
- name: Update Splunk Operator VERSION in DOCS
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3
with:
find: "${{ github.event.inputs.old_operator_version }} or later"
replace: "${{ github.event.inputs.new_operator_version }} or later"
exclude: "ChangeLog.md"
include: "**.md"
- name: Update Splunk Operator upgrade string in DOCS
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3
with:
find: "Steps to upgrade from version greater than 1.0.5 to ${{ github.event.inputs.old_operator_version }}"
replace: "Steps to upgrade from version greater than 1.0.5 to ${{ github.event.inputs.new_operator_version }}"
exclude: "ChangeLog.md"
include: "**.md"
- name: Update Splunk Operator Release URL in DOCS
if: github.event.inputs.old_operator_version != github.event.inputs.new_operator_version
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3
with:
find: "https://github.com/splunk/splunk-operator/releases/download/${{ github.event.inputs.old_operator_version }}/splunk-operator-install.yaml"
replace: "https://github.com/splunk/splunk-operator/releases/download/${{ github.event.inputs.new_operator_version }}/splunk-operator-install.yaml"
exclude: "ChangeLog.md"
include: "**.md"
- name: Update Splunk Enterprise Image in operator.yaml
if: github.event.inputs.old_enterprise_version != github.event.inputs.new_enterprise_version
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3
with:
find: "${{ github.event.inputs.old_enterprise_version }}"
replace: "${{ github.event.inputs.new_enterprise_version }}"
include: "**operator.yaml"
- name: Update Splunk Enterprise Release Image in .env file
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3
with:
find: "${{ github.event.inputs.old_enterprise_version }}"
replace: "${{ github.event.inputs.new_enterprise_version }}"
include: ".env"
- name: Update Splunk Enterprise Image in helm
if: github.event.inputs.old_enterprise_version != github.event.inputs.new_enterprise_version
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3
with:
find: "${{ github.event.inputs.old_enterprise_version }}"
replace: "${{ github.event.inputs.new_enterprise_version }}"
include: "**values.yaml"
- name: Update Splunk Enterprise image in DOCS
if: github.event.inputs.old_enterprise_version != github.event.inputs.new_enterprise_version
uses: jacobtomlinson/gha-find-replace@f485fdc3f67a6d87ae6e3d11e41f648c26d7aee3
with:
find: "${{ github.event.inputs.old_enterprise_version }} or later"
replace: "${{ github.event.inputs.new_enterprise_version }} or later"
exclude: "ChangeLog.md"
include: "**.md"
- name: Install Operator SDK
run: |
export ARCH=$(case $(uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; *) echo -n $(uname -m) ;; esac)
export OS=$(uname | awk '{print tolower($0)}')
export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/${{ steps.dotenv.outputs.OPERATOR_SDK_VERSION }}
sudo curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
sudo chmod +x operator-sdk_${OS}_${ARCH}
sudo mv operator-sdk_${OS}_${ARCH} /usr/local/bin/operator-sdk
- name: Run Bundle Creation for the release
run: |
make bundle IMAGE_TAG_BASE=docker.io/splunk/splunk-operator VERSION=${{ github.event.inputs.release_version }} IMG=docker.io/splunk/splunk-operator:${{ github.event.inputs.release_version }} SPLUNK_ENTERPRISE_IMAGE=docker.io/splunk/splunk:${{ github.event.inputs.new_enterprise_version }}
- name: Run helm chart package creation
run: |
helm package helm-chart/splunk-operator
cp splunk-operator-${{ github.event.inputs.new_operator_version }}.tgz docs/
mv splunk-operator-${{ github.event.inputs.new_operator_version }}.tgz helm-chart/splunk-enterprise/charts
helm package helm-chart/splunk-enterprise
mv splunk-enterprise-${{ github.event.inputs.new_operator_version }}.tgz docs/
helm repo index --url https://splunk.github.io/splunk-operator/ docs/
- name: Reset go.mod and go.sum before creating Pull Request
run: |
git checkout go.sum
git checkout go.mod
git status
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3.10.1
with:
branch: "release/${{ github.event.inputs.release_version }}"
title: "Splunk Operator ${{ github.event.inputs.release_version }} release"
reviewers: "${{ steps.dotenv.outputs.REVIEWERS }}"
body: |
### Automated Pull Request for Splunk Operator Release ${{ github.event.inputs.release_version }}
* Changes added to docs/ChangeLog-NEW.md. Please filter and update ChangeLog.md
* Delete ChangeLog-New.md