Hi all, I'm struggling setup a clean unified Gitl...
# general
a
Hi all, I'm struggling setup a clean unified Gitlab CI/CD pipeline with pants. Does anybody have experience with that outside of the Github example in the docs?
s
I set up a gitlab CI pipeline fairly recently, whats giving you issues?
a
Hey @straight-alligator-6122 thanks for the response. Let me try and break it down for you. We have a few different apps that share libs (yay monorepo) and I only want to deploy those that need to be deployed leveraging
--changed-since
but this seems to not be picking up any changes even though I explicitly have updated just a single app to test. I put this on pause to continue working on just getting build and deploy of all apps through unified pipeline. In addition to the issue with detecting changes that I'm trying to determine trade off of doing
pants package + docker build and tag + docker push
vs
pants package + pants publish
. The problem I'm seeing with leveraging
pants publish
is how to deploy to different environments (which essentially are different GCP projects) that have different artifact repositories. Here is a sample file and you'll notice this line commented out
Copy code
# changed_targets=$(pants --changed-since=$PANTS_BASE --changed-dependents=transitive list)
I then was checking with
grep
to see if the service needed building
s
Do the issues with —changed-since happen locally or just in CI? Sounds like a stupid answer but make sure the change you made is actually a dependency of the image, pants dependencies are granular down to the file. Pants has good introspection features with this like pants dependents/dependencies If just in CI, could be to do with the target branch/commit. You might need to fetch the target branch in an MR pipeline, and use CI_COMMIT_BEFORE_SHA in a branch pipeline Not sure i understood your docker image problem. Is it that you sant to auth with multiple container registries? If docker auth is an issue you can always fallback to doing a docker login before the pants publish command (this is what I do for auth with azure container registry)
a
Thanks for the response Angus, you were right it actually was a non pants issue 😞 I needed to fetch the target branch. I did end up figuring out the docker issue it required some config in the
pants.ci.toml
file which I mistakenly assumed was automatically picked up with the hierarchy of
pants.toml
then
pants.ci.toml
To solve the pants package with docker in pipeline issue I did the following (for anybody that ends up in this thread later)
Copy code
# .gitlab-ci.yml

variables:
  PANTS_CONFIG_FILES: "pants.ci.toml"
  DOCKER_HOST: "<tcp://docker:2375>"
  DOCKER_TLS_CERTDIR: ""
Copy code
# pants.ci.toml

[docker]
tools = ["docker-credential-gcloud", "dirname", "readlink", "python3"]
env_vars = ["DOCKER_HOST=<tcp://docker:2375>", "DOCKER_TLS_CERTDIR=''"]
❤️ 1