Skip to content

Commit 0732e17

Browse files
EVEREST-107 Simplify Feature Builds (#1019)
* EVEREST-107 Simplify steps to run a FB By embedding all the artifacts in a single directory we can remove the complexity of setting the env vars. * EVEREST-107 feature build - wait for the port-forward to be ready * EVEREST-107 increase FB VS ready timeout to 60s Sometimes the default 30s isn't enought and we are seeing error: readyReplicas is not found --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 314073c commit 0732e17

File tree

4 files changed

+49
-119
lines changed

4 files changed

+49
-119
lines changed

.github/workflows/feature-build.yaml

+31-70
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ jobs:
9999
echo "VERSION_TAG=v$V" >> $GITHUB_ENV
100100
echo "VS_TAG=everest-test$TIMESTAMP" >> $GITHUB_ENV
101101
102+
- name: Create temporary directory for storing artifacts
103+
run: |
104+
mkdir -p /tmp/${VERSION}
102105
103106
- name: Set GO_VERSION environment variable
104107
run: |
@@ -211,15 +214,9 @@ jobs:
211214
CRD_VERSION=${{ env.VERSION_TAG }} make crds-gen
212215
make release-dev
213216
214-
- name: Helm - Create tar.gz archive
217+
- name: Helm - copy chart
215218
run: |
216-
tar -czvf helm.tar.gz percona-helm-charts/charts/everest
217-
218-
- name: Helm - Upload artifact
219-
uses: actions/upload-artifact@v4
220-
with:
221-
name: helm
222-
path: helm.tar.gz
219+
cp -r percona-helm-charts/charts/everest /tmp/${{ env.VERSION }}/helm-chart
223220
224221
- name: Operator - check out again
225222
uses: actions/checkout@v4
@@ -353,45 +350,19 @@ jobs:
353350
RELEASE_VERSION=${VERSION_TAG} CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make rc
354351
RELEASE_VERSION=${VERSION_TAG} make release-cli
355352
356-
- name: Upload CLI artefacts
357-
uses: actions/upload-artifact@v4
358-
id: cli-upload-step-1
359-
with:
360-
name: everestctl.exe
361-
path: ./dist/everestctl.exe
362-
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}
363-
364-
- name: Upload CLI artefacts
365-
uses: actions/upload-artifact@v4
366-
id: cli-upload-step-2
367-
with:
368-
name: everestctl-darwin-amd64
369-
path: ./dist/everestctl-darwin-amd64
370-
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}
371-
372-
- name: Upload CLI artefacts
373-
uses: actions/upload-artifact@v4
374-
id: cli-upload-step-3
375-
with:
376-
name: everestctl-darwin-arm64
377-
path: ./dist/everestctl-darwin-arm64
378-
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}
379-
380-
- name: Upload CLI artefacts
381-
uses: actions/upload-artifact@v4
382-
id: cli-upload-step-4
383-
with:
384-
name: everestctl-linux-amd64
385-
path: ./dist/everestctl-linux-amd64
386-
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}
353+
- name: Everest - copy CLI builds
354+
run: |
355+
cp dist/everestctl.exe /tmp/${VERSION}/everestctl.exe
356+
cp dist/everestctl-darwin-amd64 /tmp/${VERSION}/everestctl-darwin-amd64
357+
cp dist/everestctl-darwin-arm64 /tmp/${VERSION}/everestctl-darwin-arm64
358+
cp dist/everestctl-linux-amd64 /tmp/${VERSION}/everestctl-linux-amd64
359+
cp dist/everestctl-linux-arm64 /tmp/${VERSION}/everestctl-linux-arm64
387360
388-
- name: Upload CLI artefacts
389-
uses: actions/upload-artifact@v4
390-
id: cli-upload-step-5
391-
with:
392-
name: everestctl-linux-arm64
393-
path: ./dist/everestctl-linux-arm64
394-
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}
361+
- name: Everest - copy feature build helper scripts
362+
run: |
363+
cp dev/fb/cli.sh /tmp/${VERSION}/cli.sh
364+
cp dev/fb/helm.sh /tmp/${VERSION}/helm.sh
365+
cp dev/fb/vs.sh /tmp/${VERSION}/vs.sh
395366
396367
- name: Everest - push Everest image
397368
uses: docker/build-push-action@v6
@@ -402,47 +373,37 @@ jobs:
402373

