Deploying to different environments using GitLab Flow
We have so far discussed how to store and use our completed code by publishing to and pulling from GitLab’s package and container registries. Now, we will learn about some of GitLab’s features for organizing deployments of code to particular environments.
GitLab has two terms, environments and deployments, that are used to describe and categorize the location and version of a deployed application. An environment is represented by a name and a URL, which serve as organizational labels inside GitLab. Whenever an application is deployed to that environment via CI/CD, GitLab creates and categorizes it as a new deployment.
Environments are created via the environment keyword in a CI/CD job. That prompts GitLab CI/CD to associate the job and resulting deployment with that environment, along with the specified name and URL. In the following example, we’ve modified two of our previously created jobs to deploy...