Skip to content

ci: update actions #948

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

Merged
merged 8 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,21 @@ jobs:
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

- uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7
- uses: google-github-actions/auth@v2
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
- run: |-
gcloud --quiet auth configure-docker
credentials_json: ${{ secrets.GKE_SA_KEY }}

- uses: google-github-actions/get-gke-credentials@fb08709ba27618c31c09e014e1d8364b02e5042e
- id: get-credentials
uses: google-github-actions/get-gke-credentials@v2
with:
cluster_name: ${{ env.GKE_CLUSTER_NAME }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}

- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.10.0


- name: Installing repositories
run: |
helm repo add bitnami https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/helm-deploy-testkube-charts-develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,15 @@ jobs:
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

- uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7
- uses: google-github-actions/auth@v2
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
- run: |-
gcloud --quiet auth configure-docker
credentials_json: ${{ secrets.GKE_SA_KEY }}

- uses: google-github-actions/get-gke-credentials@fb08709ba27618c31c09e014e1d8364b02e5042e
- id: get-credentials
uses: google-github-actions/get-gke-credentials@v2
with:
cluster_name: ${{ env.GKE_CLUSTER_NAME }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}

- name: Install Helm
uses: azure/setup-helm@v3
Expand Down
35 changes: 8 additions & 27 deletions .github/workflows/helm-releaser-testkube-charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ concurrency: develop_cluster
on:
push:
paths:
- ".github/workflows/helm-releaser-testkube-charts.yaml"
- "charts/testkube/Chart.yaml"
- "charts/testkube-api/Chart.yaml"
- "charts/testkube-dashboard/Chart.yaml"
- "charts/testkube-operator/Chart.yaml"
- "charts/testkube-api/executors.json"
branches:
- main