403374
- name: Create vs_tag file
404375
run: |
405-
echo "$VS_TAG" > vs_tag.txt
406-
echo "$VERSION" > fb.txt
376+
echo "$VS_TAG" > /tmp/${VERSION}/vs_tag.txt
377+
echo "$VERSION" > /tmp/${VERSION}/version.txt
407378
408-
- name: Upload VS tag info artefact
409-
uses: actions/upload-artifact@v4
410-
id: vs_file
411-
with:
412-
name: vs_tag.txt
413-
path: ./vs_tag.txt
414-
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}
379+
- name: Version Service - create deployment manifest
380+
run: |
381+
curl https://raw.githubusercontent.com/Percona-Lab/percona-version-service/main/deploy.yaml > /tmp/${VERSION}/vs_deploy.yaml
382+
sed -i "s/perconalab\/version-service:.*/perconalab\/version-service:$VS_TAG/g" /tmp/${VERSION}/vs_deploy.yaml
415383
416384
417-
- name: Upload FB info artefact
385+
- name: Upload artifacts
418386
uses: actions/upload-artifact@v4
419-
id: fb_file
420387
with:
421-
name: fb.txt
422-
path: ./fb.txt
388+
name: ${{ env.VERSION }}
389+
path: /tmp/${{ env.VERSION }}
423390
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}
424391

