[英]Push from GitLab to Azure
At the moment I have an on premise GitLab Server
that has access to internet but it is not accessible from outside and I want him to be able to push changes to an Azure Webapp
. 目前,我有一个关于前提 GitLab Server
可以访问互联网,但它不是从外部接近 ,我希望他能推动变化的Azure Webapp
。
I found this that shows a way to automate Azure pulling from GitLab, but since it's not accessible from the outside it would be impossible to setup. 我发现这显示了一种自动化从GitLab 提取 Azure的方法,但是由于无法从外部访问它,因此无法进行设置。 There is any way where the GitLab server pushes (publishes) the commits to master into an Azure webapp
? GitLab服务器是否可以通过任何方式将提交的主控推送 (发布)到Azure webapp
?
I really appreciate any help you can provide. 我非常感谢您可以提供的任何帮助。
Edit: Repository Mirroring seemed like a good solution but looks like it's a Gitlab EE
feature. 编辑:存储库镜像似乎是一个不错的解决方案,但看起来像是 Gitlab EE
功能。
If Azure machine can connect to GitLab, you can setup GitLab CI runner that will get changes from GitLab and run your custom script. 如果Azure机器可以连接到GitLab,则可以设置GitLab CI运行程序,它将从GitLab获取更改并运行自定义脚本。 This way GitLab doesn't have to talk to Azure, Azure will automatically pull changes from GitLab. 这样,GitLab不必与Azure通讯,Azure会自动从GitLab提取更改。 Any recent GitLab version bundles GitLab-CI service that you can enable in your project. 任何最新的GitLab版本都捆绑了您可以在项目中启用的GitLab-CI服务。 More on CI-runner configuration here and GitLab-CI . 有关CI运行程序配置的更多信息 ,请参见 此处和GitLab-CI 。
One way to do this, via a stage in your CI process, is to extract the per site credential, then you can push using git remote functionality. 在CI流程的一个阶段中,执行此操作的一种方法是提取每个站点的凭据,然后可以使用git remote功能进行推送。 I was able to do this via Azure CLI 2.0 我能够通过Azure CLI 2.0做到这一点
az appservice web deployment list-site-credentials --name $CI_PROJECT_NAME --resource-group $CI_PROJECT_NAME | jq -r '.publishingUserName' >> username
az appservice web deployment list-site-credentials --name $CI_PROJECT_NAME --resource-group $CI_PROJECT_NAME | jq -r '.publishingPassword' >> password
user=$(cat username)
pass=$(cat password)
mkdir staging
mv * staging/
cd staging
git init
git add -A
git -c user.name=’Runner' -c user.email='runner@local.com' commit -m "Sample git msg"
git remote add azure "https://${user}:${pass}@$CI_PROJECT_NAME.scm.azurewebsites.net/${CI_PROJECT_NAME}-$$CI_PROJECT_NAME.git"
git remote -v
git push -f azure master
cd ..
rm -rf staging
This is not pretty, please by all means improve on this. 这不是很漂亮,请务必对此进行改进。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.