Expand Down Expand Up @@ -186,23 +183,15 @@ jobs:
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7
- uses: google-github-actions/auth@v2
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
credentials_json: ${{ secrets.GKE_SA_KEY }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker

# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/get-gke-credentials@fb08709ba27618c31c09e014e1d8364b02e5042e
- id: get-credentials
uses: google-github-actions/get-gke-credentials@v2
with:
cluster_name: ${{ env.GKE_CLUSTER_NAME }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}

- name: Install Helm
uses: azure/setup-helm@v3
Expand Down Expand Up @@ -370,23 +359,15 @@ jobs:
runs-on: ubuntu-latest
needs: deploy-to-testkube-dev-gke
steps:
# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7
- uses: google-github-actions/auth@v2
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
credentials_json: ${{ secrets.GKE_SA_KEY }}

# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/get-gke-credentials@fb08709ba27618c31c09e014e1d8364b02e5042e
- id: get-credentials
uses: google-github-actions/get-gke-credentials@v2
with:
cluster_name: ${{ env.GKE_CLUSTER_NAME }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}

- name: Install testkube kubectl plugin
run: bash < <(curl -sSLf https://get.testkube.io )
Expand Down
41 changes: 10 additions & 31 deletions .github/workflows/helm-releaser-testkube-main-chart-only.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ on:
push:
paths:
- "charts/testkube**"
- "scripts/main_chart_releaser.sh"
- "charts/testkube/values-stage.yaml"
- ".github/workflows/helm-releaser-testkube-main-chart-only.yaml"
- "!charts/testkube/Chart.yaml"
- "!charts/testkube-api/Chart.yaml"
- "!charts/testkube-dashboard/Chart.yaml"
- "!charts/testkube-operator/Chart.yaml"
- "!charts/testkube-api/executors.json"
branches:
- main

Expand Down Expand Up @@ -186,23 +181,15 @@ jobs:
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7
- uses: google-github-actions/auth@v2
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
credentials_json: ${{ secrets.GKE_SA_KEY }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker

# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/get-gke-credentials@fb08709ba27618c31c09e014e1d8364b02e5042e
- id: get-credentials
uses: google-github-actions/get-gke-credentials@v2
with:
cluster_name: ${{ env.GKE_CLUSTER_NAME }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}

- name: Install Helm
uses: azure/setup-helm@v3
Expand Down Expand Up @@ -369,23 +356,15 @@ jobs:
runs-on: ubuntu-latest
needs: deploy-to-testkube-dev-gke
steps:
# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7
- uses: google-github-actions/auth@v2
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
credentials_json: ${{ secrets.GKE_SA_KEY }}

# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/get-gke-credentials@fb08709ba27618c31c09e014e1d8364b02e5042e
- id: get-credentials
uses: google-github-actions/get-gke-credentials@v2
with:
cluster_name: ${{ env.GKE_CLUSTER_NAME_DEV }}
location: ${{ env.GKE_ZONE_DEV }}
credentials: ${{ secrets.GKE_SA_KEY }}
cluster_name: ${{ env.GKE_CLUSTER_NAME }}
location: ${{ env.GKE_ZONE }}

- name: Install testkube kubectl plugin
run: bash < <(curl -sSLf https://get.testkube.io )
Expand Down
60 changes: 11 additions & 49 deletions scripts/chart_releaser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set -o pipefail
while [[ "$#" -gt 0 ]]; do
case $1 in
-h|--helm-chart-folder) target_folder="$2"; shift ;;
-e|--testkube-executor) testkube_executor="$2"; shift ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
Expand Down Expand Up @@ -56,61 +55,24 @@ fi
# Output the new chart version
echo "New Testkube Chart version is: $NEW_VERSION"

if [[ $testkube_executor == "" ]]
then
echo "Executors will not be updated"
# Lower-casing entered helm-chart-folder name to omit any issues with Upper case letters.
target_folder=$(echo "$target_folder" | tr '[:upper:]' '[:lower:]')
# Editing $target_folder Chart, and its App versions:
sed -i "s/^version: .*$/version: $VERSION_FULL/" ../charts/$target_folder/Chart.yaml
sed -i "s/^appVersion: .*$/appVersion: $VERSION_FULL/" ../charts/$target_folder/Chart.yaml
echo -e "\nChecking changes made to Chart.yaml of $target_folder\n"
cat ../charts/$target_folder/Chart.yaml

# Editing $target_folder Chart, and its App versions:
sed -i "s/^version: .*$/version: $VERSION_FULL/" ../charts/$target_folder/Chart.yaml
sed -i "s/^appVersion: .*$/appVersion: $VERSION_FULL/" ../charts/$target_folder/Chart.yaml
echo -e "\nChecking changes made to Chart.yaml of $target_folder\n"
cat ../charts/$target_folder/Chart.yaml

# Editing TestKube's dependency Chart.yaml for $target_folder:
sed -i "/name: $target_folder/{n;s/^.*version.*/ version: $VERSION_FULL/}" ../charts/testkube/Chart.yaml
echo -e "\nChecking if TestKube's Chart.yaml dependencies has been updated:\n"
grep -iE -A 1 "name: $target_folder" ../charts/testkube/Chart.yaml

else
echo "Executors will be updated"
executor_name="artillery curl cypress ginkgo gradle init jmeter jmeterd k6 kubepug maven playwright postman scraper soapui tracetest zap logs-sidecar"
for executor in $executor_name; do
sed -i "s/\(\"image\":.*$executor.*:\)[^\"]*\(\"\)/\1$VERSION_FULL\2/" ../charts/testkube-api/executors.json
echo -e "\nChecking if TestKube's executors.json $executor executor has been updated:\n"
grep -iE image ../charts/testkube-api/executors.json | grep $executor
done

target_folder=$(echo "$target_folder" | tr '[:upper:]' '[:lower:]')

# Editing $target_folder Chart, and its App versions:
sed -i "s/^version: .*$/version: $VERSION_FULL/" ../charts/$target_folder/Chart.yaml
sed -i "s/^appVersion: .*$/appVersion: $VERSION_FULL/" ../charts/$target_folder/Chart.yaml
echo -e "\nChecking changes made to Chart.yaml of $target_folder\n"
cat ../charts/$target_folder/Chart.yaml

# Editing TestKube's dependency Chart.yaml for $target_folder:
sed -i "/name: $target_folder/{n;s/^.*version.*/ version: $VERSION_FULL/}" ../charts/testkube/Chart.yaml
echo -e "\nChecking if TestKube's Chart.yaml dependencies has been updated:\n"
grep -iE -A 1 "name: $target_folder" ../charts/testkube/Chart.yaml
fi
# Editing TestKube's dependency Chart.yaml for $target_folder:
sed -i "/name: $target_folder/{n;s/^.*version.*/ version: $VERSION_FULL/}" ../charts/testkube/Chart.yaml
echo -e "\nChecking if TestKube's Chart.yaml dependencies has been updated:\n"
grep -iE -A 1 "name: $target_folder" ../charts/testkube/Chart.yaml

# Editing TestKube's main chart version:
sed -i "s/^version:.*/version: $NEW_VERSION/" ../charts/testkube/Chart.yaml
sed -i "s/^version:.*/version: $NEW_VERSION/" ../charts/testkube/Chart.yaml
echo -e "\nChecking if testkube's main Chart.yaml version has been updated:\n"
grep -iE "^version" ../charts/testkube/Chart.yaml

# Commiting and pushing changes to main
## Commiting and pushing changes to main
git add -A
git commit -m "Tag: $VERSION_FULL; $target_folder CI/CD. Bumped helm chart, app and docker image tag versions."
git push --set-upstream https://kubeshop-bot:[email protected]/kubeshop/helm-charts main

# Update Chart.yaml file in develop branch
git fetch origin develop
git checkout develop
git checkout main -- ../charts/testkube/Chart.yaml ../charts/$target_folder/Chart.yaml
git add ../charts/testkube/Chart.yaml ../charts/$target_folder/Chart.yaml
git commit -m "Update Chart.yaml files"
git push --set-upstream https://kubeshop-bot:[email protected]/kubeshop/helm-charts develop

8 changes: 0 additions & 8 deletions scripts/main_chart_releaser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,3 @@ git commit -m "Tag: $tk_version_full_bumped; CI/CD. Bumped main helm chart versi

# git push origin main
git push --set-upstream https://kubeshop-bot:[email protected]/kubeshop/helm-charts main

# Update Chart.yaml file in develop branch
git fetch origin develop
git checkout develop
git checkout main -- ../charts/testkube/Chart.yaml
git add ../charts/testkube/Chart.yaml
git commit -m "Update Chart.yaml file"
git push --set-upstream https://kubeshop-bot:[email protected]/kubeshop/helm-charts develop