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

EVEREST-107 Simplify Feature Builds #1019

Merged
merged 4 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
101 changes: 31 additions & 70 deletions .github/workflows/feature-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ jobs:
echo "VERSION_TAG=v$V" >> $GITHUB_ENV
echo "VS_TAG=everest-test$TIMESTAMP" >> $GITHUB_ENV

- name: Create temporary directory for storing artifacts
run: |
mkdir -p /tmp/${VERSION}

- name: Set GO_VERSION environment variable
run: |
Expand Down Expand Up @@ -211,15 +214,9 @@ jobs:
CRD_VERSION=${{ env.VERSION_TAG }} make crds-gen
make release-dev

- name: Helm - Create tar.gz archive
- name: Helm - copy chart
run: |
tar -czvf helm.tar.gz percona-helm-charts/charts/everest

- name: Helm - Upload artifact
uses: actions/upload-artifact@v4
with:
name: helm
path: helm.tar.gz
cp -r percona-helm-charts/charts/everest /tmp/${{ env.VERSION }}/helm-chart

- name: Operator - check out again
uses: actions/checkout@v4
Expand Down Expand Up @@ -353,45 +350,19 @@ jobs:
RELEASE_VERSION=${VERSION_TAG} CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make rc
RELEASE_VERSION=${VERSION_TAG} make release-cli

- name: Upload CLI artefacts
uses: actions/upload-artifact@v4
id: cli-upload-step-1
with:
name: everestctl.exe
path: ./dist/everestctl.exe
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}

- name: Upload CLI artefacts
uses: actions/upload-artifact@v4
id: cli-upload-step-2
with:
name: everestctl-darwin-amd64
path: ./dist/everestctl-darwin-amd64
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}

- name: Upload CLI artefacts
uses: actions/upload-artifact@v4
id: cli-upload-step-3
with:
name: everestctl-darwin-arm64
path: ./dist/everestctl-darwin-arm64
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}

- name: Upload CLI artefacts
uses: actions/upload-artifact@v4
id: cli-upload-step-4
with:
name: everestctl-linux-amd64
path: ./dist/everestctl-linux-amd64
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}
- name: Everest - copy CLI builds
run: |
cp dist/everestctl.exe /tmp/${VERSION}/everestctl.exe
cp dist/everestctl-darwin-amd64 /tmp/${VERSION}/everestctl-darwin-amd64
cp dist/everestctl-darwin-arm64 /tmp/${VERSION}/everestctl-darwin-arm64
cp dist/everestctl-linux-amd64 /tmp/${VERSION}/everestctl-linux-amd64
cp dist/everestctl-linux-arm64 /tmp/${VERSION}/everestctl-linux-arm64

- name: Upload CLI artefacts
uses: actions/upload-artifact@v4
id: cli-upload-step-5
with:
name: everestctl-linux-arm64
path: ./dist/everestctl-linux-arm64
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}
- name: Everest - copy feature build helper scripts
run: |
cp dev/fb/cli.sh /tmp/${VERSION}/cli.sh
cp dev/fb/helm.sh /tmp/${VERSION}/helm.sh
cp dev/fb/vs.sh /tmp/${VERSION}/vs.sh

- name: Everest - push Everest image
uses: docker/build-push-action@v6
Expand All @@ -402,47 +373,37 @@ jobs:

- name: Create vs_tag file
run: |
echo "$VS_TAG" > vs_tag.txt
echo "$VERSION" > fb.txt
echo "$VS_TAG" > /tmp/${VERSION}/vs_tag.txt
echo "$VERSION" > /tmp/${VERSION}/version.txt

- name: Upload VS tag info artefact
uses: actions/upload-artifact@v4
id: vs_file
with:
name: vs_tag.txt
path: ./vs_tag.txt
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}
- name: Version Service - create deployment manifest
run: |
curl https://raw.githubusercontent.com/Percona-Lab/percona-version-service/main/deploy.yaml > /tmp/${VERSION}/vs_deploy.yaml
sed -i "s/perconalab\/version-service:.*/perconalab\/version-service:$VS_TAG/g" /tmp/${VERSION}/vs_deploy.yaml


- name: Upload FB info artefact
- name: Upload artifacts
uses: actions/upload-artifact@v4
id: fb_file
with:
name: fb.txt
path: ./fb.txt
name: ${{ env.VERSION }}
path: /tmp/${{ env.VERSION }}
retention-days: ${{ env.ARTIFACTS_RETENTION_DAYS }}

