.gitignore.databuddy bundle deploy -s submits changes directly to the scheduling system (production environment). Ensure that approval protection is configured in the pipeline.dev and prod branches as examples to demonstrate the Targets for the development and production environments respectively:Branch | Corresponding Target | Purpose |
dev | dev | Development integration, daily development merge point |
prod | prod | Production environment, only accepts MR/PR merges |
dev or prod branch through MR/PR to trigger deployment to the corresponding environment.cd my_bundlegit init
.gitignore file to exclude the local state directory:# DataBuddy CLI state directory (auto-generated, contains binding relationships and local state, and should not be committed).bundle/
git add .git commit -m "chore: init bundle project"git remote add origin <your repository address>git push -u origin dev
.bundle/ directory contains local binding state and authentication cache, and must be added to .gitignore and not committed to the Git repository.~/.databuddycfg configuration file.Variable Name | Description | Option |
WEDATA_HOST | DataBuddy Workspace address (full URL) | Masked |
WEDATA_SECRET_ID | TencentCloud API secret ID | Masked |
WEDATA_SECRET_KEY | TencentCloud API secret Key | Masked |
WEDATA_REGION | Region, such as ap-beijing-fsi | - |
Secret name | Description |
WEDATA_HOST | DataBuddy Workspace address (full URL) |
WEDATA_SECRET_ID | TencentCloud API secret ID |
WEDATA_SECRET_KEY | TencentCloud API secret Key |
WEDATA_REGION | Region, such as ap-guangzhou |
.gitlab-ci.yml file in the repository root directory:stages:- validate- deploy# ---- Global Configuration ----variables:BUNDLE_DIR: my_bundle # Change this to the actual bundle directory name.before_script:# Install DataBuddy CLI (Go Binary Version)- curl 'https://wedata3-platform-bundle-cq-1257305158.cos.ap-chongqing.myqcloud.com/bundle_sh/install.sh' | sudo sh || true- databuddy --version# Write the authentication configuration file (keys are injected from CI/CD Variables).- |cat << EOF > "$HOME/.databuddycfg"host = ${WEDATA_HOST}secret_id = ${WEDATA_SECRET_ID}secret_key = ${WEDATA_SECRET_KEY}region = ${WEDATA_REGION}EOF- cd ${BUNDLE_DIR}# ========== dev Branch: Deploy to Development Environment ==========validate-dev:stage: validatescript:- databuddy bundle validate -t devrules:- if: '$CI_COMMIT_BRANCH == "dev"'deploy-dev:stage: deployscript:- databuddy bundle deploy -t devrules:- if: '$CI_COMMIT_BRANCH == "dev"'environment:name: development# ========== prod Branch: Deploy to Production Environment ==========validate-prod:stage: validatescript:- databuddy bundle validate -t prodrules:- if: '$CI_COMMIT_BRANCH == "prod"'deploy-prod:stage: deployscript:- databuddy bundle deploy -t prod -srules:- if: '$CI_COMMIT_BRANCH == "prod"'environment:name: production
.github/workflows/deploy.yml file in the repository:name: DataBuddy Bundle CI/CDon:push:branches: [dev, prod]pull_request:branches: [prod]env:BUNDLE_DIR: my_bundle # Change this to the actual bundle directory name.jobs:# ========== dev Branch: Deploy to Development Environment ==========deploy-dev:if: github.ref == 'refs/heads/dev'runs-on: ubuntu-latestenvironment: developmentsteps:- uses: actions/checkout@v4- name: Install DataBuddy CLIrun: |curl 'https://wedata3-platform-bundle-cq-1257305158.cos.ap-chongqing.myqcloud.com/bundle_sh/install.sh' | sudo sh || truedatabuddy --version- name: Configure credentialsrun: |cat << EOF > "$HOME/.databuddycfg"host = ${{ secrets.WEDATA_HOST }}secret_id = ${{ secrets.WEDATA_SECRET_ID }}secret_key = ${{ secrets.WEDATA_SECRET_KEY }}region = ${{ secrets.WEDATA_REGION }}EOF- name: Validaterun: |cd ${{ env.BUNDLE_DIR }}databuddy bundle validate -t dev- name: Deployrun: |cd ${{ env.BUNDLE_DIR }}databuddy bundle deploy -t dev# ========== prod Branch: Deploy to Production Environment ==========deploy-prod:if: github.ref == 'refs/heads/prod'runs-on: ubuntu-latestenvironment: productionsteps:- uses: actions/checkout@v4- name: Install DataBuddy CLIrun: |curl 'https://wedata3-platform-bundle-cq-1257305158.cos.ap-chongqing.myqcloud.com/bundle_sh/install.sh' | sudo sh || truedatabuddy --version- name: Configure credentialsrun: |cat << EOF > "$HOME/.databuddycfg"host = ${{ secrets.WEDATA_HOST }}secret_id = ${{ secrets.WEDATA_SECRET_ID }}secret_key = ${{ secrets.WEDATA_SECRET_KEY }}region = ${{ secrets.WEDATA_REGION }}EOF- name: Validaterun: |cd ${{ env.BUNDLE_DIR }}databuddy bundle validate -t prod- name: Deployrun: |cd ${{ env.BUNDLE_DIR }}databuddy bundle deploy -t prod -s
production environment to ensure that production deployments require manual approval.git checkout devgit pull origin devgit checkout -b feature/add-report-task
# Local Validationdatabuddy bundle validate -t dev -p <profile># Commit Codegit add .git commit -m "feat(tasks): add daily report task"git push origin feature/add-report-task
dev branch. The pipeline automatically runs validate and deploy to the development environment.dev into prod, and merge it after Code Review approval. The pipeline automatically deploys to the production environment.dev.dev into prod, and confirm that the deploy-prod pipeline runs successfully.BUNDLE_DIR variable matches the actual Bundle directory name.host, secret_id, secret_key, and region in ~/.databuddycfg are all correctly injected.databuddy.yml.git revert to revert the problematic commit.prod branch.Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários