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

chore: helm install cloud #236

Merged
merged 7 commits into from
Dec 7, 2023
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
19 changes: 5 additions & 14 deletions .github/workflows/cloud-test-k3s-amd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: 'ApeCloud release version'
type: string
required: false
default: 'v0.1.6'
default: 'v0.3.5'
KUBEBLOCKS_VERSION:
description: 'kubeblocks release version'
type: string
Expand All @@ -18,11 +18,6 @@ on:
type: string
required: false
default: '1.26'
APECLOUD_BRANCH:
description: 'apecloud branch name'
type: string
required: false
default: 'main'
TESTINFRA_BRANCH:
description: 'testinfra branch name'
type: string
Expand All @@ -49,7 +44,7 @@ on:
description: 'ApeCloud release version'
type: string
required: false
default: 'v0.1.6'
default: 'v0.3.5'
KUBEBLOCKS_VERSION:
description: 'kubeblocks release version'
type: string
Expand All @@ -60,11 +55,6 @@ on:
type: string
required: false
default: '1.26'
APECLOUD_BRANCH:
description: 'apecloud branch name'
type: string
required: false
default: 'main'
TESTINFRA_BRANCH:
description: 'testinfra branch name'
type: string
Expand Down Expand Up @@ -111,11 +101,11 @@ jobs:
with:
release-version: ${{ inputs.APECLOUD_VERSION }}
kubeblocks-version: ${{ inputs.KUBEBLOCKS_VERSION }}
test-type: "0"
test-type-name: "e2e-test"
test-args: ${{ inputs.ARGS }}
k3s-version: ${{ inputs.K3S_VERSION }}
testinfra-branch: ${{ inputs.TESTINFRA_BRANCH }}
apecloud-branch: ${{ inputs.APECLOUD_BRANCH }}
e2etest-branch: ${{ inputs.E2ETEST_BRANCH }}
secrets: inherit

Expand All @@ -133,7 +123,8 @@ jobs:
- name: send message
id: get_trigger_mode
run: |
TEST_RESULT="e2e-test|${{ needs.e2e-test.outputs.test-result }}"
TEST_RESULT="deploy-cloud|${{ needs.e2e-test.outputs.deploy-result }}"
TEST_RESULT="${TEST_RESULT}##e2e-test|${{ needs.e2e-test.outputs.test-result }}"