- name: Info
run: |
printf "To install FB using helm:\n\
1. Download the 'helm' artifact below.\n\
2. Navigate to \`/everest/dev/fb directory\`.\n\
3. Run the command:\n\`\`\`VS_IMAGE=$VS_TAG HELM_PATH=<path_to_your_helmchart> bash helm.sh\`\`\`\n\
\nexample:\n\`\`\`VS_IMAGE=$VS_TAG HELM_PATH=/Users/oxana/Downloads/percona-helm-charts bash helm.sh\`\`\`\n" >> "$GITHUB_STEP_SUMMARY"
1. Download and unzip the \`$VERSION\` artifact below.\n\
2. Run the command:\n\`\`\`./helm.sh\`\`\`\n" >> "$GITHUB_STEP_SUMMARY"

printf "____________________\n" >> "$GITHUB_STEP_SUMMARY"

printf "To install FB using CLI:\n\
1. Download the 'helm' artifact below.\n\
2. Download a CLI build from artifacts below.\n\
3. Navigate to \`/everest/dev/fb\` directory.\n\
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\
\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"

1. Download and unzip the \`$VERSION\` artifact below.\n\
2. Run the command:\n\`\`\`./cli.sh\`\`\`\n" >> "$GITHUB_STEP_SUMMARY"

printf "____________________\n" >> "$GITHUB_STEP_SUMMARY"

printf "To clean up the environment after a FB:\n\
1. Delete VS: \`kubectl delete deployment percona-version-service && kubectl delete svc percona-version-service\`\n\
2. Uninstall Everest using the FB everestctl build: \`<path_to_everestctl> uninstall --assume-yes --force\` \n" >> "$GITHUB_STEP_SUMMARY"
2. Uninstall Everest using the FB everestctl build: \`./<everestctl-OS-ARCH> uninstall --assume-yes --force\` \n" >> "$GITHUB_STEP_SUMMARY"

36 changes: 15 additions & 21 deletions dev/fb/cli.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
#!/usr/bin/env bash

if [[ -z "$VS_IMAGE" ]]; then
echo "Error: VS_IMAGE environment variable is empty." >&2
exit 1
fi

if [[ -z "$VERSION" ]]; then
echo "Error: VERSION environment variable is empty." >&2
exit 1
fi
# deploy VS and get it's internal IP
SERVICE_IP=$(./vs.sh)

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

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

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

kubectl port-forward svc/percona-version-service 8081:80 &
if [[ ($os == "linux" || $os == "darwin") && $arch == "x86_64" ]]
then
arch="amd64"
elif [[ $os == "linux" && $arch == "aarch64" ]]
then
arch="arm64"
fi

# run everest installation with everest CLI
"$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"
"./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"
14 changes: 2 additions & 12 deletions dev/fb/helm.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
#!/usr/bin/env bash

if [[ -z "$HELM_PATH" ]]; then
echo "Error: HELM_PATH environment variable is empty. Please add the absolute path to your helm build to the HELM_PATH environment variable." >&2
exit 1
fi

if [[ -z "$VS_IMAGE" ]]; then
echo "Error: VS_IMAGE environment variable is empty." >&2
exit 1
fi

# deploy VS and get it's internal IP
SERVICE_IP=$(curl -sfL https://raw.githubusercontent.com/percona/everest/main/dev/fb/vs.sh | bash -s)
SERVICE_IP=$(./vs.sh)

# run everest installation with helm
helm install everest-core "$HELM_PATH/charts/everest" --namespace=everest-system --create-namespace --set versionMetadataURL="http://$SERVICE_IP" --timeout=10m --devel
helm install everest-core "helm-chart" --namespace=everest-system --create-namespace --set versionMetadataURL="http://$SERVICE_IP" --timeout=10m --devel
15 changes: 0 additions & 15 deletions dev/fb/vs.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
#!/usr/bin/env bash

if [[ -z "$VS_IMAGE" ]]; then
echo "Error: VS_IMAGE environment variable is empty." >&2
exit 1
fi

curl https://raw.githubusercontent.com/Percona-Lab/percona-version-service/main/deploy.yaml > vs_deploy.yaml

# use FB VS image in the VS configuration
if [[ "$(uname)" == "Darwin" ]]; then
sed -i '' "s/perconalab\/version-service:.*/perconalab\/version-service:$VS_IMAGE/g" vs_deploy.yaml
else
sed -i "s/perconalab\/version-service:.*/perconalab\/version-service:$VS_IMAGE/g" vs_deploy.yaml
fi


# deploy VS
kubectl apply -f vs_deploy.yaml > /dev/null

Expand Down