425392
- name: Info
426393
run: |
427394
printf "To install FB using helm:\n\
428-
1. Download the 'helm' artifact below.\n\
429-
2. Navigate to \`/everest/dev/fb directory\`.\n\
430-
3. Run the command:\n\`\`\`VS_IMAGE=$VS_TAG HELM_PATH=<path_to_your_helmchart> bash helm.sh\`\`\`\n\
431-
\nexample:\n\`\`\`VS_IMAGE=$VS_TAG HELM_PATH=/Users/oxana/Downloads/percona-helm-charts bash helm.sh\`\`\`\n" >> "$GITHUB_STEP_SUMMARY"
395+
1. Download and unzip the \`$VERSION\` artifact below.\n\
396+
2. Run the command:\n\`\`\`./helm.sh\`\`\`\n" >> "$GITHUB_STEP_SUMMARY"
432397
433398
printf "____________________\n" >> "$GITHUB_STEP_SUMMARY"
434399
435400
printf "To install FB using CLI:\n\
436-
1. Download the 'helm' artifact below.\n\
437-
2. Download a CLI build from artifacts below.\n\
438-
3. Navigate to \`/everest/dev/fb\` directory.\n\
439-
4. Run the command:\n\`\`\`VS_IMAGE=$VS_TAG VERSION=$VERSION EVEREST_CTL_PATH=<path_to_everestctl> HELM_PATH=<path_to_your_helmchart> bash cli.sh\`\`\`\n\
440-
\nexample:\n\`\`\`VS_IMAGE=$VS_TAG VERSION=$VERSION HELM_PATH=/Users/oxana/Downloads/percona-helm-charts EVEREST_CTL_PATH=/Users/oxana/Downloads/everestctl-darwin-arm64 bash cli.sh\`\`\`\n" >> "$GITHUB_STEP_SUMMARY"
441-
401+
1. Download and unzip the \`$VERSION\` artifact below.\n\
402+
2. Run the command:\n\`\`\`./cli.sh\`\`\`\n" >> "$GITHUB_STEP_SUMMARY"
442403
443404
printf "____________________\n" >> "$GITHUB_STEP_SUMMARY"
444405
445406
printf "To clean up the environment after a FB:\n\
446407
1. Delete VS: \`kubectl delete deployment percona-version-service && kubectl delete svc percona-version-service\`\n\
447-
2. Uninstall Everest using the FB everestctl build: \`<path_to_everestctl> uninstall --assume-yes --force\` \n" >> "$GITHUB_STEP_SUMMARY"
408+
2. Uninstall Everest using the FB everestctl build: \`./<everestctl-OS-ARCH> uninstall --assume-yes --force\` \n" >> "$GITHUB_STEP_SUMMARY"
448409

dev/fb/cli.sh

100644100755
+15-21
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
#!/usr/bin/env bash
22

3-
if [[ -z "$VS_IMAGE" ]]; then
4-
echo "Error: VS_IMAGE environment variable is empty." >&2
5-
exit 1
6-
fi
7-
8-
if [[ -z "$VERSION" ]]; then
9-
echo "Error: VERSION environment variable is empty." >&2
10-
exit 1
11-
fi
3+
# deploy VS and get it's internal IP
4+
SERVICE_IP=$(./vs.sh)
125

13-
if [[ -z "$HELM_PATH" ]]; then
14-
echo "Error: HELM_PATH environment variable is empty. Please add the absolute path to your helm build to the HELM_PATH environment variable." >&2
15-
exit 1
16-
fi
6+
kubectl port-forward svc/percona-version-service 8081:80 &
177

18-
if [[ -z "$EVEREST_CTL_PATH" ]]; then
19-
echo "Error: EVEREST_CTL_PATH environment variable is empty." >&2
20-
exit 1
21-
fi
8+
# sleep for 2 seconds to make sure the port-forward is ready
9+
sleep 2
2210

23-
# deploy VS and get it's internal IP
24-
SERVICE_IP=$(curl -sfL https://raw.githubusercontent.com/percona/everest/main/dev/fb/vs.sh | bash -s)
11+
os=$(uname -s | tr '[:upper:]' '[:lower:]')
12+
arch=$(uname -m | tr '[:upper:]' '[:lower:]')
2513

26-
kubectl port-forward svc/percona-version-service 8081:80 &
14+
if [[ ($os == "linux" || $os == "darwin") && $arch == "x86_64" ]]
15+
then
16+
arch="amd64"
17+
elif [[ $os == "linux" && $arch == "aarch64" ]]
18+
then
19+
arch="arm64"
20+
fi
2721

2822
# run everest installation with everest CLI
29-
"$EVEREST_CTL_PATH" install --chart-dir "$HELM_PATH/charts/everest" --version "$VERSION" --version-metadata-url http://localhost:8081 --operator.xtradb-cluster --operator.mongodb --operator.postgresql --skip-wizard --namespaces everest -v --helm.set "versionMetadataURL=http://$SERVICE_IP"
23+
"./everestctl-$os-$arch" install --chart-dir "helm-chart" --version "$(cat version.txt)" --version-metadata-url http://localhost:8081 --operator.xtradb-cluster --operator.mongodb --operator.postgresql --skip-wizard --namespaces everest -v --helm.set "versionMetadataURL=http://$SERVICE_IP"

dev/fb/helm.sh

100644100755
+2-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
#!/usr/bin/env bash
22

3-
if [[ -z "$HELM_PATH" ]]; then
4-
echo "Error: HELM_PATH environment variable is empty. Please add the absolute path to your helm build to the HELM_PATH environment variable." >&2
5-
exit 1
6-
fi
7-
8-
if [[ -z "$VS_IMAGE" ]]; then
9-
echo "Error: VS_IMAGE environment variable is empty." >&2
10-
exit 1
11-
fi
12-
133
# deploy VS and get it's internal IP
14-
SERVICE_IP=$(curl -sfL https://raw.githubusercontent.com/percona/everest/main/dev/fb/vs.sh | bash -s)
4+
SERVICE_IP=$(./vs.sh)
155

166
# run everest installation with helm
17-
helm install everest-core "$HELM_PATH/charts/everest" --namespace=everest-system --create-namespace --set versionMetadataURL="http://$SERVICE_IP" --timeout=10m --devel
7+
helm install everest-core "helm-chart" --namespace=everest-system --create-namespace --set versionMetadataURL="http://$SERVICE_IP" --timeout=10m --devel

dev/fb/vs.sh

100644100755
+1-16
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
11
#!/usr/bin/env bash
22

3-
if [[ -z "$VS_IMAGE" ]]; then
4-
echo "Error: VS_IMAGE environment variable is empty." >&2
5-
exit 1
6-
fi
7-
8-
curl https://raw.githubusercontent.com/Percona-Lab/percona-version-service/main/deploy.yaml > vs_deploy.yaml
9-
10-
# use FB VS image in the VS configuration
11-
if [[ "$(uname)" == "Darwin" ]]; then
12-
sed -i '' "s/perconalab\/version-service:.*/perconalab\/version-service:$VS_IMAGE/g" vs_deploy.yaml
13-
else
14-
sed -i "s/perconalab\/version-service:.*/perconalab\/version-service:$VS_IMAGE/g" vs_deploy.yaml
15-
fi
16-
17-
183
# deploy VS
194
kubectl apply -f vs_deploy.yaml > /dev/null
205

216
# wait until the VS is ready
22-
kubectl wait --for=jsonpath='{.status.readyReplicas}'=3 deployment/percona-version-service > /dev/null
7+
kubectl wait --for=jsonpath='{.status.readyReplicas}'=3 deployment/percona-version-service --timeout 60s > /dev/null
238

249
# get the internal IP of the VS
2510
echo "$(kubectl get service percona-version-service -o jsonpath='{.spec.clusterIP}')"

0 commit comments

Comments
 (0)