Integrate Serverless Devs with CI/CD: GitHub Actions, Gitee, Jenkins & CloudEffect
This article explains the fundamentals of CI/CD, why it is critical for Serverless architectures, and provides step‑by‑step guidance with code snippets for integrating Serverless Devs into GitHub Actions, Gitee Go, Jenkins pipelines, and CloudEffect, including tool installation, secret configuration, and deployment commands.
Why CI/CD Matters for Serverless
CI/CD (Continuous Integration, Continuous Delivery, Continuous Deployment) automates the software lifecycle from code integration to testing, delivery, and deployment, reducing manual errors and operational load. In Serverless environments, where many fine‑grained functions compose a service, CI/CD becomes essential to manage function lifecycle, build, and release processes efficiently.
Serverless Devs as the Core Tool
The Serverless Devs developer toolkit (available via npm install -g @serverless-devs/s) provides a unified CLI for building, configuring, and deploying Serverless applications across multiple cloud providers. Integrating this tool into CI/CD pipelines enables automated, repeatable deployments.
Integration with GitHub Actions
Create .github/workflows/publish.yml with the following content:
name: Serverless Devs Project CI/CD
on:
push:
branches: [ master ]
jobs:
serverless-devs-cd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm install -g @serverless-devs/s
- run: s config add --AccountID ${{secrets.AccountID}} --AccessKeyID ${{secrets.AccessKeyID}} --AccessKeySecret ${{secrets.AccessKeySecret}} -a default
- run: s deploySecrets AccountID, AccessKeyID, and AccessKeySecret must be added in the GitHub repository’s Settings → Secrets page.
Integration with Gitee Go
In Gitee Go pipelines, add a similar YAML file (e.g., .gitee/workflows/publish.yml) that installs the tool, configures secrets, and runs deployment:
name: serverless-devs
triggers:
push:
- matchType: PRECISE
branch: master
stages:
- stage:
name: deploy-stage
steps:
- step: npmbuild@1
name: deploy-step
inputs:
nodeVersion: 14.15
goals: |
npm install -g @serverless-devs/s
s config add --AccountID $ACCOUNTID --AccessKeyID $ACCESSKEYID --AccessKeySecret $ACCESSKEYSECRET -a default
s deployConfigure the three secret variables (ACCOUNTID, ACCESSKEYID, ACCESSKEYSECRET) in Gitee’s environment variable management page.
Integration with Jenkins
After installing Jenkins, add credentials for the three keys (e.g., jenkins-alicloud-account-id, jenkins-alicloud-access-key-id, jenkins-alicloud-access-key-secret) and create a Jenkinsfile:
pipeline {
agent {
docker { image 'maven:3.3-jdk-8' }
}
environment {
ALICLOUD_ACCESS = 'default'
ALICLOUD_ACCOUNT_ID = credentials('jenkins-alicloud-account-id')
ALICLOUD_ACCESS_KEY_ID = credentials('jenkins-alicloud-access-key-id')
ALICLOUD_ACCESS_KEY_SECRET = credentials('jenkins-alicloud-access-key-secret')
}
stages {
stage('Setup') {
steps {
sh 'scripts/setup.sh'
}
}
}
}The scripts/setup.sh script performs the following actions:
#!/usr/bin/env bash
echo $(pwd)
curl -o- -L http://cli.so/install.sh | bash
source ~/.bashrc
echo $ALICLOUD_ACCOUNT_ID
s config add --AccountID $ALICLOUD_ACCOUNT_ID --AccessKeyID $ALICLOUD_ACCESS_KEY_ID --AccessKeySecret $ALICLOUD_ACCESS_KEY_SECRET -a $ALICLOUD_ACCESS
(cd code && mvn package && echo $(pwd))
s deploy -y --use-local --access $ALICLOUD_ACCESSIntegration with CloudEffect (Aliyun Cloud Effect)
In CloudEffect, add the Serverless Devs tool and configure a custom command block:
npm install -g @serverless-devs/s
s config add --AccountID ${ACCOUNTID} --AccessKeyID ${ACCESSKEYID} --AccessKeySecret ${ACCESSKEYSECRET} -a default
s deploy -yEnsure the three environment variables (ACCOUNTID, ACCESSKEYID, ACCESSKEYSECRET) are defined in CloudEffect’s environment variable settings.
Core CI/CD Workflow for Serverless Devs
Install the tool: npm install -g @serverless-devs/s Configure secrets:
s config add --AccountID $ACCOUNTID --AccessKeyID $ACCESSKEYID --AccessKeySecret $ACCESSKEYSECRET -a defaultDeploy the project: s deploy These three steps remain consistent across GitHub Actions, Gitee Go, Jenkins, and CloudEffect, regardless of the underlying CI/CD platform.
Observability of Serverless Applications
Serverless Devs also supports observability through logging, metrics, and tracing provided by cloud providers (e.g., Alibaba Cloud Function Compute). Users can view overall metrics, per‑function metrics, request logs, and trace data in the provider’s console.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Alibaba Cloud Native
We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
