【Procedure】GitLab + SalesForce 实现CI/CD
前提条件
- Enable Dev Hub
- Enable Unlocked Packages and Second-Generation Managed Packages
CI·CD·配置流程
- 创建 Salesforce Connected App 用来与GitLab交流
- OAuth有效(Enable OAuth Settings)
- Callback URL: (http://localhost:1717/OauthRedirect)
- 选择可用Scopes
– Access and manage your data (api)
– Perform requests on your behalf at any time (refresh_token, offline_access)
– Provide access to your data via the Web (web) - Require Secret for Web Server Flow 有效化
- 授权被认证用户的连接
✳ 具体参照Create a Connected App
- 本地安装 Salesforce CLI / Git / OpenSSL(Windows环境)
- 用Salesforce CLI认证DevHub环境
sfdx force:auth:web:login --setalias DevHub --setdefaultdevhubusername
- 创建GitLab工程,并Clone到本地
- 创建私有键和数字签名,实现GiltLab和SF的通信
cd certificates
openssl genrsa -des3 -passout pass:*SomePassword* -out server.pass.key 4096 (创建私有键)
openssl rsa -passin pass:*SomePassword