I am new to gitlab. I have created a Flask app and it is ready for production. When I push my code to prod, I would like certain files to get changed to tell Flask that it is in production. What is the recommended way of doing this? Is there already a gitlab template or something for this?
It depends a little bit on whether you want to commit those changes anywhere. If not, it’s much simpler.
.gitlab-ci.yml file, the
after_script sections all contain Bash commands, so anything you can do in Bash you can do in the pipeline. So, you might have a pipeline job like:
stages: - ... - prepare prepare: stage: prepare script: - sed -i 's|ENV=.*|ENV='production'|' myconfigfile.yaml
There are a couple of ways you can ensure that this only runs on your
main branch. One is to use
rules and define slightly different jobs for different branches.
Got it. That is exactly what I was looking for.