Mol*_*0ko 7 continuous-integration environment-variables dart flutter pubspec
我的 Flutter 移动应用项目中有来自 GitLab 的私有依赖项。它是在 git 存储库链接中指定的,如果我使用 ssh,pubspec.yaml
我可以成功运行(我已经生成了 ssh 密钥并将其添加到我的 gitlab 帐户)pub get
my_private_package:
git:
url: ssh://git@************/my_private_package.git
Run Code Online (Sandbox Code Playgroud)
现在我想使用 AppCenter 构建我的应用程序并部署到商店。在 AppCenter 构建阶段不可能使用 ssh 密钥,因此我看到的唯一可行的解决方案是使用GitLab 部署令牌作为环境变量来从 AppCenter 计算机访问我的私有包。访问存储库的 Git 链接变为:
my_private_package:
git:
url: https://gitlab+deploy-token-1:${DEPLOY_TOKEN}@************/my_private_package.git
Run Code Online (Sandbox Code Playgroud)
现在,据我了解, pubspec 无法以DEPLOY_TOKEN
这种方式解析环境变量。pub get
完成时出现错误:
Git error. Command: `git clone --mirror https://gitlab+deploy-token-1:******@*******/my_private_package.git /Users/***/Library/flutter/.pub-cache/git/cache/my_private_package***`
stdout:
stderr: Cloning into bare repository '/Users/***/Library/flutter/.pub-cache/git/cache/my_private_package***'...
remote: HTTP Basic: Access denied
remote: You must use a personal access token with 'read_repository' or 'write_repository' scope for Git over HTTP.
remote: You can generate one at https://*****/-/profile/personal_access_tokens
fatal: Authentication failed for 'https://gitlab.*****/my_private_package.git/'
exit code: 128
Run Code Online (Sandbox Code Playgroud)
我还尝试使用上面错误消息中提到的个人访问令牌,但得到了相同的结果。尽管如果指定了环境变量,git clone https://gitlab+deploy-token-1:${DEPLOY_TOKEN}@*******/my_private_package.git
则从命令行可以正常工作。DEPLOY_TOKEN
我的问题:是否可以直接使用环境变量pubspec.yaml
?如果不是,我如何从另一台(不是 gitlab runner)CI 机器获取我的私有包?
归档时间: |
|
查看次数: |
2026 次 |
最近记录: |