I am a trial user using gitlab.com and my own Digital Ocean Ubuntu 20.04 server as a deployment server and runner. I have CICD working as explained in the tutorial How To Set Up a Continuous Deployment Pipeline with GitLab CI/CD on Ubuntu 18.04 | DigitalOcean. There were some issues needing docker image version / settings changes in the .gitlab-ci.yml but otherwise it went well and every gitlab commit results in a new deployment as expected.
The above tutorial uses a gitlab repo. However, as we have our repos on github at present I wanted to see if I could reproduce the situation using a link to a github repo instead.Having followed Using GitLab CI/CD with a GitHub repository | GitLab I have created the external github reference project in gitlab and have replicated the gitlab repo in github and can trigger the relevant pipeline ok manually by running the pipeline from gitlab but new commits in github do not trigger the pipeline. I did see an error message “Update of imported projects with realtime changes failed” pop up in the gitlab GUI on setting this up which is probably related to the issue. I can’t find any relevant hits for this error message when searching the web. Any ideas what the problem might be? I attach the .gitlab-ci.yml which as I say, works fine with a gitlab repo and also works fine in a github repo other than the commit trigger issue. Since this dialog won’t let me upload anything other than pictures and its a private repo here is the entire .gitlab-ci.yml (sorry if this offends) - only thing is I have removed our server address and replaced it with OUR.DIGITAL.OCEAN.SERVER.
# Olivier Lacan: using “docker” as the host is only possible if you alias the service below
# Olivier Lacan: could be wrong here but although Docker defaults to overlay2,
# Docker-in-Docker (DIND) does not according to the following GitLab doc:
# Use Docker to build Docker images | GitLab
- name: docker:20-dind
# in Olivier Lacan’s experience although you’d assume this would be sufficient, this did
# nothing to prevent connection errors without
DOCKER_TLS_CERTDIR being set
# to an empty string, and I would call that beyond mildly infuriating.
- docker build -t $TAG_COMMIT -t $TAG_LATEST .
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker push $TAG_COMMIT
- docker push $TAG_LATEST
- chmod og= $ID_RSA
- apk update && apk add openssh-client
- ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP “docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY”
- ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP “docker pull $TAG_COMMIT”
- ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP “docker container rm -f my-app || true”
- ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP “docker run -d -p 80:80 --name my-app $TAG_COMMIT”