Reputation: 347
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
.
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. There is any way where the GitLab server pushes(publishes) the commits to master into an 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.
Upvotes: 1
Views: 1720
Reputation: 2984
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. I was able to do this via 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
#Store username and pass as variables
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="[email protected]" 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.
Upvotes: 2
Reputation: 6233
If Azure machine can connect to GitLab, you can setup GitLab CI runner that will get changes from GitLab and run your custom script. This way GitLab doesn't have to talk to Azure, Azure will automatically pull changes from GitLab. Any recent GitLab version bundles GitLab-CI service that you can enable in your project. More on CI-runner configuration here and GitLab-CI.
Upvotes: 0