TEST_RESULT=$( bash .github/utils/utils.sh --type 12 \
--github-repo "${{ github.repository }}" \
Expand Down
19 changes: 5 additions & 14 deletions .github/workflows/cloud-test-k3s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: 'ApeCloud release version'
type: string
required: false
default: 'v0.1.6'
default: 'v0.3.5'
KUBEBLOCKS_VERSION:
description: 'kubeblocks release version'
type: string
Expand All @@ -18,11 +18,6 @@ on:
type: string
required: false
default: '1.26'
APECLOUD_BRANCH:
description: 'apecloud branch name'
type: string
required: false
default: 'main'
TESTINFRA_BRANCH:
description: 'testinfra branch name'
type: string
Expand All @@ -49,7 +44,7 @@ on:
description: 'ApeCloud release version'
type: string
required: false
default: 'v0.1.6'
default: 'v0.3.5'
KUBEBLOCKS_VERSION:
description: 'kubeblocks release version'
type: string
Expand All @@ -60,11 +55,6 @@ on:
type: string
required: false
default: '1.26'
APECLOUD_BRANCH:
description: 'apecloud branch name'
type: string
required: false
default: 'main'
TESTINFRA_BRANCH:
description: 'testinfra branch name'
type: string
Expand Down Expand Up @@ -102,11 +92,11 @@ jobs:
with:
release-version: ${{ inputs.APECLOUD_VERSION }}
kubeblocks-version: ${{ inputs.KUBEBLOCKS_VERSION }}
test-type: "0"
test-type-name: "e2e-test"
test-args: ${{ inputs.ARGS }}
k3s-version: ${{ inputs.K3S_VERSION }}
testinfra-branch: ${{ inputs.TESTINFRA_BRANCH }}
apecloud-branch: ${{ inputs.APECLOUD_BRANCH }}
e2etest-branch: ${{ inputs.E2ETEST_BRANCH }}
secrets: inherit

Expand All @@ -124,7 +114,8 @@ jobs:
- name: send message
id: get_trigger_mode
run: |
TEST_RESULT="e2e-test|${{ needs.e2e-test.outputs.test-result }}"
TEST_RESULT="deploy-cloud|${{ needs.e2e-test.outputs.deploy-result }}"
TEST_RESULT="${TEST_RESULT}##e2e-test|${{ needs.e2e-test.outputs.test-result }}"

TEST_RESULT=$( bash .github/utils/utils.sh --type 12 \
--github-repo "${{ github.repository }}" \
Expand Down
83 changes: 40 additions & 43 deletions .github/workflows/test-cloud-k3s-amd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,15 @@ on:
type: string
required: false
default: 'main'
apecloud-branch:
description: 'apecloud branch name'
type: string
required: false
default: 'main'
e2etest-branch:
description: 'e2etest branch name'
type: string
required: false
default: 'main'
outputs:
deploy-result:
description: "deploy result"
value: ${{ jobs.cloud-test-k3s.outputs.deploy-result }}
test-result:
description: "e2e test result"
value: "${{ jobs.cloud-test-k3s.outputs.test-result }}"
Expand All @@ -59,6 +57,9 @@ env:
HELM_VERSION: v3.13.1
K3D_NAME: default
REGION: us-central1
AUTH0_ID_TOKEN: ${{ secrets.AUTH0_ID_TOKEN }}
CLOUD_VALUES: ${{ secrets.CLOUD_VALUES }}
DSN: "postgres://kubeblockscloud:kubeblockscloudhk2143232@localhost:5432/kubeblockscloud?sslmode=disable"

permissions:
id-token: write
Expand All @@ -69,13 +70,14 @@ jobs:
name: run ${{ inputs.test-type-name }}
runs-on: [ self-hosted, k3d-runner ]
outputs:
deploy-result: ${{ steps.deploy_cloud.outputs.deploy-result }}
test-result: ${{ steps.test_result.outputs.test-result }}
runner-name: ${{ steps.test_result.outputs.runner-name }}
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.19"
go-version: "1.21"

- name: checkout testinfra
uses: actions/checkout@v4
Expand Down Expand Up @@ -120,40 +122,36 @@ jobs:
echo "port-forward apecloud-pg-postgresql Service"
nohup kubectl port-forward services/apecloud-pg-postgresql -n kubeblocks-cloud 5432:5432 &

- name: Checkout apecloud Code
uses: actions/checkout@v4
with:
repository: apecloud/apecloud
path: apecloud
ref: ${{ inputs.apecloud-branch }}
token: ${{ env.GITHUB_TOKEN }}
- name: run cloud server
- name: deploy cloud
id: deploy_cloud
run: |
cd apecloud/apiserver
export GOPROXY=http://goproxy.cn
go mod tidy
touch ./cn.env
echo "${{ env.CLOUD_CN_ENV }}" > ./cn.env
echo -e "while IFS='=' read -r name value\ndo\n if [[ ! \$name =~ ^# && -n \$name ]]; then\n export \$name=\"\$value\"\n fi\ndone < ./cn.env\necho \$DSN\nnohup make run > ./make_run.log 2>&1 &" > script.sh
echo "chmod +x script.sh"
chmod +x script.sh
echo "./script.sh"
./script.sh
times=1
while true; do
if [[ $times -gt 300 ]]; then
break
fi
run_ret="$( grep "Listen and Server on 0.0.0.0:8080" ./make_run.log || true )"
if [[ -n "$run_ret" ]]; then
echo "run cloud server success"
break
fi
times=$(( $times + 1 ))
sleep 1
echo "checking cloud server..."
done
cat ./make_run.log
cd testinfra
file_log="$(date +%Y-%m-%d-%T)".log
touch ${file_log}

cmd="bash .github/utils/cloud-test.sh "
cmd="${cmd} --type '${{ inputs.test-type }}' "
if [[ -n "${{ inputs.release-version }}" ]]; then
cmd="${cmd} --release-version '${{ inputs.release-version }}' "
fi

if [[ -n "${{ inputs.test-args }}" ]]; then
cmd="${cmd} --args '${{ inputs.test-args }}' "
fi
echo "$cmd"
eval "$cmd" | tee -a ${file_log}

test_ret="$( egrep "【FAILED】" ${file_log} || true )"
if [[ -n "$test_ret" ]]; then
echo deploy-result=[FAILED] >> $GITHUB_OUTPUT
exit 1
else
echo deploy-result=[PASSED] >> $GITHUB_OUTPUT
fi

echo "port-forward apiserver Service"
nohup kubectl port-forward services/apiserver -n kb-cloud 8080:8080 &

- name: initial postgresql configuration
run: |
cd testinfra
Expand All @@ -163,10 +161,9 @@ jobs:
--args "--cluster-name apecloud-pg --replicas 1 --limit-cpu 1 --limit-memory 1 --storage 40 --cluster-version postgresql-14.8.0 --namespace kubeblocks-cloud --only-cluster true --test-mode apecloud ${{ inputs.test-args }} " \
--region "${{ env.REGION }}"

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.21"
- name: curl cloud server api
run: |
curl -X GET "http://127.0.0.1:8080/api/v1/user" -H "accept: application/json" -H "authorization:Bearer ${AUTH0_ID_TOKEN}"

- name: Checkout e2etest Code
uses: actions/checkout@v4
Expand Down
80 changes: 36 additions & 44 deletions .github/workflows/test-cloud-k3s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
description: 'test type'
type: string
required: false
default: ''
default: '0'
test-type-name:
description: 'test type name'
type: string
Expand All @@ -38,27 +38,27 @@ on:
type: string
required: false
default: 'main'
apecloud-branch:
description: 'apecloud branch name'
type: string
required: false
default: 'main'
e2etest-branch:
description: 'e2etest branch name'
type: string
required: false
default: 'main'
outputs:
deploy-result:
description: "deploy result"
value: ${{ jobs.cloud-test-k3s.outputs.deploy-result }}
test-result:
description: "e2e test result"
value: "${{ jobs.cloud-test-k3s.outputs.test-result }}"

env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
CLOUD_CN_ENV: ${{ secrets.CLOUD_CN_ENV }}
HELM_VERSION: v3.13.1
K3D_NAME: default
REGION: us-central1
AUTH0_ID_TOKEN: ${{ secrets.AUTH0_ID_TOKEN }}
CLOUD_VALUES: ${{ secrets.CLOUD_VALUES }}
DSN: "postgres://kubeblockscloud:kubeblockscloudhk2143232@localhost:5432/kubeblockscloud?sslmode=disable"

permissions:
id-token: write
Expand All @@ -69,6 +69,7 @@ jobs:
name: run ${{ inputs.test-type-name }}
runs-on: ubuntu-latest
outputs:
deploy-result: ${{ steps.deploy_cloud.outputs.deploy-result }}
test-result: ${{ steps.test_result.outputs.test-result }}
steps:
- name: Setup kubectl
Expand Down Expand Up @@ -129,44 +130,35 @@ jobs:
echo "port-forward apecloud-pg-postgresql Service"
nohup kubectl port-forward services/apecloud-pg-postgresql -n kubeblocks-cloud 5432:5432 &

- name: Checkout apecloud Code
uses: actions/checkout@v4
with:
repository: apecloud/apecloud
path: apecloud
ref: ${{ inputs.apecloud-branch }}
token: ${{ env.GITHUB_TOKEN }}

- name: run cloud server
- name: deploy cloud
id: deploy_cloud
run: |
cd apecloud/apiserver
export GOPROXY=http://goproxy.cn
go mod tidy
touch ./cn.env
echo "${{ env.CLOUD_CN_ENV }}" > ./cn.env
while IFS='=' read -r name value; do
if [[ ! $name =~ ^\# && -n $name ]]; then
export $name="$value"
fi
done < ./cn.env
echo $DSN
echo $AUTH0_ID_TOKEN
nohup make run > ./make_run.log 2>&1 &
times=1
while true; do
if [[ $times -gt 300 ]]; then
break
fi
run_ret="$( grep "Listen and Server on 0.0.0.0:8080" ./make_run.log || true )"
if [[ -n "$run_ret" ]]; then
echo "run cloud server success"
break
fi
times=$(( $times + 1 ))
sleep 1
echo "checking cloud server..."
done
AUTH0_ID_TOKEN=${AUTH0_ID_TOKEN} >> $GITHUB_ENV
cd testinfra
file_log="$(date +%Y-%m-%d-%T)".log
touch ${file_log}

cmd="bash .github/utils/cloud-test.sh "
cmd="${cmd} --type '${{ inputs.test-type }}' "
if [[ -n "${{ inputs.release-version }}" ]]; then
cmd="${cmd} --release-version '${{ inputs.release-version }}' "
fi

if [[ -n "${{ inputs.test-args }}" ]]; then
cmd="${cmd} --args '${{ inputs.test-args }}' "
fi
echo "$cmd"
eval "$cmd" | tee -a ${file_log}

test_ret="$( egrep "【FAILED】" ${file_log} || true )"
if [[ -n "$test_ret" ]]; then
echo deploy-result=[FAILED] >> $GITHUB_OUTPUT
exit 1
else
echo deploy-result=[PASSED] >> $GITHUB_OUTPUT
fi

echo "port-forward apiserver Service"
nohup kubectl port-forward services/apiserver -n kb-cloud 8080:8080 &

- name: initial postgresql configuration
run: |
Expand Down