Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add check for release branch #3780

Merged
merged 1 commit into from
May 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 30 additions & 59 deletions .github/workflows/docker-build-api-executors-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -376,81 +376,52 @@ jobs:
DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max"

update_api_helm_charts:
needs: [api]
needs: [api, single_executor, executor_jmeter, executor_maven, executor_gradle, executor_cypress, executor_cypress_manifest, executor_playwright]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
with:
fetch-depth: 0

- name: getting Tag name
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
strip_v: false

- name: Editing helm-release repo with version based on a Tag pushed.
run: |

# Setting up Git:

git clone https://kubeshop-bot:[email protected]/kubeshop/helm-charts
cd ./helm-charts
git config user.name "kubeshop-bot"
git config user.email "[email protected]"

git fetch origin "release-$RELEASE_VERSION"
git checkout "release-$RELEASE_VERSION"

# Calling chart releaser script by passing needed folder name:
# E.G. in order to relase api-server":
# -->> ./chart_releaser.sh --helm-chart-folder api-server

export GH_PUSH_TOKEN
export RELEASE_VERSION

cd ./scripts
./chart_releaser.sh --helm-chart-folder testkube-api --main-chart false

env:
GH_PUSH_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}

update_executors_helm_charts:
needs: [single_executor, executor_jmeter, executor_maven, executor_gradle, executor_cypress, executor_cypress_manifest, executor_playwright ]
runs-on: ubuntu-latest
steps:
- name: Editing helm-release repo with version based on a Tag pushed.
run: |

# Setting up Git:
# Check if release branch exists
REPO_OWNER=kubeshop
REPO_NAME=helm-charts
RELEASE_BRANCH_NAME=release-$RELEASE_VERSION
echo $RELEASE_VERSION
STATUS=$(curl -s -o /dev/null -w '%{http_code}' -H "${AUTH_HEADER}" "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/branches/${RELEASE_BRANCH_NAME}")

if [ "${STATUS}" -eq 404 ]; then
git fetch origin main
git checkout main
cd ./scripts
./chart_releaser.sh --helm-chart-folder testkube-api --testkube-executor true
else
git fetch origin "release-$RELEASE_VERSION"
git checkout "release-$RELEASE_VERSION"
echo "Switched to release branch"
cd ./scripts
./chart_releaser.sh --helm-chart-folder testkube-api --testkube-executor true --branch true

git checkout main
git merge "release-$RELEASE_VERSION"
git push --set-upstream https://kubeshop-bot:[email protected]/kubeshop/helm-charts main
git push origin -d "release-$RELEASE_VERSION"
fi

git clone https://kubeshop-bot:[email protected]/kubeshop/helm-charts
cd ./helm-charts
git config user.name "kubeshop-bot"
git config user.email "[email protected]"

git fetch origin "release-$RELEASE_VERSION"
git checkout "release-$RELEASE_VERSION"

# Calling chart releaser script by passing needed folder name:
# E.G. in order to relase api-server":
# -->> ./chart_releaser.sh --helm-chart-folder api-server

export GH_PUSH_TOKEN
export RELEASE_VERSION

cd ./scripts
executors="artillery curl cypress ginkgo gradle init jmeter k6 kubepug maven playwright postman scraper soapui"
for executor in $executors
do
./chart_releaser.sh --testkube-executor-name ${executor} --main-chart false --branch true
done

git checkout main
git merge "release-$RELEASE_VERSION"
# git push origin main
git push --set-upstream https://kubeshop-bot:[email protected]/kubeshop/helm-charts main
env:
GH_PUSH_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
RELEASE_VERSION: ${{ github.event.client_payload.release_version }}

RELEASE_VERSION: ${{ steps.vars.outputs.tag }}