Skip to content

Commit

Permalink
Merge branch 'main' into EVEREST-1549-pxc-1.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oksana-grishchenko committed Jan 21, 2025
2 parents 5e8f0fa + 0732e17 commit 05fde41
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 119 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/auto-update-base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Auto-Update PR Base

on:
push:
branches:
- main

jobs:
auto-update-base:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
try {
const { data: pulls } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: "open",
});
for (const pull of pulls) {
const hasAutoUpdateLabel = pull.labels.some(label => label.name === "auto-update-base");
if (hasAutoUpdateLabel) {
try {
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pull.number,
});
if (pr.data.mergeable_state === 'dirty') {
console.log(`[INFO] PR #${pull.number}: "${pull.title}" - Skipping update due to merge conflict.`);
continue;
}
if (pr.data.mergeable_state !== 'behind') {
console.log(`[INFO] PR #${pull.number}: "${pull.title}" - Base branch is up-to-date.`);
continue;
}
console.log(`[UPDATE] PR #${pull.number}: "${pull.title}" - Updating base branch...`);
try {
await github.rest.pulls.updateBranch({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pull.number,
});
console.log(`[SUCCESS] PR #${pull.number}: "${pull.title}" - Base branch updated.`);
} catch (updateError) {
console.error(`[ERROR] PR #${pull.number}: Failed to update base branch - ${updateError.message}`);
}
} catch (diffError) {
console.error(`[ERROR] PR #${pull.number}: Failed to compare commits - ${diffError.message}`);
}
}
}
} catch (error) {
console.error(`[ERROR] Failed to list pull requests - ${error.message}`);
}
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
17 changes: 1 addition & 16 deletions dev/fb/vs.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
#!/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

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

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

0 comments on commit 05fde41

Please sign in to comment.