Commit 4bff5fa1 authored by Tony Wildish's avatar Tony Wildish
Browse files

Merge branch 'latest' into 'latest'

minor updates to gitlab exercises

See merge request !71
parents 7ba144ec 97eba80a
......@@ -38,7 +38,9 @@ Now that you're logged into the registry you can even push images there by hand,
### Deploy tokens ###
If you want to run this docker image in a batch script, or a web service, you won't want to have to log into the registry on every machine you use, or every time it gets rebooted. Instead, if you only want to _use_ the images, but not to _upload_ them from the coomand line, you want a way to have read-only access to the registry. Gitlab provides **deploy-tokens** for that purpose, follow the link on the Registry page to learn more about them.
If you want to run this docker image in a batch script, or a web service, you won't want to have to log into the registry on every machine you use, or every time it gets rebooted. Instead, if you only want to _use_ the images, but not to _upload_ them from the coomand line, you want a way to have read-only access to the registry. Gitlab provides **deploy-tokens** for that purpose, which are basically the same as the access token you've already created in the first exercise. For running batch jobs, you should create another, giving it only **read_registry** access, nothing else. You can then safely publish this anywhere you like, the worst people can do with it is to download your images.
You'll need to make a note of the expiry date of your deploy tokens, and set a reminder to create a new one well in advance if you're running in a production environment. Alternatively, if your containers are fit for public release, you can push them to a public service like dockerhub instead.
### Conclusion ###
......
......@@ -49,6 +49,14 @@ Hello World
Compiled on Tue Jul 30 10:58:09 UTC 2019
```
### Bonus exercise: git branches ###
What happens if you use a git branch, instead of a tag? The CI/CD pipeline will still fire, and will know the branch name, so it uses that in the docker image tag. However, since your **.gitlab-ci.yml** file only runs the **test** stage for git _tags_ and not for git _branches_, you will only get a two-stage pipeline.
Can you modify the YAML file so it runs for branches too? [Check the documentation](https://docs.gitlab.com/ee/ci/yaml/#onlyexcept-basic) for help.
If you're on a branch, and you use a tag too, what do you think gitlab will do? Try it and find out.
### Conclusion ###
You now know how to control the activities in a build when using git tags, and how to use those tags to automatically tag the docker image with the same name.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment