diff --git a/.gitignore b/.gitignore index 7b4510b..a043c41 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ .vagrant stats *.pdf +vm/*.ova +vm/mnt +trainer/ diff --git a/README.md b/README.md index 0466a96..f447edc 100644 --- a/README.md +++ b/README.md @@ -37,19 +37,11 @@ Requirements: * Docker * https://nws.netways.de GitLab instances for the trainer and participants -### Start Showoff in Docker +To run the presentation you will need [showoff 0.19.x](https://rubygems.org/gems/showoff/versions/0.19.6). +After installing it simply run `showoff serve` to get presenter mode with additional notes +and display window to present to your students. -``` -./start.sh -``` - -### Print Static Content - -For GitHub. - -``` -./print.sh -``` +More instructions [here](https://github.com/NETWAYS/training-global#using-docker-to-build-and-serve-the-slide-deck). ### Environment diff --git a/global/.gitignore b/global/.gitignore index 1a9662a..dec5dc7 100644 --- a/global/.gitignore +++ b/global/.gitignore @@ -1,2 +1,3 @@ static stats +trainer diff --git a/Dockerfile b/global/Dockerfile similarity index 72% rename from Dockerfile rename to global/Dockerfile index a9b15ad..216e601 100644 --- a/Dockerfile +++ b/global/Dockerfile @@ -1,10 +1,13 @@ -FROM ubuntu:xenial +FROM ubuntu:bionic +LABEL maintainer="support@netways.de" + +ARG TEMP_DIR=/tmp WORKDIR /training # basic showoff and patched wkhtmltopdf dependencies RUN apt-get update \ - && apt-get install -y \ + && apt-get install -y -q \ build-essential \ wget \ markdown \ @@ -20,7 +23,9 @@ RUN apt-get update \ libxext-dev \ libfontconfig1-dev \ libfreetype6-dev \ - fontconfig + fontconfig \ + && apt-get clean \ + && rm -r /var/lib/apt/lists/* # RUN rm -f /etc/alternatives/ruby \ # && ln -s /usr/bin/ruby1.9.3 /etc/alternatives/ruby \ @@ -28,11 +33,15 @@ RUN apt-get update \ # && ln -s /usr/bin/gem1.9.3 /etc/alternatives/gem # wkhtmltopdf needs a patched QT version -RUN cd $HOME \ +RUN cd $TEMP_DIR \ && wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz \ && tar vxf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz \ - && cp wkhtmltox/bin/wk* /usr/local/bin/ + && cp wkhtmltox/bin/wk* /usr/local/bin/ \ + && rm -rf $TEMP_DIR/wkhtml* RUN gem install showoff --version=0.19.6 -CMD "/bin/bash" +EXPOSE 9090 + +CMD ["showoff", "serve"] + diff --git a/global/Post/01_Feedback.md b/global/Post/01_Feedback.md deleted file mode 100644 index ed9e506..0000000 --- a/global/Post/01_Feedback.md +++ /dev/null @@ -1,4 +0,0 @@ -!SLIDE noprint center -# Feedback - -We look forward to your feedback diff --git a/global/Post/02_Thanks.md b/global/Post/02_Thanks.md deleted file mode 100644 index dfb8750..0000000 --- a/global/Post/02_Thanks.md +++ /dev/null @@ -1,4 +0,0 @@ -!SLIDE noprint center -# Thank You - -Thank you for your attention! diff --git a/global/Post/03_Contributing.md b/global/Post/03_Contributing.md deleted file mode 100644 index 0c2240f..0000000 --- a/global/Post/03_Contributing.md +++ /dev/null @@ -1,13 +0,0 @@ -!SLIDE noprint center -# Contributing - -Contribute to the GitLab training on [GitHub](https://github.com/NETWAYS/gitlab-training) to make it even better. - -Material is licensed under [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](http://creativecommons.org/licenses/by-nc-sa/4.0/). - - -!SLIDE noprint smbullets -# Contributors - -* Michael Friedrich -* Markus Waldmüller diff --git a/global/Pre/Title/01_Title.md b/global/Pre/Title/01_Title.md deleted file mode 100644 index 7b5ea70..0000000 --- a/global/Pre/Title/01_Title.md +++ /dev/null @@ -1,17 +0,0 @@ -!SLIDE printonly - - -
-
~~~CONFIG:title~~~
-
~~~CONFIG:subtitle~~~
-
Version: ~~~CONFIG:release~~~
- -
- -!SLIDE noprint - -

~~~CONFIG:title~~~

-

created by NETWAYS GmbH

-

Original Authors: ~~~CONFIG:author~~~

diff --git a/global/README.md b/global/README.md new file mode 100644 index 0000000..2f36c1e --- /dev/null +++ b/global/README.md @@ -0,0 +1,168 @@ +# NETWAYS Training global artefacts + +This repository holds global artefacts for a specific NETWAYS training. For example, layouts, templates and images +resides here. + +## How to use + +### 1. Add global resource directory to your project + +The global resource dir is introduced by using git subtree mechanism. This keeps the training repository clear from +special git instructions and let users easily clone and use the repository. In addition, the external code (global) can +be patched locally if needed and pinned to a specific version. + +#### Add a new remote to git +```bash +$ git remote add global https://github.com/NETWAYS/training-global.git +$ git fetch global +remote: Counting objects: 157, done. +remote: Compressing objects: 100% (122/122), done. +remote: Total 157 (delta 24), reused 154 (delta 21), pack-reused 0 +Receiving objects: 100% (157/157), 27.82 MiB | 913.00 KiB/s, done. +Resolving deltas: 100% (24/24), done. +From https://github.com/NETWAYS/training-global + * [new branch] master -> global/master +``` + +#### Create a new subtree named global +```bash +$ git subtree add --squash --prefix=global/ global master +git fetch global master +From https://github.com/NETWAYS/training-global + * branch master -> FETCH_HEAD +Added dir 'global' +``` + +### 2. Create a directory to provide trainer introduction + +This is probably easy but we want to achieve that changes in this directory does not influence the source code from our +training. + +```bash +$ mkdir trainer +$ touch trainer/.keep +$ echo 'trainer/' >> .gitignore +$ git add -f trainer/ # Force add to git because it is in .gitignore +$ git commit -m "Add directory for trainer introduction" +``` + +After this step you are able to copy files into the directory which are not captured by the git commit staging process. + +### 3. Link stylesheet to root level + +```bash +$ ln -s global/layouts/netways.css +``` + +This step seems ugly and we totally agree with you. In order to print and convert the training slides into pdf, this +step is absolutely needed to succeed. + +### 4. Create a showoff.json stub file + +```json +{ + "name": "My awesome training", + "subtitle": "Train awesome stuff", + "author": "Colt Seavers & Howie Munson", + "release": "0.9.0", + + "favicon": "global/favicon.ico", + + "protected": ["presenter", "onepage", "print"], + + "user": "netways", + "password": "awesome", + + "templates" : { + "default": "global/layouts/netways.tpl" + }, + + "sections": [ + {"section": "global/pre/netways/title"}, + {"section": "trainer"}, + {"section": "global/pre/netways/about"}, + {"section": "global/pre/hints"}, + + {"section": "sections/..."}, + + {"section": "global/post"} + ] +} +``` + +After the file is created you're able to start the slide deck (showoff): + +```bash +$ showoff serve +``` + +## Update global directory from GitHub + +```bash +$ git fetch global +$ git subtree pull --squash --prefix=global/ global master +``` + +Please make sure that no changed files present or staged commits pending. + +## Using docker to build and serve the slide deck + +### Run showoff + +```bash +$ docker run -it --rm -v "$PWD:/training" -p "9090:9090" \ + netways/showoff:0.19.6 \ + showoff serve +``` + +### Build static html files + +```bash +$ docker run -it --rm -v "$PWD:/training" \ + netways/showoff:0.19.6 \ + showoff static print +``` + +### Create PDF from static html files + +```bash +$ docker run -it --rm -v "$PWD:/training" \ + netways/showoff:0.19.6 \ + wkhtmltopdf -s A5 --print-media-type \ + --footer-left \[page\] --footer-right '© NETWAYS' \ + static/index.html test.pdf +``` + +### NETWAYS Training Wizard + +Alternatively you can simply run the NETWAYS training wizard: + +``` +$ ./global/wizard.sh +########################### + NETWAYS Training Wizard +########################### + +### LAYOUT ### + + [1] NETWAYS + [2] OSMC + [3] OSDC + [4] OSBConf + +Which Layout? [1-4] (Default: 1): + +### MODE ### + +Which mode? [serve/print] (Default: serve): print + +### PRINT ### + + [1] Handouts + [2] Handouts & Solutions + [3] Handouts & Exercises & Solutions + [4] Exercises & Solutions + +What to print? [1-4] (Default: 2): +Which version? (Default: 2.1.1): +``` diff --git a/global/_files/share/test b/global/_files/share/test new file mode 100644 index 0000000..e69de29 diff --git a/global/_preshow/training_slider_de_600x366.png b/global/_preshow/training_slider_de_600x366.png new file mode 100644 index 0000000..5585bb6 Binary files /dev/null and b/global/_preshow/training_slider_de_600x366.png differ diff --git a/global/_preshow/training_slider_docker_600x366.png b/global/_preshow/training_slider_docker_600x366.png new file mode 100644 index 0000000..929b3e4 Binary files /dev/null and b/global/_preshow/training_slider_docker_600x366.png differ diff --git a/global/_preshow/training_slider_en_600x366.png b/global/_preshow/training_slider_en_600x366.png new file mode 100644 index 0000000..7439fba Binary files /dev/null and b/global/_preshow/training_slider_en_600x366.png differ diff --git a/global/_preshow/training_slider_graphite_600x366.png b/global/_preshow/training_slider_graphite_600x366.png new file mode 100644 index 0000000..1a8fc61 Binary files /dev/null and b/global/_preshow/training_slider_graphite_600x366.png differ diff --git a/global/_preshow/training_slider_icinga_2_de_600x366.png b/global/_preshow/training_slider_icinga_2_de_600x366.png new file mode 100644 index 0000000..82694a3 Binary files /dev/null and b/global/_preshow/training_slider_icinga_2_de_600x366.png differ diff --git a/global/_preshow/training_slider_icinga_2_en_600x366.png b/global/_preshow/training_slider_icinga_2_en_600x366.png new file mode 100644 index 0000000..d67af87 Binary files /dev/null and b/global/_preshow/training_slider_icinga_2_en_600x366.png differ diff --git a/global/_preshow/training_slider_icinga_de_600x366.png b/global/_preshow/training_slider_icinga_de_600x366.png new file mode 100644 index 0000000..e5b015b Binary files /dev/null and b/global/_preshow/training_slider_icinga_de_600x366.png differ diff --git a/global/_preshow/training_slider_icinga_en_600x366.png b/global/_preshow/training_slider_icinga_en_600x366.png new file mode 100644 index 0000000..93ec519 Binary files /dev/null and b/global/_preshow/training_slider_icinga_en_600x366.png differ diff --git a/global/_preshow/training_slider_logtash_600x366.png b/global/_preshow/training_slider_logtash_600x366.png new file mode 100644 index 0000000..06e5615 Binary files /dev/null and b/global/_preshow/training_slider_logtash_600x366.png differ diff --git a/global/_preshow/training_slider_puppet_architect_600x366.png b/global/_preshow/training_slider_puppet_architect_600x366.png new file mode 100644 index 0000000..c502195 Binary files /dev/null and b/global/_preshow/training_slider_puppet_architect_600x366.png differ diff --git a/global/_preshow/training_slider_puppet_fundamentals_600x366.png b/global/_preshow/training_slider_puppet_fundamentals_600x366.png new file mode 100644 index 0000000..63a9542 Binary files /dev/null and b/global/_preshow/training_slider_puppet_fundamentals_600x366.png differ diff --git a/global/_preshow/training_slider_puppet_practitioner_600x366.png b/global/_preshow/training_slider_puppet_practitioner_600x366.png new file mode 100644 index 0000000..012fc8d Binary files /dev/null and b/global/_preshow/training_slider_puppet_practitioner_600x366.png differ diff --git a/global/_preshow/training_slider_sla_de_600x366.png b/global/_preshow/training_slider_sla_de_600x366.png new file mode 100644 index 0000000..e7c352a Binary files /dev/null and b/global/_preshow/training_slider_sla_de_600x366.png differ diff --git a/global/_preshow/training_slider_sla_en_600x366.png b/global/_preshow/training_slider_sla_en_600x366.png new file mode 100644 index 0000000..1abe30a Binary files /dev/null and b/global/_preshow/training_slider_sla_en_600x366.png differ diff --git a/global/_preshow/training_slider_vagrant_600x366.png b/global/_preshow/training_slider_vagrant_600x366.png new file mode 100644 index 0000000..2a3db9e Binary files /dev/null and b/global/_preshow/training_slider_vagrant_600x366.png differ diff --git a/global/docker-compose.yml b/global/docker-compose.yml new file mode 100644 index 0000000..ad9dcaa --- /dev/null +++ b/global/docker-compose.yml @@ -0,0 +1,15 @@ +version: "3" + +services: + showoff: + build: . + image: netways/showoff:0.19.6 + ports: + - "9090:9090" + volumes: + - "$PWD:/training" + environment: + - "LANG=C.UTF-8" + - "LANGUAGE=C.UTF-8" + - "LC_ALL=C.UTF-8" + diff --git a/global/layouts/netways.css b/global/layouts/netways.css new file mode 100644 index 0000000..aceb3d4 --- /dev/null +++ b/global/layouts/netways.css @@ -0,0 +1,671 @@ +/************************************************* + Corrections for strange CSS rules by showoff + ************************************************/ + +.code { + white-space: unset; +} +.content.code p { + font-family: monospace; + white-space: pre; +} + +.content.center { + position: unset; + top: unset; + -webkit-transform: unset; + -ms-transform: unset; + transform: unset; +} + +@media screen { + /* The following assumes we'd get 24px (1.5em) by default: 24 / (16 x 0.8 x 0.8) */ + .slide.small .content.small .net-header, + .slide.small .content.small .net-footer { + font-size: 234.375%; + } + + /* The following assumes we'd get 24px (1.5em) by default: 24 / (16 x 0.7 x 0.7) */ + .slide.smaller .content.smaller .net-header, + .slide.smaller .content.smaller .net-footer { + font-size: 306.122449%; + } + + /* The following assumes the same as above, but is for non-container elements */ + .slide.small .content.small .net-header + h1:not(.section-title) { + font-size: 3.515625em; + } + .slide.smaller .content.smaller .net-header + h1:not(.section-title) { + font-size: 4.591836735em; + } +} + +@media print { + /* The following assumes we'd get 16px (1em) by default: 16 / (16 x 0.8) */ + .content.small .net-header, + .content.small .net-footer { + font-size: 125%; + } + + /* The following assumes we'd get 16px (1em) by default: 16 / (16 x 0.7) */ + .content.smaller .net-header, + .content.smaller .net-footer { + font-size: 142.8571429%; + } + + /* The following assumes the same as above, but is for non-container elements */ + .content.small .net-header + h1:not(.section-title) { + font-size: 1.875em; + } + .content.smaller .net-header + h1:not(.section-title) { + font-size: 2.142857144em; + } +} + +/************************************************* + Layout + + !!!!!!!!!!!!!!!!!!!! + Please pay attention that all layout styles do not + depend on any raw pixel sizes. Hence when adjusting + anything, please use percent or em as size unit. + And adjust dependent elements, paddings, margins + accordingly. Thank you! + !!!!!!!!!!!!!!!!!!!! + + ************************************************/ + +.net-header img { + margin-right: 1.5em; +} + +.content .net-header + h1:not(.section-title) { + line-height: 100%; + font-size: 1.5em; + padding: .1em .25em; + border-bottom: none; +} + +.content.subsection .net-header + h1:not(.section-title), +.content.subsectionnonum .net-header + h1:not(.section-title) { + display: inline-block; + margin-top: 3em; + font-size: 2em; +} + +.center .net-header + h1 { + text-align: left; +} + +@media screen { + .slide:not(.small):not(.smaller) { + font-size: 1.5em; /* Already done by showoff, but in case they'll change it in the future.. */ + } + + .net-header { + height: 4.104166667em; + padding-bottom: .0625em; + } + + .subsection .net-header, + .subsectionnonum .net-header, + #pre_netways_title_00_title1 .net-header, + #global_pre_netways_title_00_title1 .net-header { + border-bottom: .0625em solid black; + padding-bottom: 0; + } + + .net-header img { + /* Solves that the image overlays the header's border. + #preso's transformation still produces artifacts, though.. */ + margin-top: -.0625em; + /* Yep, applied on every slide. Otherwise we'll get flickering when switching slides */ + } + + .content .net-header + h1:not(.section-title) { + margin: 0; + color: white; + background: #FA5C0D; + } + + .net-footer { + position: absolute; + bottom: 0; + width: 100%; + color: white; + background: #FA5C0D; + } + + .net-footer * { + font-size: 62.5%; + } + + .net-footer :first-child { + display: inline-block; + margin: .5em 1em; + } + + .net-footer :last-child { + float: right; + margin: .5em 1em; + } +} + +@media print { + .slide:not(.small):not(.smaller) { + font-size: 1em; /* Already done by showoff, but in case they'll change it in the future.. */ + } + + .net-header { + height: 6.1875em; + border-bottom: .0625em solid black; + } + + .net-header img { + height: 99%; /* The negative margin workaround does not work with wkhtmltopdf.. */ + } + + #pre_netways_title_00_title1 .net-header, + #global_pre_netways_title_00_title1 .net-header { + display: none; + } + + .content:not(.subsection):not(.subsectionnonum) .net-header + h1:not(.section-title) { + margin: .3em 0; + } + + .subsection .net-header + h1:not(.section-title), + .subsectionnonum .net-header + h1:not(.section-title) { + white-space: nowrap; /* TODO: Why?? Only wkhtmltopdf requires this.. */ + color: white; + background: #FA5C0D; + } + + .net-footer { + display: none; + } +} + +/************************************************* + Global styles + ************************************************/ + +@media screen { + .title-name { + overflow: auto; + } + + .title-name p { + float: right; + margin: 1em 0; + padding: .25em; + font-size: 2.5em; + color: white; + background: black; + } + + .title-subtitle { + overflow: auto; + } + + .title-subtitle p { + float: right; + margin: 1em 0; + padding: .25em; + font-size: 1.5em; + color: black; + background: #FA5C0D; + } + + .title-author p { + font-size: 1.35em; + } +} + +@media print { + .title-logo { + margin: 1em; + } + + .title-logo img { + margin: 0 auto; + } + + .title-cover { + margin: 0.5em; + margin-top: 4em; + padding: 1em; + height: 30em; + color: white; + background: #FA5C0D; + } + + .title-name { + font-size: 2em; + } + + .title-release { + margin-top: 2em; + } + + .title-footer { + margin-top: 23.5em; + text-align: right; + font-weight: bold; + } +} + +/************************************************* + Slide styles + ************************************************/ + +@media screen { + /** + Please note: + 4.166666667em = Header height + 1.8em = h1 height + 1.354166667em = Footer height + 24.679166666em = Content height + 32em = Total slide height + **/ + .content > .margin-top-1-8 { margin-top: 3.084895833em; } + .content > .margin-top-1-7 { margin-top: 3.525595238em; } + .content > .margin-top-1-6 { margin-top: 4.113194444em; } + .content > .margin-top-1-5 { margin-top: 4.935833333em; } + .content > .margin-top-1-4 { margin-top: 6.169791666em; } + .content > .margin-top-1-3 { margin-top: 8.226388889em; } + .content > .margin-top-1-2 { margin-top: 12.339583333em; } + + /* Since bigtext does not work with our layout.. */ + .content > .large { font-size: 120%; } + .content > .larger { font-size: 140%; } + .content > .even-larger { font-size: 180%; } + .content > .big { font-size: 150%; } + .content > .bigger { font-size: 300%; } + .content > .probably-too-big { font-size: 600%; } +} + +@media print { + /** + Please note: + 6.25em = Header height + 2.7em = h1 height + 2.03125em = Footer height + 38.81875em = Content height + 49.8em = Total slide height + **/ + .content > .margin-top-1-8 { margin-top: 4.85234375em; } + .content > .margin-top-1-7 { margin-top: 5.545535714em; } + .content > .margin-top-1-6 { margin-top: 6.469791667em; } + .content > .margin-top-1-5 { margin-top: 7.76375em; } + .content > .margin-top-1-4 { margin-top: 9.7046875em; } + .content > .margin-top-1-3 { margin-top: 12.939583333em; } + .content > .margin-top-1-2 { margin-top: 19.409375em; } + + /* Since bigtext does not work with our layout.. */ + .content > .large { font-size: 180%; } + .content > .larger { font-size: 210%; } + .content > .even-larger { font-size: 270%; } + .content > .big { font-size: 225%; } + .content > .bigger { font-size: 450%; } + .content > .probably-too-big { font-size: 900%; } +} + +/************************************************* + Legacy styles + ************************************************/ + +@media screen { + /* Global */ + + .slide, #preso { + height: 768px; + width: 1024px; + } + + a, a:visited { + color: #FA5C0D; + text-decoration: none; + } + + .content h2 { + font-size: 24px; + margin-left: 1em; + text-align: left; + } + + .content h3 { + font-size: 20px; + margin-left: 1em; + text-align: left; + } + + .content h4 { + font-size: 16px; + margin-left: 1em; + text-align: left; + } + + .content > p, + .content > form > p { + text-align: left; + } + + .content p > img { + max-width: 100%; + } + + /* Slide Styles */ + + .bullets > ul { + font-size: 1.5em; + list-style: disc; + } + .smbullets > ul { + list-style: disc; + } + .bullets > ul > li, + .smbullets > ul > li { + text-align: left; + } + .bullets > ul > li > p, + .smbullets > ul > li > p { + margin: 0; + } + + /* Legacy styles start - For backward compliance with slides created using showoff v0.9.11.1 */ + .slide.small > .content.small > p, + .slide.small > .content.small > ul, + .slide.small > .content.small > pre, + .slide.small > .content.small > table { + font-size: 2em; + } + + .slide.small > .content.smbullets.small > ul > li { + margin: 0; + } + /* Legacy styles end */ + + .center p { + text-align: center; + } + .center > img { + display: block; + height: 90%; + margin-top: 160px; + margin-left: auto; + margin-right: auto; + width: 90%; + } + + .break { + visibility: collapse; + } + + .supplemental.content > p { + font-size: 2em; + } + + /* Custom Slide Styles */ + + .lrbullets > ul > li:nth-of-type(odd) { + float: left; + width: 50%; + } + .lrbullets > ul > li:nth-of-type(even) { + } + + .limg > img, + .limg > p > img { + float: left; + width: 400px; + height: 50%; + } + .rimg > img, + .rimg > p > img { + float: right; + width: 50%; + height: 50%; + } + + .lbullets > ul { + float: left; + width: 50%; + } + .lbullets > ul > li { + float: left; + width: 50%; + } + .rbullets > ul { + float: right; + width: 50%; + } + .rbullets > ul > li { + float: right; + width: 50%; + } + + /* Legacy styles start - Print specific styles which are not hidden anymore? */ + .pagebreak { + display: none; + } + /* Legacy styles end */ + + /* Custom Layout */ + + img#staff { + float: right; + margin-right: 100px; + width: 240px; + height: 240px; + } +} + +@page { + margin: 0; + margin-top: 1em; + margin-left: 2em; + margin-right: 1em; + margin-bottom: 1em; +} + +@media print { + code { + font-size: 12px; + } + + li, td { + font-size: 14px; + } + + .slide, #preso { + font: normal 1.0em "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + height: 100%; + margin: 0; + margin-top: 0em; + margin-left: 0em; + margin-right: 0em; + margin-bottom: 0em; + width: 99%; + } + + a, a:visited { + color: #FA5C0D; + text-decoration: none; + } + + .content { + padding-top: 5px; + } + + .content h2 { + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 24px; + text-align: left; + margin-left: 0.5em; + margin-right: 3em; + } + + .content h3 { + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 20px; + text-align: left; + margin-left: 0.5em; + margin-right: 3em; + } + + .content h4 { + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 16px; + text-align: left; + margin-left: 0.5em; + margin-right: 3em; + } + + .content > p { + font-size: 16px; + text-align: left; + } + + /* Slide Styles */ + + .bullets > ul { + list-style: disc; + padding-left: 40px; + } + .smbullets > ul { + list-style: disc; + padding-left: 10px; + } + .bullets > ul > li, + .smbullets > ul > li { + text-align: left; + } + .bullets > ul > li > p, + .smbullets > ul > li > p { + margin: 0; + } + + .content > pre, .handouts > pre, .content > form > pre { + font-size: 120%; + margin: 0 2em; + } + .content > pre > code, .handouts > pre > code, .content > form > pre > code { + overflow: visible; + } + + .center p { + text-align: center; + } + + .center > img { + display: block; + height: 90%; + margin-left: auto; + margin-right: auto; + width: 90%; + } + + .content table tr td { + text-align: left; + } + + .annotations { + display: none; + } + + .pagebreak { + margin: 1em; + } + + .handouts { + display: block !important; + border: none; + } + .handouts h1, h2, h3, h4 { + margin: 0; + margin-top: 1em; + margin-left: 0.5em; + margin-right: 3em; + margin-bottom: 1em; + text-align: left; + } + .handouts hr { + margin: 2em 0; + } + .handouts p { + margin: 0 3em 1em 2em; + text-align: left; + word-wrap: break-word; + } + + .handouts > pre, .handouts > form > pre { + word-wrap: break-word; + } + + .handouts > ul { + list-style: disc; + padding-left: 40px; + } + + .supplemental { + right: 0.5em; + } + + .supplemental.content > p { + font-size: 14px; + } + + .supplemental .content > pre > code { + word-wrap: break-word; + } + + .supplemental h1 { + margin: 0; + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 22px; + text-align: left; + } + + .supplemental h2 { + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 20px; + text-align: left; + } + + .supplemental h3 { + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 18px; + text-align: left; + } + + .supplemental h4 { + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 16px; + text-align: left; + } + + div#toc a { + font-size: 14px; + margin-left: 2em; + } + + /* Custom Slide Styles */ + + .lrbullets > ul > li:nth-of-type(odd) { + float: left; + width: 50%; + } + .lrbullets > ul > li:nth-of-type(even) { + } + + /* Custom Layout */ + + .content.small table { + font: normal 1.5em "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + } +} diff --git a/global/layouts/netways.tpl b/global/layouts/netways.tpl new file mode 100644 index 0000000..6393b20 --- /dev/null +++ b/global/layouts/netways.tpl @@ -0,0 +1,10 @@ +
+ NETWAYS Training +
+ +~~~CONTENT~~~ + + diff --git a/global/layouts/osbconf.css b/global/layouts/osbconf.css new file mode 100644 index 0000000..f488504 --- /dev/null +++ b/global/layouts/osbconf.css @@ -0,0 +1,671 @@ +/************************************************* + Corrections for strange CSS rules by showoff + ************************************************/ + +.code { + white-space: unset; +} +.content.code p { + font-family: monospace; + white-space: pre; +} + +.content.center { + position: unset; + top: unset; + -webkit-transform: unset; + -ms-transform: unset; + transform: unset; +} + +@media screen { + /* The following assumes we'd get 24px (1.5em) by default: 24 / (16 x 0.8 x 0.8) */ + .slide.small .content.small .net-header, + .slide.small .content.small .net-footer { + font-size: 234.375%; + } + + /* The following assumes we'd get 24px (1.5em) by default: 24 / (16 x 0.7 x 0.7) */ + .slide.smaller .content.smaller .net-header, + .slide.smaller .content.smaller .net-footer { + font-size: 306.122449%; + } + + /* The following assumes the same as above, but is for non-container elements */ + .slide.small .content.small .net-header + h1:not(.section-title) { + font-size: 3.515625em; + } + .slide.smaller .content.smaller .net-header + h1:not(.section-title) { + font-size: 4.591836735em; + } +} + +@media print { + /* The following assumes we'd get 16px (1em) by default: 16 / (16 x 0.8) */ + .content.small .net-header, + .content.small .net-footer { + font-size: 125%; + } + + /* The following assumes we'd get 16px (1em) by default: 16 / (16 x 0.7) */ + .content.smaller .net-header, + .content.smaller .net-footer { + font-size: 142.8571429%; + } + + /* The following assumes the same as above, but is for non-container elements */ + .content.small .net-header + h1:not(.section-title) { + font-size: 1.875em; + } + .content.smaller .net-header + h1:not(.section-title) { + font-size: 2.142857144em; + } +} + +/************************************************* + Layout + + !!!!!!!!!!!!!!!!!!!! + Please pay attention that all layout styles do not + depend on any raw pixel sizes. Hence when adjusting + anything, please use percent or em as size unit. + And adjust dependent elements, paddings, margins + accordingly. Thank you! + !!!!!!!!!!!!!!!!!!!! + + ************************************************/ + +.net-header img { + margin-right: 0; +} + +.content .net-header + h1:not(.section-title) { + line-height: 100%; + font-size: 1.5em; + padding: .1em .25em; + border-bottom: none; +} + +.content.subsection .net-header + h1:not(.section-title), +.content.subsectionnonum .net-header + h1:not(.section-title) { + display: inline-block; + margin-top: 3em; + font-size: 2em; +} + +.center .net-header + h1 { + text-align: left; +} + +@media screen { + .slide:not(.small):not(.smaller) { + font-size: 1.5em; /* Already done by showoff, but in case they'll change it in the future.. */ + } + + .net-header { + height: 4.104166667em; + padding-bottom: .0625em; + } + + .subsection .net-header, + .subsectionnonum .net-header, + #pre_osbconf_title_00_title1 .net-header, + #global_pre_osbconf_title_00_title1 .net-header { + border-bottom: .0625em solid black; + padding-bottom: 0; + } + + .net-header img { + /* Solves that the image overlays the header's border. + #preso's transformation still produces artifacts, though.. */ + margin-top: -.0625em; + /* Yep, applied on every slide. Otherwise we'll get flickering when switching slides */ + } + + .content .net-header + h1:not(.section-title) { + margin: 0; + color: white; + background: #789CB1; + } + + .net-footer { + position: absolute; + bottom: 0; + width: 100%; + color: white; + background: #789CB1; + } + + .net-footer * { + font-size: 62.5%; + } + + .net-footer :first-child { + display: inline-block; + margin: .5em 1em; + } + + .net-footer :last-child { + float: right; + margin: .5em 1em; + } +} + +@media print { + .slide:not(.small):not(.smaller) { + font-size: 1em; /* Already done by showoff, but in case they'll change it in the future.. */ + } + + .net-header { + height: 6.1875em; + border-bottom: .0625em solid black; + } + + .net-header img { + height: 99%; /* The negative margin workaround does not work with wkhtmltopdf.. */ + } + + #pre_osbconf_title_00_title1 .net-header, + #global_pre_osbconf_title_00_title1 .net-header { + display: none; + } + + .content:not(.subsection):not(.subsectionnonum) .net-header + h1:not(.section-title) { + margin: .3em 0; + } + + .subsection .net-header + h1:not(.section-title), + .subsectionnonum .net-header + h1:not(.section-title) { + white-space: nowrap; /* TODO: Why?? Only wkhtmltopdf requires this.. */ + color: white; + background: #789CB1; + } + + .net-footer { + display: none; + } +} + +/************************************************* + Global styles + ************************************************/ + +@media screen { + .title-name { + overflow: auto; + } + + .title-name p { + float: right; + margin: 1em 0; + padding: .25em; + font-size: 2.5em; + color: white; + background: black; + } + + .title-subtitle { + overflow: auto; + } + + .title-subtitle p { + float: right; + margin: 1em 0; + padding: .25em; + font-size: 1.5em; + color: black; + background: #789CB1; + } + + .title-author p { + font-size: 1.35em; + } +} + +@media print { + .title-logo { + margin: 1em; + } + + .title-logo img { + margin: 0 auto; + } + + .title-cover { + margin: 0.5em; + margin-top: 4em; + padding: 1em; + height: 30em; + color: white; + background: #789CB1; + } + + .title-name { + font-size: 2em; + } + + .title-release { + margin-top: 2em; + } + + .title-footer { + margin-top: 23.5em; + text-align: right; + font-weight: bold; + } +} + +/************************************************* + Slide styles + ************************************************/ + +@media screen { + /** + Please note: + 4.166666667em = Header height + 1.8em = h1 height + 1.354166667em = Footer height + 24.679166666em = Content height + 32em = Total slide height + **/ + .content > .margin-top-1-8 { margin-top: 3.084895833em; } + .content > .margin-top-1-7 { margin-top: 3.525595238em; } + .content > .margin-top-1-6 { margin-top: 4.113194444em; } + .content > .margin-top-1-5 { margin-top: 4.935833333em; } + .content > .margin-top-1-4 { margin-top: 6.169791666em; } + .content > .margin-top-1-3 { margin-top: 8.226388889em; } + .content > .margin-top-1-2 { margin-top: 12.339583333em; } + + /* Since bigtext does not work with our layout.. */ + .content > .large { font-size: 120%; } + .content > .larger { font-size: 140%; } + .content > .even-larger { font-size: 180%; } + .content > .big { font-size: 150%; } + .content > .bigger { font-size: 300%; } + .content > .probably-too-big { font-size: 600%; } +} + +@media print { + /** + Please note: + 6.25em = Header height + 2.7em = h1 height + 2.03125em = Footer height + 38.81875em = Content height + 49.8em = Total slide height + **/ + .content > .margin-top-1-8 { margin-top: 4.85234375em; } + .content > .margin-top-1-7 { margin-top: 5.545535714em; } + .content > .margin-top-1-6 { margin-top: 6.469791667em; } + .content > .margin-top-1-5 { margin-top: 7.76375em; } + .content > .margin-top-1-4 { margin-top: 9.7046875em; } + .content > .margin-top-1-3 { margin-top: 12.939583333em; } + .content > .margin-top-1-2 { margin-top: 19.409375em; } + + /* Since bigtext does not work with our layout.. */ + .content > .large { font-size: 180%; } + .content > .larger { font-size: 210%; } + .content > .even-larger { font-size: 270%; } + .content > .big { font-size: 225%; } + .content > .bigger { font-size: 450%; } + .content > .probably-too-big { font-size: 900%; } +} + +/************************************************* + Legacy styles + ************************************************/ + +@media screen { + /* Global */ + + .slide, #preso { + height: 768px; + width: 1024px; + } + + a, a:visited { + color: #789CB1; + text-decoration: none; + } + + .content h2 { + font-size: 24px; + margin-left: 1em; + text-align: left; + } + + .content h3 { + font-size: 20px; + margin-left: 1em; + text-align: left; + } + + .content h4 { + font-size: 16px; + margin-left: 1em; + text-align: left; + } + + .content > p, + .content > form > p { + text-align: left; + } + + .content p > img { + max-width: 100%; + } + + /* Slide Styles */ + + .bullets > ul { + font-size: 1.5em; + list-style: disc; + } + .smbullets > ul { + list-style: disc; + } + .bullets > ul > li, + .smbullets > ul > li { + text-align: left; + } + .bullets > ul > li > p, + .smbullets > ul > li > p { + margin: 0; + } + + /* Legacy styles start - For backward compliance with slides created using showoff v0.9.11.1 */ + .slide.small > .content.small > p, + .slide.small > .content.small > ul, + .slide.small > .content.small > pre, + .slide.small > .content.small > table { + font-size: 2em; + } + + .slide.small > .content.smbullets.small > ul > li { + margin: 0; + } + /* Legacy styles end */ + + .center p { + text-align: center; + } + .center > img { + display: block; + height: 90%; + margin-top: 160px; + margin-left: auto; + margin-right: auto; + width: 90%; + } + + .break { + visibility: collapse; + } + + .supplemental.content > p { + font-size: 2em; + } + + /* Custom Slide Styles */ + + .lrbullets > ul > li:nth-of-type(odd) { + float: left; + width: 50%; + } + .lrbullets > ul > li:nth-of-type(even) { + } + + .limg > img, + .limg > p > img { + float: left; + width: 400px; + height: 50%; + } + .rimg > img, + .rimg > p > img { + float: right; + width: 50%; + height: 50%; + } + + .lbullets > ul { + float: left; + width: 50%; + } + .lbullets > ul > li { + float: left; + width: 50%; + } + .rbullets > ul { + float: right; + width: 50%; + } + .rbullets > ul > li { + float: right; + width: 50%; + } + + /* Legacy styles start - Print specific styles which are not hidden anymore? */ + .pagebreak { + display: none; + } + /* Legacy styles end */ + + /* Custom Layout */ + + img#staff { + float: right; + margin-right: 100px; + width: 240px; + height: 240px; + } +} + +@page { + margin: 0; + margin-top: 1em; + margin-left: 2em; + margin-right: 1em; + margin-bottom: 1em; +} + +@media print { + code { + font-size: 12px; + } + + li, td { + font-size: 14px; + } + + .slide, #preso { + font: normal 1.0em "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + height: 100%; + margin: 0; + margin-top: 0em; + margin-left: 0em; + margin-right: 0em; + margin-bottom: 0em; + width: 99%; + } + + a, a:visited { + color: #789CB1; + text-decoration: none; + } + + .content { + padding-top: 5px; + } + + .content h2 { + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 24px; + text-align: left; + margin-left: 0.5em; + margin-right: 3em; + } + + .content h3 { + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 20px; + text-align: left; + margin-left: 0.5em; + margin-right: 3em; + } + + .content h4 { + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 16px; + text-align: left; + margin-left: 0.5em; + margin-right: 3em; + } + + .content > p { + font-size: 16px; + text-align: left; + } + + /* Slide Styles */ + + .bullets > ul { + list-style: disc; + padding-left: 40px; + } + .smbullets > ul { + list-style: disc; + padding-left: 10px; + } + .bullets > ul > li, + .smbullets > ul > li { + text-align: left; + } + .bullets > ul > li > p, + .smbullets > ul > li > p { + margin: 0; + } + + .content > pre, .handouts > pre, .content > form > pre { + font-size: 120%; + margin: 0 2em; + } + .content > pre > code, .handouts > pre > code, .content > form > pre > code { + overflow: visible; + } + + .center p { + text-align: center; + } + + .center > img { + display: block; + height: 90%; + margin-left: auto; + margin-right: auto; + width: 90%; + } + + .content table tr td { + text-align: left; + } + + .annotations { + display: none; + } + + .pagebreak { + margin: 1em; + } + + .handouts { + display: block !important; + border: none; + } + .handouts h1, h2, h3, h4 { + margin: 0; + margin-top: 1em; + margin-left: 0.5em; + margin-right: 3em; + margin-bottom: 1em; + text-align: left; + } + .handouts hr { + margin: 2em 0; + } + .handouts p { + margin: 0 3em 1em 2em; + text-align: left; + word-wrap: break-word; + } + + .handouts > pre, .handouts > form > pre { + word-wrap: break-word; + } + + .handouts > ul { + list-style: disc; + padding-left: 40px; + } + + .supplemental { + right: 0.5em; + } + + .supplemental.content > p { + font-size: 14px; + } + + .supplemental .content > pre > code { + word-wrap: break-word; + } + + .supplemental h1 { + margin: 0; + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 22px; + text-align: left; + } + + .supplemental h2 { + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 20px; + text-align: left; + } + + .supplemental h3 { + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 18px; + text-align: left; + } + + .supplemental h4 { + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 16px; + text-align: left; + } + + div#toc a { + font-size: 14px; + margin-left: 2em; + } + + /* Custom Slide Styles */ + + .lrbullets > ul > li:nth-of-type(odd) { + float: left; + width: 50%; + } + .lrbullets > ul > li:nth-of-type(even) { + } + + /* Custom Layout */ + + .content.small table { + font: normal 1.5em "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + } +} diff --git a/global/layouts/osbconf.tpl b/global/layouts/osbconf.tpl new file mode 100644 index 0000000..0e951f2 --- /dev/null +++ b/global/layouts/osbconf.tpl @@ -0,0 +1,10 @@ +
+ OSBConf +
+ +~~~CONTENT~~~ + + diff --git a/global/layouts/osdc.css b/global/layouts/osdc.css new file mode 100644 index 0000000..62fab6e --- /dev/null +++ b/global/layouts/osdc.css @@ -0,0 +1,671 @@ +/************************************************* + Corrections for strange CSS rules by showoff + ************************************************/ + +.code { + white-space: unset; +} +.content.code p { + font-family: monospace; + white-space: pre; +} + +.content.center { + position: unset; + top: unset; + -webkit-transform: unset; + -ms-transform: unset; + transform: unset; +} + +@media screen { + /* The following assumes we'd get 24px (1.5em) by default: 24 / (16 x 0.8 x 0.8) */ + .slide.small .content.small .net-header, + .slide.small .content.small .net-footer { + font-size: 234.375%; + } + + /* The following assumes we'd get 24px (1.5em) by default: 24 / (16 x 0.7 x 0.7) */ + .slide.smaller .content.smaller .net-header, + .slide.smaller .content.smaller .net-footer { + font-size: 306.122449%; + } + + /* The following assumes the same as above, but is for non-container elements */ + .slide.small .content.small .net-header + h1:not(.section-title) { + font-size: 3.515625em; + } + .slide.smaller .content.smaller .net-header + h1:not(.section-title) { + font-size: 4.591836735em; + } +} + +@media print { + /* The following assumes we'd get 16px (1em) by default: 16 / (16 x 0.8) */ + .content.small .net-header, + .content.small .net-footer { + font-size: 125%; + } + + /* The following assumes we'd get 16px (1em) by default: 16 / (16 x 0.7) */ + .content.smaller .net-header, + .content.smaller .net-footer { + font-size: 142.8571429%; + } + + /* The following assumes the same as above, but is for non-container elements */ + .content.small .net-header + h1:not(.section-title) { + font-size: 1.875em; + } + .content.smaller .net-header + h1:not(.section-title) { + font-size: 2.142857144em; + } +} + +/************************************************* + Layout + + !!!!!!!!!!!!!!!!!!!! + Please pay attention that all layout styles do not + depend on any raw pixel sizes. Hence when adjusting + anything, please use percent or em as size unit. + And adjust dependent elements, paddings, margins + accordingly. Thank you! + !!!!!!!!!!!!!!!!!!!! + + ************************************************/ + +.net-header img { + margin-right: 0; +} + +.content .net-header + h1:not(.section-title) { + line-height: 100%; + font-size: 1.5em; + padding: .1em .25em; + border-bottom: none; +} + +.content.subsection .net-header + h1:not(.section-title), +.content.subsectionnonum .net-header + h1:not(.section-title) { + display: inline-block; + margin-top: 3em; + font-size: 2em; +} + +.center .net-header + h1 { + text-align: left; +} + +@media screen { + .slide:not(.small):not(.smaller) { + font-size: 1.5em; /* Already done by showoff, but in case they'll change it in the future.. */ + } + + .net-header { + height: 4.104166667em; + padding-bottom: .0625em; + } + + .subsection .net-header, + .subsectionnonum .net-header, + #pre_osdc_title_00_title1 .net-header, + #global_pre_osdc_title_00_title1 .net-header { + border-bottom: .0625em solid black; + padding-bottom: 0; + } + + .net-header img { + /* Solves that the image overlays the header's border. + #preso's transformation still produces artifacts, though.. */ + margin-top: -.0625em; + /* Yep, applied on every slide. Otherwise we'll get flickering when switching slides */ + } + + .content .net-header + h1:not(.section-title) { + margin: 0; + color: white; + background: #27A737; + } + + .net-footer { + position: absolute; + bottom: 0; + width: 100%; + color: white; + background: #27A737; + } + + .net-footer * { + font-size: 62.5%; + } + + .net-footer :first-child { + display: inline-block; + margin: .5em 1em; + } + + .net-footer :last-child { + float: right; + margin: .5em 1em; + } +} + +@media print { + .slide:not(.small):not(.smaller) { + font-size: 1em; /* Already done by showoff, but in case they'll change it in the future.. */ + } + + .net-header { + height: 6.1875em; + border-bottom: .0625em solid black; + } + + .net-header img { + height: 99%; /* The negative margin workaround does not work with wkhtmltopdf.. */ + } + + #pre_osdc_title_00_title1 .net-header, + #global_pre_osdc_title_00_title1 .net-header { + display: none; + } + + .content:not(.subsection):not(.subsectionnonum) .net-header + h1:not(.section-title) { + margin: .3em 0; + } + + .subsection .net-header + h1:not(.section-title), + .subsectionnonum .net-header + h1:not(.section-title) { + white-space: nowrap; /* TODO: Why?? Only wkhtmltopdf requires this.. */ + color: white; + background: #27A737; + } + + .net-footer { + display: none; + } +} + +/************************************************* + Global styles + ************************************************/ + +@media screen { + .title-name { + overflow: auto; + } + + .title-name p { + float: right; + margin: 1em 0; + padding: .25em; + font-size: 2.5em; + color: white; + background: black; + } + + .title-subtitle { + overflow: auto; + } + + .title-subtitle p { + float: right; + margin: 1em 0; + padding: .25em; + font-size: 1.5em; + color: black; + background: #27A737; + } + + .title-author p { + font-size: 1.35em; + } +} + +@media print { + .title-logo { + margin: 1em; + } + + .title-logo img { + margin: 0 auto; + } + + .title-cover { + margin: 0.5em; + margin-top: 4em; + padding: 1em; + height: 30em; + color: white; + background: #27A737; + } + + .title-name { + font-size: 2em; + } + + .title-release { + margin-top: 2em; + } + + .title-footer { + margin-top: 23.5em; + text-align: right; + font-weight: bold; + } +} + +/************************************************* + Slide styles + ************************************************/ + +@media screen { + /** + Please note: + 4.166666667em = Header height + 1.8em = h1 height + 1.354166667em = Footer height + 24.679166666em = Content height + 32em = Total slide height + **/ + .content > .margin-top-1-8 { margin-top: 3.084895833em; } + .content > .margin-top-1-7 { margin-top: 3.525595238em; } + .content > .margin-top-1-6 { margin-top: 4.113194444em; } + .content > .margin-top-1-5 { margin-top: 4.935833333em; } + .content > .margin-top-1-4 { margin-top: 6.169791666em; } + .content > .margin-top-1-3 { margin-top: 8.226388889em; } + .content > .margin-top-1-2 { margin-top: 12.339583333em; } + + /* Since bigtext does not work with our layout.. */ + .content > .large { font-size: 120%; } + .content > .larger { font-size: 140%; } + .content > .even-larger { font-size: 180%; } + .content > .big { font-size: 150%; } + .content > .bigger { font-size: 300%; } + .content > .probably-too-big { font-size: 600%; } +} + +@media print { + /** + Please note: + 6.25em = Header height + 2.7em = h1 height + 2.03125em = Footer height + 38.81875em = Content height + 49.8em = Total slide height + **/ + .content > .margin-top-1-8 { margin-top: 4.85234375em; } + .content > .margin-top-1-7 { margin-top: 5.545535714em; } + .content > .margin-top-1-6 { margin-top: 6.469791667em; } + .content > .margin-top-1-5 { margin-top: 7.76375em; } + .content > .margin-top-1-4 { margin-top: 9.7046875em; } + .content > .margin-top-1-3 { margin-top: 12.939583333em; } + .content > .margin-top-1-2 { margin-top: 19.409375em; } + + /* Since bigtext does not work with our layout.. */ + .content > .large { font-size: 180%; } + .content > .larger { font-size: 210%; } + .content > .even-larger { font-size: 270%; } + .content > .big { font-size: 225%; } + .content > .bigger { font-size: 450%; } + .content > .probably-too-big { font-size: 900%; } +} + +/************************************************* + Legacy styles + ************************************************/ + +@media screen { + /* Global */ + + .slide, #preso { + height: 768px; + width: 1024px; + } + + a, a:visited { + color: #27A737; + text-decoration: none; + } + + .content h2 { + font-size: 24px; + margin-left: 1em; + text-align: left; + } + + .content h3 { + font-size: 20px; + margin-left: 1em; + text-align: left; + } + + .content h4 { + font-size: 16px; + margin-left: 1em; + text-align: left; + } + + .content > p, + .content > form > p { + text-align: left; + } + + .content p > img { + max-width: 100%; + } + + /* Slide Styles */ + + .bullets > ul { + font-size: 1.5em; + list-style: disc; + } + .smbullets > ul { + list-style: disc; + } + .bullets > ul > li, + .smbullets > ul > li { + text-align: left; + } + .bullets > ul > li > p, + .smbullets > ul > li > p { + margin: 0; + } + + /* Legacy styles start - For backward compliance with slides created using showoff v0.9.11.1 */ + .slide.small > .content.small > p, + .slide.small > .content.small > ul, + .slide.small > .content.small > pre, + .slide.small > .content.small > table { + font-size: 2em; + } + + .slide.small > .content.smbullets.small > ul > li { + margin: 0; + } + /* Legacy styles end */ + + .center p { + text-align: center; + } + .center > img { + display: block; + height: 90%; + margin-top: 160px; + margin-left: auto; + margin-right: auto; + width: 90%; + } + + .break { + visibility: collapse; + } + + .supplemental.content > p { + font-size: 2em; + } + + /* Custom Slide Styles */ + + .lrbullets > ul > li:nth-of-type(odd) { + float: left; + width: 50%; + } + .lrbullets > ul > li:nth-of-type(even) { + } + + .limg > img, + .limg > p > img { + float: left; + width: 400px; + height: 50%; + } + .rimg > img, + .rimg > p > img { + float: right; + width: 50%; + height: 50%; + } + + .lbullets > ul { + float: left; + width: 50%; + } + .lbullets > ul > li { + float: left; + width: 50%; + } + .rbullets > ul { + float: right; + width: 50%; + } + .rbullets > ul > li { + float: right; + width: 50%; + } + + /* Legacy styles start - Print specific styles which are not hidden anymore? */ + .pagebreak { + display: none; + } + /* Legacy styles end */ + + /* Custom Layout */ + + img#staff { + float: right; + margin-right: 100px; + width: 240px; + height: 240px; + } +} + +@page { + margin: 0; + margin-top: 1em; + margin-left: 2em; + margin-right: 1em; + margin-bottom: 1em; +} + +@media print { + code { + font-size: 12px; + } + + li, td { + font-size: 14px; + } + + .slide, #preso { + font: normal 1.0em "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + height: 100%; + margin: 0; + margin-top: 0em; + margin-left: 0em; + margin-right: 0em; + margin-bottom: 0em; + width: 99%; + } + + a, a:visited { + color: #27A737; + text-decoration: none; + } + + .content { + padding-top: 5px; + } + + .content h2 { + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 24px; + text-align: left; + margin-left: 0.5em; + margin-right: 3em; + } + + .content h3 { + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 20px; + text-align: left; + margin-left: 0.5em; + margin-right: 3em; + } + + .content h4 { + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 16px; + text-align: left; + margin-left: 0.5em; + margin-right: 3em; + } + + .content > p { + font-size: 16px; + text-align: left; + } + + /* Slide Styles */ + + .bullets > ul { + list-style: disc; + padding-left: 40px; + } + .smbullets > ul { + list-style: disc; + padding-left: 10px; + } + .bullets > ul > li, + .smbullets > ul > li { + text-align: left; + } + .bullets > ul > li > p, + .smbullets > ul > li > p { + margin: 0; + } + + .content > pre, .handouts > pre, .content > form > pre { + font-size: 120%; + margin: 0 2em; + } + .content > pre > code, .handouts > pre > code, .content > form > pre > code { + overflow: visible; + } + + .center p { + text-align: center; + } + + .center > img { + display: block; + height: 90%; + margin-left: auto; + margin-right: auto; + width: 90%; + } + + .content table tr td { + text-align: left; + } + + .annotations { + display: none; + } + + .pagebreak { + margin: 1em; + } + + .handouts { + display: block !important; + border: none; + } + .handouts h1, h2, h3, h4 { + margin: 0; + margin-top: 1em; + margin-left: 0.5em; + margin-right: 3em; + margin-bottom: 1em; + text-align: left; + } + .handouts hr { + margin: 2em 0; + } + .handouts p { + margin: 0 3em 1em 2em; + text-align: left; + word-wrap: break-word; + } + + .handouts > pre, .handouts > form > pre { + word-wrap: break-word; + } + + .handouts > ul { + list-style: disc; + padding-left: 40px; + } + + .supplemental { + right: 0.5em; + } + + .supplemental.content > p { + font-size: 14px; + } + + .supplemental .content > pre > code { + word-wrap: break-word; + } + + .supplemental h1 { + margin: 0; + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 22px; + text-align: left; + } + + .supplemental h2 { + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 20px; + text-align: left; + } + + .supplemental h3 { + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 18px; + text-align: left; + } + + .supplemental h4 { + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 16px; + text-align: left; + } + + div#toc a { + font-size: 14px; + margin-left: 2em; + } + + /* Custom Slide Styles */ + + .lrbullets > ul > li:nth-of-type(odd) { + float: left; + width: 50%; + } + .lrbullets > ul > li:nth-of-type(even) { + } + + /* Custom Layout */ + + .content.small table { + font: normal 1.5em "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + } +} diff --git a/global/layouts/osdc.tpl b/global/layouts/osdc.tpl new file mode 100644 index 0000000..ef581be --- /dev/null +++ b/global/layouts/osdc.tpl @@ -0,0 +1,10 @@ +
+ OSDC +
+ +~~~CONTENT~~~ + + diff --git a/global/layouts/osmc.css b/global/layouts/osmc.css new file mode 100644 index 0000000..dcbe717 --- /dev/null +++ b/global/layouts/osmc.css @@ -0,0 +1,671 @@ +/************************************************* + Corrections for strange CSS rules by showoff + ************************************************/ + +.code { + white-space: unset; +} +.content.code p { + font-family: monospace; + white-space: pre; +} + +.content.center { + position: unset; + top: unset; + -webkit-transform: unset; + -ms-transform: unset; + transform: unset; +} + +@media screen { + /* The following assumes we'd get 24px (1.5em) by default: 24 / (16 x 0.8 x 0.8) */ + .slide.small .content.small .net-header, + .slide.small .content.small .net-footer { + font-size: 234.375%; + } + + /* The following assumes we'd get 24px (1.5em) by default: 24 / (16 x 0.7 x 0.7) */ + .slide.smaller .content.smaller .net-header, + .slide.smaller .content.smaller .net-footer { + font-size: 306.122449%; + } + + /* The following assumes the same as above, but is for non-container elements */ + .slide.small .content.small .net-header + h1:not(.section-title) { + font-size: 3.515625em; + } + .slide.smaller .content.smaller .net-header + h1:not(.section-title) { + font-size: 4.591836735em; + } +} + +@media print { + /* The following assumes we'd get 16px (1em) by default: 16 / (16 x 0.8) */ + .content.small .net-header, + .content.small .net-footer { + font-size: 125%; + } + + /* The following assumes we'd get 16px (1em) by default: 16 / (16 x 0.7) */ + .content.smaller .net-header, + .content.smaller .net-footer { + font-size: 142.8571429%; + } + + /* The following assumes the same as above, but is for non-container elements */ + .content.small .net-header + h1:not(.section-title) { + font-size: 1.875em; + } + .content.smaller .net-header + h1:not(.section-title) { + font-size: 2.142857144em; + } +} + +/************************************************* + Layout + + !!!!!!!!!!!!!!!!!!!! + Please pay attention that all layout styles do not + depend on any raw pixel sizes. Hence when adjusting + anything, please use percent or em as size unit. + And adjust dependent elements, paddings, margins + accordingly. Thank you! + !!!!!!!!!!!!!!!!!!!! + + ************************************************/ + +.net-header img { + margin-right: 0; +} + +.content .net-header + h1:not(.section-title) { + line-height: 100%; + font-size: 1.5em; + padding: .1em .25em; + border-bottom: none; +} + +.content.subsection .net-header + h1:not(.section-title), +.content.subsectionnonum .net-header + h1:not(.section-title) { + display: inline-block; + margin-top: 3em; + font-size: 2em; +} + +.center .net-header + h1 { + text-align: left; +} + +@media screen { + .slide:not(.small):not(.smaller) { + font-size: 1.5em; /* Already done by showoff, but in case they'll change it in the future.. */ + } + + .net-header { + height: 4.104166667em; + padding-bottom: .0625em; + } + + .subsection .net-header, + .subsectionnonum .net-header, + #pre_osmc_title_00_title1 .net-header, + #global_pre_osmc_title_00_title1 .net-header { + border-bottom: .0625em solid black; + padding-bottom: 0; + } + + .net-header img { + /* Solves that the image overlays the header's border. + #preso's transformation still produces artifacts, though.. */ + margin-top: -.0625em; + /* Yep, applied on every slide. Otherwise we'll get flickering when switching slides */ + } + + .content .net-header + h1:not(.section-title) { + margin: 0; + color: white; + background: #183047; + } + + .net-footer { + position: absolute; + bottom: 0; + width: 100%; + color: white; + background: #183047; + } + + .net-footer * { + font-size: 62.5%; + } + + .net-footer :first-child { + display: inline-block; + margin: .5em 1em; + } + + .net-footer :last-child { + float: right; + margin: .5em 1em; + } +} + +@media print { + .slide:not(.small):not(.smaller) { + font-size: 1em; /* Already done by showoff, but in case they'll change it in the future.. */ + } + + .net-header { + height: 6.1875em; + border-bottom: .0625em solid black; + } + + .net-header img { + height: 99%; /* The negative margin workaround does not work with wkhtmltopdf.. */ + } + + #pre_osmc_title_00_title1 .net-header, + #global_pre_osmc_title_00_title1 .net-header { + display: none; + } + + .content:not(.subsection):not(.subsectionnonum) .net-header + h1:not(.section-title) { + margin: .3em 0; + } + + .subsection .net-header + h1:not(.section-title), + .subsectionnonum .net-header + h1:not(.section-title) { + white-space: nowrap; /* TODO: Why?? Only wkhtmltopdf requires this.. */ + color: white; + background: #183047; + } + + .net-footer { + display: none; + } +} + +/************************************************* + Global styles + ************************************************/ + +@media screen { + .title-name { + overflow: auto; + } + + .title-name p { + float: right; + margin: 1em 0; + padding: .25em; + font-size: 2.5em; + color: white; + background: black; + } + + .title-subtitle { + overflow: auto; + } + + .title-subtitle p { + float: right; + margin: 1em 0; + padding: .25em; + font-size: 1.5em; + color: black; + background: #183047; + } + + .title-author p { + font-size: 1.35em; + } +} + +@media print { + .title-logo { + margin: 1em; + } + + .title-logo img { + margin: 0 auto; + } + + .title-cover { + margin: 0.5em; + margin-top: 4em; + padding: 1em; + height: 30em; + color: white; + background: #183047; + } + + .title-name { + font-size: 2em; + } + + .title-release { + margin-top: 2em; + } + + .title-footer { + margin-top: 23.5em; + text-align: right; + font-weight: bold; + } +} + +/************************************************* + Slide styles + ************************************************/ + +@media screen { + /** + Please note: + 4.166666667em = Header height + 1.8em = h1 height + 1.354166667em = Footer height + 24.679166666em = Content height + 32em = Total slide height + **/ + .content > .margin-top-1-8 { margin-top: 3.084895833em; } + .content > .margin-top-1-7 { margin-top: 3.525595238em; } + .content > .margin-top-1-6 { margin-top: 4.113194444em; } + .content > .margin-top-1-5 { margin-top: 4.935833333em; } + .content > .margin-top-1-4 { margin-top: 6.169791666em; } + .content > .margin-top-1-3 { margin-top: 8.226388889em; } + .content > .margin-top-1-2 { margin-top: 12.339583333em; } + + /* Since bigtext does not work with our layout.. */ + .content > .large { font-size: 120%; } + .content > .larger { font-size: 140%; } + .content > .even-larger { font-size: 180%; } + .content > .big { font-size: 150%; } + .content > .bigger { font-size: 300%; } + .content > .probably-too-big { font-size: 600%; } +} + +@media print { + /** + Please note: + 6.25em = Header height + 2.7em = h1 height + 2.03125em = Footer height + 38.81875em = Content height + 49.8em = Total slide height + **/ + .content > .margin-top-1-8 { margin-top: 4.85234375em; } + .content > .margin-top-1-7 { margin-top: 5.545535714em; } + .content > .margin-top-1-6 { margin-top: 6.469791667em; } + .content > .margin-top-1-5 { margin-top: 7.76375em; } + .content > .margin-top-1-4 { margin-top: 9.7046875em; } + .content > .margin-top-1-3 { margin-top: 12.939583333em; } + .content > .margin-top-1-2 { margin-top: 19.409375em; } + + /* Since bigtext does not work with our layout.. */ + .content > .large { font-size: 180%; } + .content > .larger { font-size: 210%; } + .content > .even-larger { font-size: 270%; } + .content > .big { font-size: 225%; } + .content > .bigger { font-size: 450%; } + .content > .probably-too-big { font-size: 900%; } +} + +/************************************************* + Legacy styles + ************************************************/ + +@media screen { + /* Global */ + + .slide, #preso { + height: 768px; + width: 1024px; + } + + a, a:visited { + color: #183047; + text-decoration: none; + } + + .content h2 { + font-size: 24px; + margin-left: 1em; + text-align: left; + } + + .content h3 { + font-size: 20px; + margin-left: 1em; + text-align: left; + } + + .content h4 { + font-size: 16px; + margin-left: 1em; + text-align: left; + } + + .content > p, + .content > form > p { + text-align: left; + } + + .content p > img { + max-width: 100%; + } + + /* Slide Styles */ + + .bullets > ul { + font-size: 1.5em; + list-style: disc; + } + .smbullets > ul { + list-style: disc; + } + .bullets > ul > li, + .smbullets > ul > li { + text-align: left; + } + .bullets > ul > li > p, + .smbullets > ul > li > p { + margin: 0; + } + + /* Legacy styles start - For backward compliance with slides created using showoff v0.9.11.1 */ + .slide.small > .content.small > p, + .slide.small > .content.small > ul, + .slide.small > .content.small > pre, + .slide.small > .content.small > table { + font-size: 2em; + } + + .slide.small > .content.smbullets.small > ul > li { + margin: 0; + } + /* Legacy styles end */ + + .center p { + text-align: center; + } + .center > img { + display: block; + height: 90%; + margin-top: 160px; + margin-left: auto; + margin-right: auto; + width: 90%; + } + + .break { + visibility: collapse; + } + + .supplemental.content > p { + font-size: 2em; + } + + /* Custom Slide Styles */ + + .lrbullets > ul > li:nth-of-type(odd) { + float: left; + width: 50%; + } + .lrbullets > ul > li:nth-of-type(even) { + } + + .limg > img, + .limg > p > img { + float: left; + width: 400px; + height: 50%; + } + .rimg > img, + .rimg > p > img { + float: right; + width: 50%; + height: 50%; + } + + .lbullets > ul { + float: left; + width: 50%; + } + .lbullets > ul > li { + float: left; + width: 50%; + } + .rbullets > ul { + float: right; + width: 50%; + } + .rbullets > ul > li { + float: right; + width: 50%; + } + + /* Legacy styles start - Print specific styles which are not hidden anymore? */ + .pagebreak { + display: none; + } + /* Legacy styles end */ + + /* Custom Layout */ + + img#staff { + float: right; + margin-right: 100px; + width: 240px; + height: 240px; + } +} + +@page { + margin: 0; + margin-top: 1em; + margin-left: 2em; + margin-right: 1em; + margin-bottom: 1em; +} + +@media print { + code { + font-size: 12px; + } + + li, td { + font-size: 14px; + } + + .slide, #preso { + font: normal 1.0em "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + height: 100%; + margin: 0; + margin-top: 0em; + margin-left: 0em; + margin-right: 0em; + margin-bottom: 0em; + width: 99%; + } + + a, a:visited { + color: #183047; + text-decoration: none; + } + + .content { + padding-top: 5px; + } + + .content h2 { + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 24px; + text-align: left; + margin-left: 0.5em; + margin-right: 3em; + } + + .content h3 { + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 20px; + text-align: left; + margin-left: 0.5em; + margin-right: 3em; + } + + .content h4 { + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 16px; + text-align: left; + margin-left: 0.5em; + margin-right: 3em; + } + + .content > p { + font-size: 16px; + text-align: left; + } + + /* Slide Styles */ + + .bullets > ul { + list-style: disc; + padding-left: 40px; + } + .smbullets > ul { + list-style: disc; + padding-left: 10px; + } + .bullets > ul > li, + .smbullets > ul > li { + text-align: left; + } + .bullets > ul > li > p, + .smbullets > ul > li > p { + margin: 0; + } + + .content > pre, .handouts > pre, .content > form > pre { + font-size: 120%; + margin: 0 2em; + } + .content > pre > code, .handouts > pre > code, .content > form > pre > code { + overflow: visible; + } + + .center p { + text-align: center; + } + + .center > img { + display: block; + height: 90%; + margin-left: auto; + margin-right: auto; + width: 90%; + } + + .content table tr td { + text-align: left; + } + + .annotations { + display: none; + } + + .pagebreak { + margin: 1em; + } + + .handouts { + display: block !important; + border: none; + } + .handouts h1, h2, h3, h4 { + margin: 0; + margin-top: 1em; + margin-left: 0.5em; + margin-right: 3em; + margin-bottom: 1em; + text-align: left; + } + .handouts hr { + margin: 2em 0; + } + .handouts p { + margin: 0 3em 1em 2em; + text-align: left; + word-wrap: break-word; + } + + .handouts > pre, .handouts > form > pre { + word-wrap: break-word; + } + + .handouts > ul { + list-style: disc; + padding-left: 40px; + } + + .supplemental { + right: 0.5em; + } + + .supplemental.content > p { + font-size: 14px; + } + + .supplemental .content > pre > code { + word-wrap: break-word; + } + + .supplemental h1 { + margin: 0; + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 22px; + text-align: left; + } + + .supplemental h2 { + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 20px; + text-align: left; + } + + .supplemental h3 { + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 18px; + text-align: left; + } + + .supplemental h4 { + color: black; + font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + font-size: 16px; + text-align: left; + } + + div#toc a { + font-size: 14px; + margin-left: 2em; + } + + /* Custom Slide Styles */ + + .lrbullets > ul > li:nth-of-type(odd) { + float: left; + width: 50%; + } + .lrbullets > ul > li:nth-of-type(even) { + } + + /* Custom Layout */ + + .content.small table { + font: normal 1.5em "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; + } +} diff --git a/global/layouts/osmc.tpl b/global/layouts/osmc.tpl new file mode 100644 index 0000000..b36276f --- /dev/null +++ b/global/layouts/osmc.tpl @@ -0,0 +1,10 @@ +
+ OSMC +
+ +~~~CONTENT~~~ + + diff --git a/global/netways.css b/global/netways.css deleted file mode 100644 index 34b071d..0000000 --- a/global/netways.css +++ /dev/null @@ -1,677 +0,0 @@ -/************************************************* - Corrections for strange CSS rules by showoff - ************************************************/ - -.code { - white-space: unset; -} -.content.code p { - font-family: monospace; - white-space: pre; -} - -.content.center { - position: unset; - top: unset; - -webkit-transform: unset; - -ms-transform: unset; - transform: unset; -} - -@media screen { - /* The following assumes we'd get 24px (1.5em) by default: 24 / (16 x 0.8 x 0.8) */ - .slide.small .content.small .net-header, - .slide.small .content.small .net-footer { - font-size: 234.375%; - } - - /* The following assumes we'd get 24px (1.5em) by default: 24 / (16 x 0.7 x 0.7) */ - .slide.smaller .content.smaller .net-header, - .slide.smaller .content.smaller .net-footer { - font-size: 306.122449%; - } - - /* The following assumes the same as above, but is for non-container elements */ - .slide.small .content.small .net-header + h1:not(.section-title) { - font-size: 3.515625em; - } - .slide.smaller .content.smaller .net-header + h1:not(.section-title) { - font-size: 4.591836735em; - } -} - -@media print { - /* The following assumes we'd get 16px (1em) by default: 16 / (16 x 0.8) */ - .content.small .net-header, - .content.small .net-footer { - font-size: 125%; - } - - /* The following assumes we'd get 16px (1em) by default: 16 / (16 x 0.7) */ - .content.smaller .net-header, - .content.smaller .net-footer { - font-size: 142.8571429%; - } - - /* The following assumes the same as above, but is for non-container elements */ - .content.small .net-header + h1:not(.section-title) { - font-size: 1.875em; - } - .content.smaller .net-header + h1:not(.section-title) { - font-size: 2.142857144em; - } -} - -/************************************************* - Layout - - !!!!!!!!!!!!!!!!!!!! - Please pay attention that all layout styles do not - depend on any raw pixel sizes. Hence when adjusting - anything, please use percent or em as size unit. - And adjust dependent elements, paddings, margins - accordingly. Thank you! - !!!!!!!!!!!!!!!!!!!! - - ************************************************/ - -.net-header img { - margin-right: 0; -} - -.content .net-header + h1:not(.section-title) { - line-height: 100%; - font-size: 1.5em; - padding: .1em .25em; - border-bottom: none; -} - -.content.subsection .net-header + h1:not(.section-title), -.content.subsectionnonum .net-header + h1:not(.section-title) { - display: inline-block; - margin-top: 3em; - font-size: 2em; -} - -.center .net-header + h1 { - text-align: left; -} - -@media screen { - .slide:not(.small):not(.smaller) { - font-size: 1.5em; /* Already done by showoff, but in case they'll change it in the future.. */ - } - - .net-header { - height: 4.104166667em; - padding-bottom: .0625em; - } - - .subsection .net-header, - .subsectionnonum .net-header, - #Pre_Title_01_Title1 .net-header, - #global_Pre_Title_01_Title1 .net-header { - border-bottom: .0625em solid black; - padding-bottom: 0; - } - - .net-header img { - /* Solves that the image overlays the header's border. - #preso's transformation still produces artifacts, though.. */ - margin-top: -.0625em; - /* Yep, applied on every slide. Otherwise we'll get flickering when switching slides */ - } - - .content .net-header + h1:not(.section-title) { - margin: 0; - color: white; - background: #FA5C0D; - } - - .net-footer { - position: absolute; - bottom: 0; - width: 100%; - color: white; - background: #FA5C0D; - } - - .net-footer * { - font-size: 62.5%; - } - - .net-footer :first-child { - display: inline-block; - margin: .5em 1em; - } - - .net-footer :last-child { - float: right; - margin: .5em 1em; - } -} - -@media print { - .slide:not(.small):not(.smaller) { - font-size: 1em; /* Already done by showoff, but in case they'll change it in the future.. */ - } - - .net-header { - height: 6.1875em; - border-bottom: .0625em solid black; - } - - .net-header img { - height: 99%; /* The negative margin workaround does not work with wkhtmltopdf.. */ - } - - #Pre_Title_01_Title1 .net-header, - #global_Pre_Title_01_Title1 .net-header { - display: none; - } - - .content:not(.subsection):not(.subsectionnonum) .net-header + h1:not(.section-title) { - margin: .3em 0; - } - - .subsection .net-header + h1:not(.section-title), - .subsectionnonum .net-header + h1:not(.section-title) { - white-space: nowrap; /* TODO: Why?? Only wkhtmltopdf requires this.. */ - color: white; - background: #FA5C0D; - } - - .net-footer { - display: none; - } -} - -/************************************************* - Global styles - ************************************************/ - -@media screen { - .title-name { - overflow: auto; - } - - .title-name p { - float: right; - margin: 1em 0; - padding: .25em; - font-size: 2.5em; - color: white; - background: black; - } - - .title-location { - overflow: auto; - } - - .title-location p { - float: right; - margin: 1em 0; - padding: .25em; - font-size: 1.5em; - color: black; - background: #FA5C0D; - } - - .title-author p { - font-size: 1.35em; - } -} - -@media print { - .title-logo { - margin: 1em; - } - - .title-logo img { - margin: 0 auto; - } - - .title-cover { - margin: 0.5em; - margin-top: 4em; - padding: 1em; - height: 30em; - color: white; - background: #FA5C0D; - } - - .title-name { - font-size: 2em; - } - - .title-subtitle { - font-size: 1.5em; - } - - .title-release { - margin-top: 2em; - } - - .title-footer { - margin-top: 19.5em; - margin-right: 1em; - text-align: right; - font-weight: bold; - } -} - -/************************************************* - Slide styles - ************************************************/ - -@media screen { - /** - Please note: - 4.166666667em = Header height - 1.8em = h1 height - 1.354166667em = Footer height - 24.679166666em = Content height - 32em = Total slide height - **/ - .content > .margin-top-1-8 { margin-top: 3.084895833em; } - .content > .margin-top-1-7 { margin-top: 3.525595238em; } - .content > .margin-top-1-6 { margin-top: 4.113194444em; } - .content > .margin-top-1-5 { margin-top: 4.935833333em; } - .content > .margin-top-1-4 { margin-top: 6.169791666em; } - .content > .margin-top-1-3 { margin-top: 8.226388889em; } - .content > .margin-top-1-2 { margin-top: 12.339583333em; } - - /* Since bigtext does not work with our layout.. */ - .content > .large { font-size: 120%; } - .content > .larger { font-size: 140%; } - .content > .even-larger { font-size: 180%; } - .content > .big { font-size: 150%; } - .content > .bigger { font-size: 300%; } - .content > .probably-too-big { font-size: 600%; } -} - -@media print { - /** - Please note: - 6.25em = Header height - 2.7em = h1 height - 2.03125em = Footer height - 38.81875em = Content height - 49.8em = Total slide height - **/ - .content > .margin-top-1-8 { margin-top: 4.85234375em; } - .content > .margin-top-1-7 { margin-top: 5.545535714em; } - .content > .margin-top-1-6 { margin-top: 6.469791667em; } - .content > .margin-top-1-5 { margin-top: 7.76375em; } - .content > .margin-top-1-4 { margin-top: 9.7046875em; } - .content > .margin-top-1-3 { margin-top: 12.939583333em; } - .content > .margin-top-1-2 { margin-top: 19.409375em; } - - /* Since bigtext does not work with our layout.. */ - .content > .large { font-size: 180%; } - .content > .larger { font-size: 210%; } - .content > .even-larger { font-size: 270%; } - .content > .big { font-size: 225%; } - .content > .bigger { font-size: 450%; } - .content > .probably-too-big { font-size: 900%; } -} - -/************************************************* - Legacy styles - ************************************************/ - -@media screen { - /* Global */ - - .slide, #preso { - height: 768px; - width: 1024px; - } - - a, a:visited { - color: #FA5C0D; - text-decoration: none; - } - - .content h2 { - font-size: 24px; - margin-left: 1em; - text-align: left; - } - - .content h3 { - font-size: 20px; - margin-left: 1em; - text-align: left; - } - - .content h4 { - font-size: 16px; - margin-left: 1em; - text-align: left; - } - - .content > p, - .content > form > p { - text-align: left; - } - - .content p > img { - max-width: 100%; - } - - /* Slide Styles */ - - .bullets > ul { - font-size: 1.5em; - list-style: disc; - } - .smbullets > ul { - list-style: disc; - } - .bullets > ul > li, - .smbullets > ul > li { - text-align: left; - } - .bullets > ul > li > p, - .smbullets > ul > li > p { - margin: 0; - } - - /* Legacy styles start - For backward compliance with slides created using showoff v0.9.11.1 */ - .slide.small > .content.small > p, - .slide.small > .content.small > ul, - .slide.small > .content.small > pre, - .slide.small > .content.small > table { - font-size: 2em; - } - - .slide.small > .content.smbullets.small > ul > li { - margin: 0; - } - /* Legacy styles end */ - - .center p { - text-align: center; - } - .center > img { - display: block; - height: 90%; - margin-top: 160px; - margin-left: auto; - margin-right: auto; - width: 90%; - } - - .break { - visibility: collapse; - } - - .supplemental.content > p { - font-size: 2em; - } - - /* Custom Slide Styles */ - - .lrbullets > ul > li:nth-of-type(odd) { - float: left; - width: 50%; - } - .lrbullets > ul > li:nth-of-type(even) { - } - - .limg > img, - .limg > p > img { - float: left; - width: 400px; - height: 50%; - } - .rimg > img, - .rimg > p > img { - float: right; - width: 50%; - height: 50%; - } - - .lbullets > ul { - float: left; - width: 50%; - } - .lbullets > ul > li { - float: left; - width: 50%; - } - .rbullets > ul { - float: right; - width: 50%; - } - .rbullets > ul > li { - float: right; - width: 50%; - } - - /* Legacy styles start - Print specific styles which are not hidden anymore? */ - .pagebreak { - display: none; - } - /* Legacy styles end */ - - /* Custom Layout */ - - img#staff { - float: right; - margin-right: 100px; - width: 240px; - height: 240px; - } -} - -@page { - margin: 0; - margin-top: 1em; - margin-left: 2em; - margin-right: 1em; - margin-bottom: 1em; -} - -@media print { - code { - font-size: 12px; - margin-left: 0em; - } - - li, td { - font-size: 14px; - } - - .slide, #preso { - font: normal 1.0em "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; - height: 100%; - margin: 0; - margin-top: 0em; - margin-left: 0em; - margin-right: 0em; - margin-bottom: 0em; - width: 99%; - } - - a, a:visited { - color: #FA5C0D; - text-decoration: none; - } - - .content { - padding-top: 5px; - } - - .content h2 { - font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; - font-size: 24px; - text-align: left; - margin-left: 0.5em; - margin-right: 3em; - } - - .content h3 { - font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; - font-size: 20px; - text-align: left; - margin-left: 0.5em; - margin-right: 3em; - } - - .content h4 { - font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; - font-size: 16px; - text-align: left; - margin-left: 0.5em; - margin-right: 3em; - } - - .content > p { - font-size: 16px; - text-align: left; - } - - /* Slide Styles */ - - .bullets > ul { - list-style: disc; - padding-left: 40px; - } - .smbullets > ul { - list-style: disc; - padding-left: 10px; - } - .bullets > ul > li, - .smbullets > ul > li { - text-align: left; - } - .bullets > ul > li > p, - .smbullets > ul > li > p { - margin: 0; - } - - .content > pre, .handouts > pre, .content > form > pre { - font-size: 120%; - margin: 0 2em; - } - .content > pre > code, .handouts > pre > code, .content > form > pre > code { - overflow: visible; - } - - .center p { - text-align: center; - } - - .center > img { - display: block; - height: 90%; - margin-left: auto; - margin-right: auto; - width: 90%; - } - - .content table tr td { - text-align: left; - } - - .annotations { - display: none; - } - - .pagebreak { - margin: 1em; - } - - .handouts { - display: block !important; - border: none; - } - .handouts h1, h2, h3, h4 { - margin: 0; - margin-top: 1em; - margin-left: 0.5em; - margin-right: 3em; - margin-bottom: 1em; - text-align: left; - } - .handouts hr { - margin: 2em 0; - } - .handouts p { - margin: 0 3em 1em 2em; - text-align: left; - word-wrap: break-word; - } - - .handouts > pre, .handouts > form > pre { - word-wrap: break-word; - } - - .handouts > ul { - list-style: disc; - padding-left: 40px; - } - - .supplemental { - right: 0.5em; - } - - .supplemental.content > p { - font-size: 14px; - } - - .supplemental .content > pre > code { - word-wrap: break-word; - } - - .supplemental h1 { - margin: 0; - color: black; - font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; - font-size: 22px; - text-align: left; - } - - .supplemental h2 { - color: black; - font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; - font-size: 20px; - text-align: left; - } - - .supplemental h3 { - color: black; - font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; - font-size: 18px; - text-align: left; - } - - .supplemental h4 { - color: black; - font-family: "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; - font-size: 16px; - text-align: left; - } - - div#toc a { - font-size: 14px; - margin-left: 2em; - } - - /* Custom Slide Styles */ - - .lrbullets > ul > li:nth-of-type(odd) { - float: left; - width: 50%; - } - .lrbullets > ul > li:nth-of-type(even) { - } - - /* Custom Layout */ - - .content.small table { - font: normal 1.5em "Open Sans", "Lucida Sans Unicode", "Lucida Grande", "sans-serif"; - } -} diff --git a/global/netways.css b/global/netways.css new file mode 120000 index 0000000..4c9a128 --- /dev/null +++ b/global/netways.css @@ -0,0 +1 @@ +layouts/netways.css \ No newline at end of file diff --git a/global/post/00_feedback.md b/global/post/00_feedback.md new file mode 100644 index 0000000..f1c6cd5 --- /dev/null +++ b/global/post/00_feedback.md @@ -0,0 +1,4 @@ +!SLIDE noprint center +# Feedback + +.large.margin-top-1-3 We look forward to your feedback diff --git a/global/post/01_thanks.md b/global/post/01_thanks.md new file mode 100644 index 0000000..edd12df --- /dev/null +++ b/global/post/01_thanks.md @@ -0,0 +1,4 @@ +!SLIDE noprint center +# Thank You + +.large.margin-top-1-3 Thank you for your attention! diff --git a/global/pre/hints/00_hints.md b/global/pre/hints/00_hints.md new file mode 100644 index 0000000..accfa77 --- /dev/null +++ b/global/pre/hints/00_hints.md @@ -0,0 +1,7 @@ +!SLIDE smbullets +# Training Hints + +* Ask questions! Dumb questions do not exist. +* Add your own notes! Having learnt something is reflected best with your own additions. +* Join the conversation! Many of these exercises require real world scenarios and your feedback and questions. +* Work together! Be part of the training team and find solutions together. diff --git a/global/pre/netways/_images/.DS_Store b/global/pre/netways/_images/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/global/pre/netways/_images/.DS_Store differ diff --git a/global/_images/netways/Schulung_Stammlogo_2000px_ENG.jpg b/global/pre/netways/_images/Schulung_Stammlogo_2000px_ENG.jpg similarity index 100% rename from global/_images/netways/Schulung_Stammlogo_2000px_ENG.jpg rename to global/pre/netways/_images/Schulung_Stammlogo_2000px_ENG.jpg diff --git a/global/pre/netways/_images/consulting_customers.png b/global/pre/netways/_images/consulting_customers.png new file mode 100644 index 0000000..3e96cdf Binary files /dev/null and b/global/pre/netways/_images/consulting_customers.png differ diff --git a/global/pre/netways/_images/hosting_customers.png b/global/pre/netways/_images/hosting_customers.png new file mode 100644 index 0000000..e872acb Binary files /dev/null and b/global/pre/netways/_images/hosting_customers.png differ diff --git a/global/_images/netways/netways-logo-1366.png b/global/pre/netways/_images/netways-logo-1366.png similarity index 100% rename from global/_images/netways/netways-logo-1366.png rename to global/pre/netways/_images/netways-logo-1366.png diff --git a/global/pre/netways/_images/solutions.png b/global/pre/netways/_images/solutions.png new file mode 100644 index 0000000..46474dc Binary files /dev/null and b/global/pre/netways/_images/solutions.png differ diff --git a/global/pre/netways/about/00_about.md b/global/pre/netways/about/00_about.md new file mode 100644 index 0000000..be553bd --- /dev/null +++ b/global/pre/netways/about/00_about.md @@ -0,0 +1,46 @@ +!SLIDE noprint subsectionnonum +# About NETWAYS + + +!SLIDE noprint +# NETWAYS + +* Open Source Service Company +* Located in Nuremberg, Germany +* Services + * Consulting + * Hosting + * Development + * Support + * Trainings + * Events + + +!SLIDE noprint +# NETWAYS Solutions + +
NETWAYS Solutions
+ + +!SLIDE noprint +# NETWAYS Consulting Customers + +
NETWAYS Consulting Customers
+ + +!SLIDE noprint +# NETWAYS Hosting Customers + +
NETWAYS Hosting Customers
+ + +!SLIDE noprint +# NETWAYS Events + +.margin-top-1-5 NETWAYS Events + + +!SLIDE noprint +# NETWAYS Trainings + +.margin-top-1-5 NETWAYS Trainings diff --git a/global/pre/netways/title/00_title.md b/global/pre/netways/title/00_title.md new file mode 100644 index 0000000..3194b5d --- /dev/null +++ b/global/pre/netways/title/00_title.md @@ -0,0 +1,16 @@ +!SLIDE printonly + + +
+
~~~CONFIG:name~~~
+
~~~CONFIG:subtitle~~~
+
Version: ~~~CONFIG:release~~~
+
+ +!SLIDE noprint + +

~~~CONFIG:name~~~

+

~~~CONFIG:subtitle~~~

+

~~~CONFIG:author~~~

diff --git a/global/pre/osbconf/_images/osbconf_2017_logo_2000.png b/global/pre/osbconf/_images/osbconf_2017_logo_2000.png new file mode 100755 index 0000000..6c9f67a Binary files /dev/null and b/global/pre/osbconf/_images/osbconf_2017_logo_2000.png differ diff --git a/global/pre/osbconf/title/00_title.md b/global/pre/osbconf/title/00_title.md new file mode 100644 index 0000000..b40afa6 --- /dev/null +++ b/global/pre/osbconf/title/00_title.md @@ -0,0 +1,16 @@ +!SLIDE printonly + + +
+
~~~CONFIG:name~~~
+
~~~CONFIG:subtitle~~~
+
Version: ~~~CONFIG:release~~~
+
+ +!SLIDE noprint + +

~~~CONFIG:name~~~

+

~~~CONFIG:subtitle~~~

+

~~~CONFIG:author~~~

diff --git a/global/pre/osdc/_images/osdc_logo_500x177.png b/global/pre/osdc/_images/osdc_logo_500x177.png new file mode 100644 index 0000000..e63bcb3 Binary files /dev/null and b/global/pre/osdc/_images/osdc_logo_500x177.png differ diff --git a/global/pre/osdc/title/00_title.md b/global/pre/osdc/title/00_title.md new file mode 100644 index 0000000..76b71ad --- /dev/null +++ b/global/pre/osdc/title/00_title.md @@ -0,0 +1,16 @@ +!SLIDE printonly + + +
+
~~~CONFIG:name~~~
+
~~~CONFIG:subtitle~~~
+
Version: ~~~CONFIG:release~~~
+
+ +!SLIDE noprint + +

~~~CONFIG:name~~~

+

~~~CONFIG:subtitle~~~

+

~~~CONFIG:author~~~

diff --git a/global/pre/osmc/_images/osmc_logo_500x211.png b/global/pre/osmc/_images/osmc_logo_500x211.png new file mode 100644 index 0000000..8942359 Binary files /dev/null and b/global/pre/osmc/_images/osmc_logo_500x211.png differ diff --git a/global/pre/osmc/title/00_title.md b/global/pre/osmc/title/00_title.md new file mode 100644 index 0000000..7979093 --- /dev/null +++ b/global/pre/osmc/title/00_title.md @@ -0,0 +1,16 @@ +!SLIDE printonly + + +
+
~~~CONFIG:name~~~
+
~~~CONFIG:subtitle~~~
+
Version: ~~~CONFIG:release~~~
+
+ +!SLIDE noprint + +

~~~CONFIG:name~~~

+

~~~CONFIG:subtitle~~~

+

~~~CONFIG:author~~~

diff --git a/global/Pre/Title/02_Toc.md b/global/pre/toc/00_toc similarity index 94% rename from global/Pre/Title/02_Toc.md rename to global/pre/toc/00_toc index 3d534e9..416e239 100644 --- a/global/Pre/Title/02_Toc.md +++ b/global/pre/toc/00_toc @@ -1,5 +1,5 @@ !SLIDE printonly - + # Table of Contents ~~~TOC~~~ diff --git a/global/showoff.json b/global/showoff.json new file mode 100644 index 0000000..5ddb0e9 --- /dev/null +++ b/global/showoff.json @@ -0,0 +1,26 @@ +{ + "name": "NETWAYS Training", + "subtitle": "Open Source Training", + "author": "Open Source Community", + "release": "0.0.1", + + "favicon": "global/favicon.ico", + + "protected": ["presenter", "onepage", "print"], + + "user": "netways", + "password": "awesome", + + "templates":{ + "default": "layouts/netways.tpl" + }, + + "sections": [ + {"section": "pre/netways/title"}, + {"section": "trainer"}, + {"section": "pre/netways/about"}, + {"section": "pre/hints"}, + + {"section": "post"} + ] +} diff --git a/global/templates/default.tpl b/global/templates/default.tpl deleted file mode 100644 index 81cf761..0000000 --- a/global/templates/default.tpl +++ /dev/null @@ -1,10 +0,0 @@ -
- NETWAYS -
- -~~~CONTENT~~~ - - diff --git a/global/trainer/00_title.md b/global/trainer/00_title.md new file mode 100644 index 0000000..8973baa --- /dev/null +++ b/global/trainer/00_title.md @@ -0,0 +1,2 @@ +!SLIDE noprint subsectionnonum +# Trainer diff --git a/global/wizard.sh b/global/wizard.sh new file mode 100755 index 0000000..f65a77a --- /dev/null +++ b/global/wizard.sh @@ -0,0 +1,169 @@ +#!/bin/bash +DIR=$(pwd) +CLANG=${CLANG:-C.UTF-8} +IMAGE=${IMAGE:-netways/showoff:0.19.6} +CNAME=${CNAME:-showoff} +TRAINING=${TRAINING:-$(basename "$DIR")} +DOCKER=${DOCKER:-$(command -v docker)} +GIT=${GIT:-$(command -v git)} +SCRIPT_DIR=$(cd $(dirname $0); pwd -P) +NO_RESET=${NO_RESET:-""} + +# Functions + +execdocker () { + if [[ -n $($DOCKER ps -aq -f name=$CNAME 2> /dev/null) ]]; then + $DOCKER rm -f $CNAME 2> /dev/null + fi + + $DOCKER run \ + -it \ + --name=$CNAME \ + --rm \ + -p 9090:9090 \ + -v "$DIR:/training" \ + -e "LANG=$CLANG" \ + -e "LANGUAGE=$CLANG" \ + -e "LC_ALL=$CANG" \ + $IMAGE \ + $1 +} + +printhandouts () { + echo -e "\n--- RUN SHOWOFF STATIC FOR HANDOUTS ---" + execdocker "showoff static print" + echo -e "\n--- RUN WKHTMLTOPDF FOR HANDOUTS ---" + execdocker "wkhtmltopdf --load-error-handling ignore -s A5 --print-media-type --footer-left [page] --footer-right ©NETWAYS static/index.html ${TRAINING}_${1}-handouts.pdf" +} + +printexercises () { + echo -e "\n--- RUN SHOWOFF STATIC FOR EXERCISES ---" + execdocker "showoff static supplemental exercises" + echo -e "\n--- RUN WKHTMLTOPDF FOR EXERCISES ---" + execdocker "wkhtmltopdf --load-error-handling ignore -s A5 --print-media-type --footer-left [page] --footer-right ©NETWAYS static/index.html ${TRAINING}_${1}-exercises.pdf" +} + +printsolutions () { + echo -e "\n--- RUN SHOWOFF STATIC FOR SOLUTIONS ---" + execdocker "showoff static supplemental solutions" + echo -e "\n--- RUN WKHTMLTOPDF FOR SOLUTIONS ---" + execdocker "wkhtmltopdf --load-error-handling ignore -s A5 --print-media-type --footer-left [page] --footer-right ©NETWAYS static/index.html ${TRAINING}_${1}-solutions.pdf" +} + +setlayout () { + find . -type l -maxdepth 1 -delete + ln -s global/layouts/$1.css . +} + +reset () { + CHANGES=$($GIT status --porcelain $SCRIPT_DIR | grep -v wizard) + if [[ -n $CHANGES ]]; then + if [[ -n $NO_RESET ]]; then + echo "Git has changes but NO_RESET was provided, abort" + else + echo "" + echo -n "There are changes in '$SCRIPT_DIR', reset ... " + $GIT status --porcelain $SCRIPT_DIR | grep -v 'wizard' | cut -f3 -d ' ' | xargs $GIT checkout HEAD -- + echo "done" + fi + fi + + exit 0 +} + +# Begin + +trap "reset" EXIT + +if [[ ! -x $DOCKER ]]; then + echo "Command 'docker' not found, exit" + exit 1 +fi + +if [[ ! -x $GIT ]]; then + echo "Command 'git' not found, exit" + exit 1 +fi + +# Wizard + +clear + +echo "###########################" +echo " NETWAYS Training Wizard " +echo "###########################" + +echo -e "\n### LAYOUT ###" + +echo -e " + [1] NETWAYS + [2] OSMC + [3] OSDC + [4] OSBConf\n" + +LAYOUT_DEFAULT=1 +read -p "Which Layout? [1-4] (Default: "$LAYOUT_DEFAULT"): " LAYOUT +LAYOUT="${LAYOUT:-$LAYOUT_DEFAULT}" + +while [[ $LAYOUT != [1-4] ]]; do + echo "Invalid option, try again..." + read -p "What to print? [1-4] (Default: "$LAYOUT_DEFAULT"): " LAYOUT + LAYOUT="${LAYOUT:-$LAYOUT_DEFAULT}" +done + +case "$LAYOUT" in + 1) LAYOUT=netways + sed -i '' 's|^[ \t\s]*"default":.*| "default": "global/layouts/netways.tpl"|' showoff.json;; + 2) LAYOUT=osmc + sed -i '' 's|^[ \t\s]*"default":.*| "default": "global/layouts/osmc.tpl"|' showoff.json;; + 3) LAYOUT=osdc + sed -i '' 's|^[ \t\s]*"default":.*| "default": "global/layouts/osdc.tpl"|' showoff.json;; + 4) LAYOUT=osbconf + sed -i '' 's|^[ \t\s]*"default":.*| "default": "global/layouts/osbconf.tpl"|' showoff.json;; +esac + +setlayout $LAYOUT + +echo -e "\n### MODE ###\n" + +MODE_DEFAULT=serve +read -p "Which mode? [serve/print] (Default: "$MODE_DEFAULT"): " MODE +MODE="${MODE:-$MODE_DEFAULT}" + +if [[ $MODE == serve ]]; then + echo "--- RUN SHOWOFF SERVE ---" + execdocker "showoff serve" +elif [[ $MODE == print ]]; then + echo -e "\n### PRINT ###" + + echo -e " + [1] Handouts + [2] Handouts & Solutions + [3] Handouts & Exercises & Solutions + [4] Exercises & Solutions\n" + + PRINT_DEFAULT=2 + read -p "What to print? [1-4] (Default: "$PRINT_DEFAULT"): " PRINT + PRINT="${PRINT:-$PRINT_DEFAULT}" + + while [[ $PRINT != [1-4] ]]; do + echo "Invalid option, try again..." + read -p "What to print? [1-4] (Default: "$PRINT_DEFAULT"): " PRINT + PRINT="${PRINT:-$PRINT_DEFAULT}" + done + + VERSION_DEFAULT=`grep release showoff.json | cut -f2 -d: | tr -d '"' | tr -d " " | tr -d ","` + read -p "Which version? (Default: "$VERSION_DEFAULT"): " VERSION + VERSION="${VERSION:-$VERSION_DEFAULT}" + + case "$PRINT" in + 1) printhandouts $VERSION;; + 2) printhandouts $VERSION + printsolutions $VERSION;; + 3) printhandouts $VERSION + printexercises $VERSION + printsolutions $VERSION;; + 4) printexercises $VERSION + printsolutions $VERSION;; + esac +fi diff --git a/netways.css b/netways.css index c45d042..6c002e1 120000 --- a/netways.css +++ b/netways.css @@ -1 +1 @@ -global/netways.css \ No newline at end of file +global/layouts/netways.css \ No newline at end of file diff --git a/print.sh b/print.sh deleted file mode 100755 index 51aea70..0000000 --- a/print.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -DIR=$(cd $(dirname $0); pwd -P) -CLANG=C.UTF-8 -IMAGE=local/showoff -CNAME=showoff - -cd "$DIR" - -docker build -t $IMAGE "$DIR" - -if [ -n $(docker ps -aq -f name=$CNAME) ] -then - docker rm -f $CNAME -fi - -docker run \ - -it \ - --name=$CNAME \ - -p 9090:9090 \ - -v "$DIR:/training" \ - -e "LANG=$CLANG" \ - -e "LANGUAGE=$CLANG" \ - -e "LC_ALL=$CANG" \ - $IMAGE \ - ./print_all.sh - -exit $? diff --git a/print_all.sh b/print_all.sh deleted file mode 100755 index 6fdcad8..0000000 --- a/print_all.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# should be called inside print.sh - -showoff static supplemental exercises -wkhtmltopdf -s A5 --print-media-type --footer-left [page] --footer-right '© NETWAYS' static/index.html gitlab-training-exercises.pdf -showoff static supplemental solutions -wkhtmltopdf -s A5 --print-media-type --footer-left [page] --footer-right '© NETWAYS' static/index.html gitlab-training-solutions.pdf - -# Generate handouts and also refresh static content for GH -showoff static print -wkhtmltopdf -s A5 --print-media-type --footer-left [page] --footer-right '© NETWAYS' static/index.html gitlab-training-handouts.pdf diff --git a/showoff.json b/showoff.json index a92b7f0..8abeb01 100644 --- a/showoff.json +++ b/showoff.json @@ -1,23 +1,25 @@ { - "title": "GitLab", + "name": "GitLab", "subtitle": "Version Control System & Continuous Integration", "location": "Nuremberg", "author": "Michael Friedrich", "release": "2.2.0", "favicon": "image/global/favicon.ico", - "logo": "/global/_images/netways/netways-logo-1366.png", "protected": ["presenter", "onepage", "print"], "user": "netways", "password": "awesome", - "templates":{ - "default":"./global/templates/default.tpl" + "templates" : { + "default" : "global/layouts/netways.tpl" }, "sections": [ - {"section":"global/Pre/Title"}, + {"section": "global/pre/netways/title"}, + {"section": "trainer"}, + {"section": "global/pre/netways/about"}, + {"section": "global/pre/hints"}, {"section":"day1/01_Introduction"}, {"section":"day1/02_Configuration"}, @@ -34,6 +36,6 @@ {"section":"day2/05_Gitlab_Hints"}, {"section":"day2/06_Additional"}, - {"section":"global/Post"} + {"section": "global/post"} ] } diff --git a/start.sh b/start.sh deleted file mode 100755 index 0ec7fe7..0000000 --- a/start.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -DIR=$(cd $(dirname $0); pwd -P) -CLANG=C.UTF-8 -IMAGE=local/showoff -CNAME=showoff - -cd "$DIR" - -docker build -t $IMAGE "$DIR" - -if [ -n $(docker ps -aq -f name=$CNAME) ] -then - docker rm -f $CNAME -fi - -docker run \ - -it \ - --name=$CNAME \ - -p 9090:9090 \ - -v "$DIR:/training" \ - -e "LANG=$CLANG" \ - -e "LANGUAGE=$CLANG" \ - -e "LC_ALL=$CANG" \ - $IMAGE \ - showoff serve --review --verbose - -exit $? diff --git a/static/file/global/pre/netways/_images/Schulung_Stammlogo_2000px_ENG.jpg b/static/file/global/pre/netways/_images/Schulung_Stammlogo_2000px_ENG.jpg new file mode 100644 index 0000000..8ef0cb8 Binary files /dev/null and b/static/file/global/pre/netways/_images/Schulung_Stammlogo_2000px_ENG.jpg differ diff --git a/static/file/global/pre/netways/_images/netways-logo-1366.png b/static/file/global/pre/netways/_images/netways-logo-1366.png new file mode 100644 index 0000000..73c520d Binary files /dev/null and b/static/file/global/pre/netways/_images/netways-logo-1366.png differ diff --git a/static/file/netways.css b/static/file/netways.css index 34b071d..aceb3d4 100644 --- a/static/file/netways.css +++ b/static/file/netways.css @@ -76,7 +76,7 @@ ************************************************/ .net-header img { - margin-right: 0; + margin-right: 1.5em; } .content .net-header + h1:not(.section-title) { @@ -109,8 +109,8 @@ .subsection .net-header, .subsectionnonum .net-header, - #Pre_Title_01_Title1 .net-header, - #global_Pre_Title_01_Title1 .net-header { + #pre_netways_title_00_title1 .net-header, + #global_pre_netways_title_00_title1 .net-header { border-bottom: .0625em solid black; padding-bottom: 0; } @@ -165,8 +165,8 @@ height: 99%; /* The negative margin workaround does not work with wkhtmltopdf.. */ } - #Pre_Title_01_Title1 .net-header, - #global_Pre_Title_01_Title1 .net-header { + #pre_netways_title_00_title1 .net-header, + #global_pre_netways_title_00_title1 .net-header { display: none; } @@ -204,11 +204,11 @@ background: black; } - .title-location { + .title-subtitle { overflow: auto; } - .title-location p { + .title-subtitle p { float: right; margin: 1em 0; padding: .25em; @@ -244,17 +244,12 @@ font-size: 2em; } - .title-subtitle { - font-size: 1.5em; - } - .title-release { margin-top: 2em; } .title-footer { - margin-top: 19.5em; - margin-right: 1em; + margin-top: 23.5em; text-align: right; font-weight: bold; } @@ -477,7 +472,6 @@ @media print { code { font-size: 12px; - margin-left: 0em; } li, td { diff --git a/static/index.html b/static/index.html index 1065cc2..dac4b66 100644 --- a/static/index.html +++ b/static/index.html @@ -77,6673 +77,1965 @@ -
-
-
-

+
+
+
- NETWAYS + NETWAYS Training
- +

Lab 1.1: Proposed Solution

-
-
GitLab
-
Version Control System & Continuous Integration
-
Version: 2.2.0
- -
+
- -
- -
-
-
-

-
- NETWAYS -
+

Install the Git package

-

Table of Contents

+
-

+

Example for Debian/Ubuntu

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

-
- NETWAYS -
+
$ apt-get install git
+ +

Example for RHEL/CentOS

+ +
$ yum install git
-

1 Git Introduction

+

Example for Fedora

+ +
$ dnf install git
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

+
+
- NETWAYS + NETWAYS Training
-

Version Control

+

Lab 1.2: Proposed Solution

-
    -
  • Version Control System (VCS)
  • -
  • Record changes of file(s)
  • -
  • Revert changes
  • -
  • Compare changes over time
  • -
  • Who, when, what
  • -
+
+

Install Git Bash Completion

+
- -
-
+

Example for Debian/Ubuntu

-
+
$ apt-get install bash-completion
-

The most simple version control system is to copy -directories and add a suffix like the last date it -worked. Though this might cause trouble when you're -in the wrong directory. Afterall it pollutes your -filesystem structure over time.

+

Example for RHEL/CentOS

-

Long time ago developers invented version control -systems which store the file revisions in a database.

+
$ yum install bash-completion
-
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

-
- NETWAYS -
+

Example for Fedora

-

Centralized VCS

+
$ dnf install bash-completion
-
    -
  • Multiple computers required file revisions
  • -
  • CVS, Subversion
  • -
  • What happens if the server is down?
  • -
+

Fetch the git-prompt.sh script

-

-
CVCS
+
$ wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh
+

Customize your prompt in your .bashrc file

+
$ vim $HOME/.bashrc
+source ~/git-prompt.sh
+export GIT_PS1_SHOWDIRTYSTATE=1
+export PS1='[\u@\h] \W$(__git_ps1 " (%s)") \$ '
+
+$ source $HOME/.bashrc
+

Open Source Training

+

by NETWAYS (netways.de)

-
- -
-
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

+
+
- NETWAYS + NETWAYS Training
-

Distributed VCS

+

Lab 2.1: Proposed Solution

-
    -
  • Clients mirror the repository
  • -
  • Git, Mercurial, Bazaar, etc.
  • -
  • Server dies, client continues
  • -
+
-

-
CVCS
+

Configure your username and email address

+
+

Set the global username

- -
-
+
$ git config --global user.name "Michael Friedrich"
-
+

Set the global email address

-
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

-
- NETWAYS -
+
$ git config --global user.email "michael.friedrich@netways.de"
-

History of Git

+

Verification

-
    -
  • Linux kernel development +
    $ git config --global --list
    -
      -
    • Patches and archives
    • -
    • Proprietary software BitKeeper -
    • -
    -
  • -
  • Controversy in 2005, no more free to use
  • -
  • Kernel developers invented Git -
  • -
+

In addition to that you can open the .gitconfig file in your $HOME directory.

+ +
$ less $HOME/.gitconfig
+
+ +

Notes

+ +

You can also use git config --global --list to list all configured options.

-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

+
+
- NETWAYS + NETWAYS Training
-

Design Goals for Git

+

Lab 3.1: Proposed Solution

-
    -
  • Speed
  • -
  • Simple design
  • -
  • Non-linear development (many branches)
  • -
  • Fully distributed
  • -
  • Handle large projects in speed and size
  • -
+
+

Clone an existing Git repository

+
- -
-
+

Git clone

-
+
$ cd $HOME
+$ git clone https://github.com/Icinga/icinga2.git
+
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

+
+
- NETWAYS + NETWAYS Training
-

Git Basics

+

Lab 3.2: Proposed Solution

-
    -
  • Learn Git, forget about other VCS systems (SVN, etc.)
  • -
  • Git interface is similar to existing VCS
  • -
  • ... but Git behaves differently
  • -
+
+

Initialize Git repository

+
- -
-
+

Create a new Git repository

-
+
$ cd $HOME
+$ mkdir training
+$ cd training
+$ git init
+
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

+
+
- NETWAYS + NETWAYS Training
-

Snapshots and Differences

+

Lab 3.3: Proposed Solution

-
    -
  • File changes and deltas over time +
    + +

    Add a new README.md file

    + +
    + +

    Example

    + +
    $ cd $HOME/training
    +$ echo "# Git Training Notes" > README.md
    +$ git add README.md
    +$ git status
    -
      -
    • Git Commit, take snapshot, store reference to that snapshot
    • -
    • Set of snapshots of a mini-filesystem
    • -
    • No change - link to the previous identical stored file
    • -
    -
  • -
-

-
Basic Changes
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

+
+
- NETWAYS + NETWAYS Training
-

Work locally

+

Lab 3.4: Proposed Solution

-
    -
  • No network latency involved as with other VCS systems
  • -
  • Local repository clone, fast operations +
    -
      -
    • Browse the history
    • -
    • Show differences between specific branches
    • -
    -
  • -
  • Work offline and push changes later
  • -
+

Remove file from staging index.

+ +
+ +

Example

+ +
$ cd $HOME/training
+
+$ git status
+
+$ git reset --soft README.md
+
+$ git status
+
+$ git add README.md
+
+$ git status
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

+
+
- NETWAYS + NETWAYS Training
-

Integrity

+

Lab 3.5: Proposed Solution

-
    -
  • Everything has a check sum (SHA-1)
  • -
  • No changes possible without Git knowing about them
  • -
  • Checksums are literally used everywhere
  • -
  • Revert changes and even restore deleted files
  • -
+
-

Example:

+

Examine current changes

-
7f0b824ba55e1fd4ffc5c461df0a0f48a94195cc
-
+
+

Change files

+
$ cd $HOME/training
 
-
-
-
+$ vim README.md +# Git Training Notes -
+I've learned about `git add` already. + +``` +git status +```
+ +

Modify and save the file.

+ +

Use git status

+ +
$ git status
+ +

You'll recognize the unstaged changes compared to your staging area.

+ +

Add the change to the staging area

+
$ git add README.md
+ +

Use git status again

+ +
$ git status
+ +
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

+
+
- NETWAYS + NETWAYS Training
-

The three states

+

Lab 3.6: Proposed Solution

-
    -
  • Working directory ("modified")
  • -
  • Staging area ("staged")
  • -
  • Git directory ("committed")
  • -
+
-

-
Basics 3 States
+

Play with Git Diff

+
+

Change files

+
$ vim README.md
 
+I've also learned the difference between local changes and the staging area.
- -
-
+

Modify and save the file.

-
+

Use git diff

-

Modified means that you have changed the file but have not committed -it to your Git database yet.

+
$ git diff
-

Staged means that you have marked a modified or added file in its -current version to go into your next commit snapshot.

+

You'll recognize the unstaged changes compared to your staging area.

-

Committed means that the data is safely stored in your local database.

+

Add the change to the staging area

-

The working directory is a single checkout of one version of the project. -These files are pulled out of the compressed database in the Git directory -and placed on disk for you to use or modify.

+
$ git add README.md
-

The staging area is a file, generally located in your Git directory, that -stores information about what will go into your next commit. -It is sometimes referred to as the "index", but it’s also common to refer -to it as the staging area.

+

Use git diff again

-

The Git directory is where Git stores the metadata and object database -for your project. This is the most important part of Git, and it is what -is copied when you clone a repository from another computer.

+
$ git diff
+
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

+
+
- NETWAYS + NETWAYS Training
-

Basic Git Workflow

+

Lab 3.7: Proposed Solution

-
    -
  • Modify files in working directory -
  • -
  • Stage the files which add snapshots to the staging area ("git add")
  • -
  • Commit ("git commit") +
    -
      -
    • Takes files in staging area -
    • -
    • Stores snapshot permanently in .git directory -
    • -
    -
  • -
+

Add .gitignore file and exclude files/directories

+
+

Add file/directory

- -
-
+

Create a dummy file and directory which contains a file itself. This is +for simulating unwanted files in the working directory.

-
+
$ cd $HOME/training
 
-
    -
  • If a particular version of a file is in the .git directory, it’s considered committed.

  • -
  • Staged means that the file has been modified and it was added to the staging area

  • -
  • Modified means that the file was changed since it was checked out but has not been staged yet.

  • -
+$ touch generated.tmp +$ mkdir debug +$ touch debug/.timestamp
-
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

-
- NETWAYS -
+

Examine the state with git status

-

Git CLI

+
$ git status
+On branch master
 
-
    -
  • Work on the CLI
  • -
  • GUIs implement partial feature sets of the CLI tool
  • -
  • Shell sub commands
  • -
  • Bash-completion
  • -
+Untracked files: + (use "git add <file>..." to include in what will be committed) + debug/ + generated.tmp
+

Add .gitignore file

- -
-
+
$ vim .gitignore
+*.tmp
+debug/
-
+

Files matching the *.tmp pattern in the current directory +will be excluded. Furthermore the debug directory (note the +trailing slash).

+ +

Examine the state with git status

+ +
$ git status
+On branch master
 
+Untracked files:
+  (use "git add <file>..." to include in what will be committed)
+
+        .gitignore
+ +

We'll learn how to add and commit the untracked .gitignore file +in later examples.

+ +
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

+
+
- NETWAYS + NETWAYS Training
-

Git Installation

+

Lab 4.1: Proposed Solution

-
    -
  • Available as package
  • -
  • macOS, Windows installers
  • -
  • Bash Integration +
    -
      -
    • Completion
    • -
    • Show status and branch in the terminal
    • -
    -
  • -
+

Commit Changes

-

Bash Integration

+
+

Add/modify file

+
$ cd $HOME/training
 
-
-
-
+$ vim README.md -
+`git commit` also has `-a` which should be used with care. -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

-
- NETWAYS -
+$ git add README.md
-

Lab 1.1: Install Git

+

Commit the changed file

-
    -
  • Objective: +
    $ git status
    +$ git commit -v README.md
    +  Update training notes
     
    -
      -
    • Install the git package
    • -
    -
  • -
  • Steps: + My first commit :) -
      -
    • Use the package manager to install the git package
    • -
    -
  • -
+Save and exit. +

Verify the Git history

+ +
$ git log
+

Open Source Training

+

by NETWAYS (netways.de)

-
- -
-
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

+
+
- NETWAYS + NETWAYS Training
-

Lab 1.2: Install Git Bash Completion

+

Lab 4.2: Proposed Solution

-
    -
  • Objective: +
    -
      -
    • Install the bash-completion package
    • -
    • Modify your prompt to highlight the git state
    • -
    -
  • -
  • Steps: +

    Examine the Commit History

    -
      -
    • Use the package manager to install the bash-completion package
    • -
    • Fetch the git-prompt.sh script from https://github.com/git/git - contrib/completion/git-prompt.sh -
    • -
    • Customize your prompt in your $HOME/.bashrc file
    • -
    -
  • -
+
+

Add and commit remaining changes

+
$ cd $HOME/training
 
+$ git status
+$ git add .gitignore
+$ git commit -v .gitignore -m "Add .gitignore file"
+

Use git log

+
$ git log
+

Use git show

- -
-
+
$ git show
+$ git show <commitid>
+$ git show -2
-
+

Use git diff

+
$ git diff
+$ git diff <commitid1> <commitid2>
+ +
-
-
-

~~~SECTION:MAJOR~~~ Git Introduction

+
+
- NETWAYS + NETWAYS Training
-

More Git Shell Integrations

+

Lab 4.3: Proposed Solution

-
    -
  • Powerline Shell
  • -
+
-

Powerline Shell Integration

+

Learn more about tig

-
    -
  • Windows Powershell: git-posh
  • -
+
+ +

Install tig

+ +

CentOS 7 (requires the EPEL repository):

+ +
# yum install epel-release
+# yum makecache
+# yum install tig
-

Powershell Integration

+

Debian/Ubuntu

+
# apt-get install tig
+

Use tig

+ +
$ cd $HOME/training
+$ tig
+
+@@@ Sh
+$ cd $HOME/icinga2
+$ tig
+ +
+
+
+
+ NETWAYS Training
-
+ +

Lab 4.4: Proposed Solution


-

Powerline Shell Integration

+

Amend changes to commits

-

The Powerline shell integration can be found here: https://github.com/b-ryan/powerline-shell

+
-
# yum -y install epel-release
-# yum -y install python-pip
-# pip install powerline-shell
+

Add the files

-@@@ Sh -$ vim $HOME/.bashrc +
$ cd $HOME/training
 
-function _update_ps1() {
-    PS1=$(powerline-shell $?)
-}
+$ vim README.md
 
-if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then
-    PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
-fi
+`git commit --amend` adds missing changes to the previous commit.
-

Powerline needs an additional font which can be downloaded from here: -https://github.com/powerline/fonts/blob/master/Meslo%20Slashed/Meslo%20LG%20M%20Regular%20for%20Powerline.ttf

+

Add README.md to the staging index and commit the change

-

Choose Raw and install it into your system.

+
$ git add README.md
+$ git status
+$ git commit -v README.md -m "Add documentation for Amend"
-

Modify your terminal profile settings and choose Meslo LG as font.

+

Add a note to README.md again

-

Windows Powershell Integration

+
$ vim README.md
 
-

The Windows Powershell integration requires NuGet. Open a new Powershell prompt and enter:

+`git commit --amend` adds missing changes to the previous commit. +I'm also able to edit the commit message. -
Install-Module git-posh
-Add-PoshGitToProfile
+$ git add README.md +$ git status
-
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Configuration

-
- NETWAYS -
+

Amend README.md to the previous commit

-

2 Git Configuration

+
$ git commit --amend -v README.md
+  Add documentation for 'git amend'
+ +

Adopt the commit message as additional exercise above.

+ +
$ git status
+$ git show
-
-
-

~~~SECTION:MAJOR~~~ Git Configuration

+
+
- NETWAYS + NETWAYS Training
-

Configuration Overview

+

Lab 5.1: Proposed Solution

-
    -
  • Global configuration for the user - -
      -
    • $HOME/.gitconfig
    • -
    -
  • -
  • Local to the repository - -
      -
    • training/.git/config
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Configuration

-
- NETWAYS -
- -

Configuration

- -
    -
  • CLI command support
  • -
  • $HOME/.gitconfig
  • -
- -

Example:

- -
$ git config --global color.ui auto
-
-$ cat $HOME/.gitconfig
-[color]
-ui = auto
- - - - -
-
- -
- -

More information can be found in the documentation at -https://git-scm.com/book/tr/v2/Customizing-Git-Git-Configuration

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Configuration

-
- NETWAYS -
- -

Configuration Sections

- -
    -
  • Commit author (user)
  • -
  • Aliases (alias)
  • -
  • Colors for diff and verbose commit (color)
  • -
  • Core functionality (core)
  • -
- -

Example:

- -

Git Config

- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Configuration

-
- NETWAYS -
- -

Lab 2.1: Configure your username and email address

- -
    -
  • Objective: - -
      -
    • Configure your username and email address using Git CLI commands
    • -
    -
  • -
  • Steps: - -
      -
    • Use git config --global user.name "Your Name" -
    • -
    • Use git config --global user.email "name@domain.com" -
    • -
    -
  • -
  • Next steps: - -
      -
    • Verify the changes with git config --global --list -
    • -
    -
  • -
- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

3 Git Basics

- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Git Command Overview

- -
    -
  • Start a working area (clone, init)
  • -
  • Work on current changes (add, reset)
  • -
  • Examine the history and state (status, log)
  • -
  • Grow, mark and tweak the history (branch, checkout, commit, merge, rebase)
  • -
  • Collaborate (fetch, pull, push)
  • -
- - - - -
-
- -
- -

Example from Git CLI command:

- -
start a working area (see also: git help tutorial)
-   clone      Clone a repository into a new directory
-   init       Create an empty Git repository or reinitialize an existing one
-
-work on the current change (see also: git help everyday)
-   add        Add file contents to the index
-   mv         Move or rename a file, a directory, or a symlink
-   reset      Reset current HEAD to the specified state
-   rm         Remove files from the working tree and from the index
-
-examine the history and state (see also: git help revisions)
-   bisect     Use binary search to find the commit that introduced a bug
-   grep       Print lines matching a pattern
-   log        Show commit logs
-   show       Show various types of objects
-   status     Show the working tree status
-
-grow, mark and tweak your common history
-   branch     List, create, or delete branches
-   checkout   Switch branches or restore working tree files
-   commit     Record changes to the repository
-   diff       Show changes between commits, commit and working tree, etc
-   merge      Join two or more development histories together
-   rebase     Forward-port local commits to the updated upstream head
-   tag        Create, list, delete or verify a tag object signed with GPG
-
-collaborate (see also: git help workflows)
-   fetch      Download objects and refs from another repository
-   pull       Fetch from and integrate with another repository or a local branch
-   push       Update remote refs along with associated objects
-
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Start a project

- -
    -
  • -git clone - -
      -
    • Clone a copy of existing remote repository.
    • -
    • Can be newly created in GitLab/GitHub and empty.
    • -
    -
  • -
  • -git init - -
      -
    • Initialize a local empty Git repository.
    • -
    -
  • -
- - - - -
-
- -
- -

git clone clones a copy of an existing remote Git repository.

- -

git init initializes an empty directory as local Git repository.

- -

When you clone a repository, Git automatically adds a shortcut called -origin that points back to the "parent" repository, under the assumption -that you'll want to interact with it further on down the road. This is -called an origin.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Lab 3.1: Clone an existing Git repository

- -
    -
  • Objective: - -
      -
    • Clone an existing Git repository
    • -
    -
  • -
  • Steps: - - -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Lab 3.2: Initialize a local Git repository

- -
    -
  • Objective: - -
      -
    • Initialize git repository
    • -
    -
  • -
  • Steps: - -
      -
    • Create a new directory called training in your home directory
    • -
    • Change into it
    • -
    • Run git init -
    • -
    -
  • -
- -

We will be working inside the training directory throughout the training -unless noted otherwise.

- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Add current changes

- -
    -
  • -git add - -
      -
    • Add (modified) file(s) from the working directory into the staging index.
    • -
    -
  • -
  • -git mv - -
      -
    • Rename file(s) tracked by Git.
    • -
    -
  • -
- - - - -
-
- -
- -

git add will add the file(s) and their content to the staging index -waiting for the commit.

- -

git mv renames an existing file tracking the change for the commit. If you -manually move the file, you will need to rm and add it again.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Remove changes

- -
    -
  • -git reset - -
      -
    • Reset files added to the staging index.
    • -
    • ---soft keeps the changes (default), --hard removes them indefinitely.
    • -
    -
  • -
  • -git rm - -
      -
    • Remove the file(s) from working tree and Git repository.
    • -
    • Note that file(s) will be visible in Git history, and can be restored from it.
    • -
    -
  • -
- - - - -
-
- -
- -

git reset resets files added to the staging index.

- -

git rm removes the file from the working tree and also from the git index.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Lab 3.3: Add a new README.md file

- -
    -
  • Objective: - -
      -
    • Add a new README.md file
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Create README.md and add # Git Training Notes as first line
    • -
    • Use git add to add README.md to the current change index
    • -
    -
  • -
  • Next steps: - -
      -
    • Verify the change with git status -
    • -
    -
  • -
- -

Best practice is to have a README.md file written in Markdown -in every project. This gets rendered by GitHub/GitLab in readable HTML.

- -

During this training we will learn many new things. Keep notes -in the README.md file.

- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Lab 3.4: Reset File from Staging Index

- -
    -
  • Objective: - -
      -
    • Reset file from staging index
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Remove the previously added README.md file from the staging index with git reset --soft README.md -
    • -
    • Verify it with git status and explain what happened.
    • -
    • Re-add the README.md and examine again with git status.
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Examine the current state

- -
    -
  • -git status - -
      -
    • Show current working tree status.
    • -
    • -Untracked files and added to staging area.
    • -
    • Modifications
    • -
    -
  • -
  • -git diff - -
      -
    • Compare changes between working tree and latest commit.
    • -
    -
  • -
- -

Later we will learn how to compare specific commits and branches too.

- - - - -
-
- -
- -

git status shows the current working tree status. Untracked files and changes (not) staged -for commit.

- -

git diff shows changes between the current working tree and the last commit. You can -also compare specific commits.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Lab 3.5: Examine current changes

- -
    -
  • Objective: - -
      -
    • Examine current changes
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Edit README.md and add notes
    • -
    • Use git status to see unstaged changes
    • -
    • Add the changed files to the staging area
    • -
    • Use git status again
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Lab 3.6: Use Git Diff

- -
    -
  • Objective: - -
      -
    • Use git diff -
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Edit README.md
    • -
    • Use git diff to compare unstaged changes
    • -
    • Add the changed file to the staging area
    • -
    • Use git diff again
    • -
    • Compare the staging area with the latest commit in .git repository -
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Exclude files with .gitignore

- -
    -
  • Build directories from source code compilation (e.g. debug, release)
  • -
  • Files generated at runtime (e.g. test results or stats)
  • -
  • User specific IDE settings
  • -
  • Local Vagrant boxes and other temporary files
  • -
- - - - -
-
- -
- -

You can use wildcard pattern matches for files. -If you'll end the string with a '/' git will only -ignore directories instead of both directories and files -matching the pattern.

- -

If you want to ignore a file globally in your repository -you can preceed the path with **/ which means any directory.

- -

Example for ignoring a debug file anywhere in your repository:

- -
**/debug
-
- -

If you prefer to keep .gitignore files in specific directories -and not a global file, this will also work.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Basics

-
- NETWAYS -
- -

Lab 3.7: Add .gitignore file and exclude files/directories

- -
    -
  • Objective: - -
      -
    • Add .gitignore file and exclude files/directories
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Create a file generated.tmp -
    • -
    • Create a directory debug with the file .timestamp -
    • -
    • Examine the state with git status -
    • -
    • Exclude them in a .gitignore file
    • -
    • Examine the state with git status -
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

4 Git Commits

- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

Git Commits

- -
    -
  • View as history log on production changes
  • -
  • Keep the subject short, simple and explaining
  • -
  • Make it easier for others understanding the changes
  • -
  • Add detailed explanations on larger changes
  • -
  • Add references to existing commits and/or ticket ids for further details
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

Work on Git History

- -
    -
  • -git commit - -
      -
    • Selected changes from the staging index
    • -
    • All changes (-a) not necessarily added to the staging index
    • -
    -
  • -
  • Verbose mode shows changes compared to latest commit (-v)
  • -
  • Uses the configured editor (vim, nano, etc.) - -
      -
    • --m allows for a short commit message without editor view
    • -
    -
  • -
- -

Commits use the user.name and user.email settings to qualify -you as the author of this change. In addition to that the date -and time is stored.

- - - - -
-
- -
- -

git commit collects and records all changes stages for commit. It uses the configured -user name and email address as commit author. This command opens the configured editor -requiring you to add a commit message.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

Lab 4.1: Commit Changes

- -
    -
  • Objective: - -
      -
    • Modify files and commit your changes
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Modify the README.md file and add more docs
    • -
    • Add the change to the changing index
    • -
    • Commit the change to your Git history with git commit -v README.md -
    • -
    -
  • -
  • Next steps: - -
      -
    • Use git log to verify the history
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

Good Commits

- -
    -
  • Selectively add changes for commit (do not commit everything) - -
      -
    • -git add for all changes in a file
    • -
    • -git add -p for interactive selection of changes in a file
    • -
    -
  • -
  • git commit <file1> <file2>
  • -
  • Enable the verbose mode -v to show the differences below the editor - -
      -
    • Write a short summary based on the visible changes
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

Commit Message Overview

- -
    -
  • Pick a short telling subject (max. 80-120 characters)
  • -
  • Add a new line
  • -
  • Add a body text explaining the issue (max. 80-120 characters in a line)
  • -
  • Optional: Add external reference markers, e.g. for ticket systems
  • -
- -

Example:

- -
A short subject for the commit line
-<newline>
-Some body text explaining the issue.
-80-120 characters max width.
-<newline>
-refs #<ticketid>
-
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

Examine the Git history

- -
    -
  • -git log - -
      -
    • Show commit history of the current branch.
    • -
    • Supports -10 notation to show a limited number of commits.
    • -
    -
  • -
- - - - -
-
- -
- -

git log shows the commit history of the current branch.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

Examine the Git history

- -
    -
  • -git show - -
      -
    • Print commit details.
    • -
    • If the commit id is omitted, the last commit is printed.
    • -
    • Supports -10 notation to show a limited number of commits.
    • -
    -
  • -
  • -git diff - -
      -
    • Show changes between working tree and last commit.
    • -
    • Supports source and target parameters.
    • -
    • Can be used to compare 2 commit ids, branches, etc.
    • -
    -
  • -
- - - - -
-
- -
- -

git show will print the last commit details. If you want to print a specific commit id, add -it afterwards.

- -

git diff shows changes between the current working tree and the last commit. You can -also compare specific commits.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

Lab 4.2: Examine the Commit History

- -
    -
  • Objective: - -
      -
    • Examine the commit history
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Add and commit remaining changes e.g. .gitignore -
    • -
    • Use git log to print the current history
    • -
    • Use git show to show specific commits (defaults to the latest)
    • -
    • Use git diff to compare changes between specific revisions
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

Advanced history with tig

- -
    -
  • -tig helps visualize history and branches
  • -
  • Inspect specific commits while scrolling
  • -
- -

-
Tig
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

Lab 4.3: Learn more about tig

- -
    -
  • Objective: - -
      -
    • Install and use tig
    • -
    -
  • -
  • Steps: - -
      -
    • Install the tig package
    • -
    • Run tig in $HOME/training -
    • -
    • Clone a different repository and run tig there e.g. $HOME/icinga2 -
    • -
    -
  • -
  • Next steps: - -
      -
    • Select a line and press Enter -
    • -
    • -q quits the detail view and the application
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

Amend changes to commits

- -
    -
  • Change the commit message, e.g. typos or missing changes broke the build
  • -
  • Amend changes from staging
  • -
  • Helps if new files were added but not committed
  • -
  • -git commit --amend changes the latest commit - -
      -
    • Amending commits in Git history is possible, explained later with git rebase.
    • -
    -
  • -
- -

If you amend changes to a specific commit, a new unique commit id is generated. -This changes the Git history and we will learn later how to resolve possible -problems in collaboration with others.

- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Commits

-
- NETWAYS -
- -

Lab 4.4: Amend changes to commits

- -
    -
  • Objective: - -
      -
    • Use git amend
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Modify README.md and add docs about amend
    • -
    • Add README.md to the staging index and commit the change
    • -
    • Edit README.md again and add it to staging
    • -
    • Use git commit --amend README.md and explain what happens
    • -
    -
  • -
  • Bonus: - -
      -
    • Adopt the commit message using git commit --amend -
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Branching

-
- NETWAYS -
- -

5 Git Branching

- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Branching

-
- NETWAYS -
- -

Working with Git branches

- -

A git branch creates a new history line starting from the current -git commit.

- -

Branches are useful to develop features/fixes in their isolated -environment.

- -
    -
  • Master branch
  • -
  • Develop a new feature in a dedicated branch
  • -
  • Put fixes into the master branch (production)
  • -
  • Continue to work on the feature
  • -
- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Branching

-
- NETWAYS -
- -

Git Branch CLI commands

- -
    -
  • -git branch - -
      -
    • List, create and delete branches.
    • -
    -
  • -
  • -git checkout - -
      -
    • Switch branches.
    • -
    • Restore the working tree.
    • -
    -
  • -
- - - - -
-
- -
- -

git branch allows you to list, create and delete branches.

- -

git checkout will switch between branches, or restore your current working tree.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Branching

-
- NETWAYS -
- -

Lab 5.1: Show the current branch

- -
    -
  • Objective: - -
      -
    • Show the current branch
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Use git branch to highlight the current branch
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Branching

-
- NETWAYS -
- -

Lab 5.2: Create and checkout a new branch

- -
    -
  • Objective: - -
      -
    • Create and checkout a new branch
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Create a new branch feature/docs based off master with git branch feature/docs master -
    • -
    • List the branches with git branch -
    • -
    • Checkout the new branch with git checkout feature/docs -
    • -
    -
  • -
  • Bonus: - -
      -
    • Explain git checkout -b feature/docs2 -
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Branching

-
- NETWAYS -
- -

Lab 5.3: Delete the branch

- -
    -
  • Objective: - -
      -
    • Delete the previously created branch
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Switch to the master branch
    • -
    • Use git branch -d to delete the selected branch
    • -
    -
  • -
  • Bonus: - -
      -
    • Try to delete the branch you are currently on
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Branching

-
- NETWAYS -
- -

HEAD and "smart pointers"

- -

A git commit is unique and identified by its SHA1 checksum.

- -

HEAD is a pointer to the latest commit in the current branch.

- -

HEAD^ identifies the second latest commit.

- -

HEAD~9 points to the tenth latest commit. Counting starts at zero.

- -

This can be used for git show. More advanced techniques will be discussed later.

- - - - -
-
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Branching

-
- NETWAYS -
- -

Lab 5.4: Show the second commit

- -
    -
  • Objective: - -
      -
    • Use HEAD and only show the second latest commit.
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Combine git show with HEAD^ or HEAD~1 -
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Branching

-
- NETWAYS -
- -

Branches and "smart pointers"

- -

feature/docs as branch name also points to the latest commit.

- -

You don't need to change branches to

- -
    -
  • show different branch histories
  • -
  • show specific commits where you don't know the commit id
  • -
  • compare branches and committed code
  • -
- -

Example:

- -
$ git show feature/docs
-commit b825ff86e4022a8fbcf52cb5a1d9a1984bd2a310 (feature/docs)
-
- - - - -
-
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Branching

-
- NETWAYS -
- -

Lab 5.5: Show history of different branch

- -
    -
  • Objective: - -
      -
    • Use git log from the master branch on another branch
    • -
    -
  • -
  • Steps: - -
      -
    • Create a new branch aside from master, if not existing: git checkout -b feature/docs -
    • -
    • Switch to the master branch
    • -
    • Use git log feature/docs -
    • -
    -
  • -
  • Bonus: - -
      -
    • Modify and commit changes
    • -
    • Diff current HEAD against feature/docs branch
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

6 Git Server

- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

Introduction

- -
    -
  • Central storage for repositories
  • -
  • Collaboration between teams
  • -
  • User based access control
  • -
  • Trigger events (e.g. for CI)
  • -
- - - - -
-
- -
- -

There is a variety of Git server tools, web interfaces -and addons out there.

- -
    -
  • GitLab
  • -
  • gitosis
  • -
  • gitolite
  • -
- -

In case you don't want to host your own Git server, -there are open source and enterprise hosting options available.

- -

NETWAYS also provides GitLab hosting services:

- - - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

Git Server Overview

- -
    -
  • Git server daemon
  • -
  • Web interfaces
  • -
  • Entire collaboration suites - -
      -
    • GitHub
    • -
    • GitLab
    • -
    • Bitbucket
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

GitLab

- -

-
GitLab
- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

GitHub

- -

-
GitHub
- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

Git Server Protocol

- -
    -
  • Read/write access via SSH - -
      -
    • git@github.com:username/repo.git
    • -
    -
  • -
  • HTTPS protocol (write access via oauth tokens) - -
      -
    • https://my-gitlab.nws.netways.de/username/repo.git
    • -
    -
  • -
  • Git protocol - -
      -
    • git://domain.com/repo.git
    • -
    -
  • -
  • Local protocol - -
      -
    • file:///opt/git/repo.git
    • -
    -
  • -
- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

GitLab Introduction

- -

GitLab is available as self-hosted or cloud based repository management -system.

- -
    -
  • Git repositories
  • -
  • User and group management and fine granular permissions
  • -
  • Issue tracking and project management (dashboards, etc.)
  • -
  • Merge, review, report
  • -
  • Continuous integration/deployment (CI/CD)
  • -
- -

Hosted: https://www.netways.de/managed_hosting/gitlab_ce_hosting/

- -

NWS: https://nws.netways.de/products/gitlab-ce

- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

GitLab Editions

- -
    -
  • Community Edition (CE), part of this training
  • -
  • Enterprise Edition (EE), additional features - -
      -
    • Multiple LDAP servers
    • -
    • LDAP group import
    • -
    • Git Hooks (not web hooks)
    • -
    • Search backend with Elasticsearch
    • -
    -
  • -
- - - - -
-
- -
- -

Overview: https://about.gitlab.com/features/ -Comparison: https://about.gitlab.com/images/feature_page/gitlab-features.pdf

- -

The source code is publicly available for both editions. -You'll need a valid license for running EE in production.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

GitLab Components

- -
    -
  • Ruby on Rails application (unicorn, sidekiq)
  • -
  • Nginx webserver
  • -
  • PostgreSQL database backend
  • -
  • Redis cache
  • -
  • NodeJS for Javascript rendering
  • -
  • Golang for background daemons
  • -
- -

It is recommended to use the Omnibus installation package or use -a managed cloud hosting service.

- - - - -
-
- -
- -

Omnibus packages: https://about.gitlab.com/installation/?version=ce

- -

More details on the manual installation instructions can be -found in the official documentation: https://docs.gitlab.com/ce/install/installation.html

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

Git Server Installation

- -

This training focuses on a pre-installed GitLab instance.

- -

Each user gets access to NWS - https://nws.netways.de -and a GitLab CE app.

- -

GitLab supports working with

- -
    -
  • SSH
  • -
  • HTTPS
  • -
- -

Manual installation instructions are provided in the -handout.

- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

Lab 6.1: Create GitLab app in NWS

- -
    -
  • Objective: - -
      -
    • Create a new GitLab app in NWS
    • -
    -
  • -
  • Steps: - -
      -
    • Navigate to https://nws.netways.de and register a trial account if not existing
    • -
    • Choose Apps > GitLab CE > Basic
    • -
    • Deploy the app
    • -
    • Choose Live View and set a secure password for the root user.
    • -
    • Login
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

Connect Local Repository to Remote Server

- -
    -
  • Local standalone repository
  • -
  • Connect to remote server
  • -
  • Clone, Pull, Fetch, Push via SSH/HTTPS
  • -
- -

You can also start fresh without any local repository -and clone that from remote.

- -

For training purposes we've started to work offline in $HOME/training. -Now we want to publish the local commits to a newly created Git repository -in GitLab.

- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

Requirements

- -
    -
  • SSH or HTTPS auth - -
      -
    • NWS apps come pre-defined with HTTPS clone/fetch only.
    • -
    -
  • -
  • New GitLab repository for this user
  • -
  • Configure local repository for the remote server
  • -
- - - - -
-
- -
- -

SSH Keys

- -

Generate a new SSH key pair on your client.

- -

-ssh-keygen -

- -

Copy the public key into your GitLab settings.

- -

-cat $HOME/.ssh/id_rsa.pub -

- -

User > Settings > SSH Keys

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

Lab 6.2: Create GitLab Project

- -
    -
  • Objective: - -
      -
    • Create a new GitLab project for the current user
    • -
    -
  • -
  • Steps: - -
      -
    • Click the + icon next to the search field
    • -
    • Choose New Project -
    • -
    • Add the name training -
    • -
    • Leave it as Private -
    • -
    • Create the project
    • -
    -
  • -
  • Note: - -
      -
    • Learn about the project view and the HTTPS clone URL
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

Lab 6.3: Configure Client Credentials Helper

- -
    -
  • Objective: - -
      -
    • Configure client credentials helper
    • -
    -
  • -
  • Steps: - -
      -
    • Run git config --global --get credential.helper -
    • -
    • Verify that it is set to /usr/libexec/git-core/git-credential-gnome-keyring on CentOS 7
    • -
    -
  • -
- -

More details can be found in your NWS GitLab app in the FAQ section on top.

- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

Lab 6.4: Add the repository as remote origin

- -
    -
  • Objective: - -
      -
    • Add the GitLab project as remote origin
    • -
    -
  • -
  • Steps - -
      -
    • Open the project in GitLab and extract the HTTPS clone URL
    • -
    • Navigate into your local repository in $HOME/training -
    • -
    • Use git remote add origin <remoteurl> -
    • -
    • Push your local history with --set-upstream (short: -u)
    • -
    -
  • -
  • Bonus - -
      -
    • Set default push method to simple -
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Server

-
- NETWAYS -
- -

Lab 6.5: Explore Project History

- -
    -
  • Objective: - -
      -
    • Learn more about GitLab and the project's history
    • -
    • Compare the local history to the remote project's history
    • -
    -
  • -
  • Steps: - -
      -
    • Click on History in the project view and examine the Git commits
    • -
    • Run git log or tig on your shell and compare them to GitLab
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Collaboration with others

-
- NETWAYS -
- -

7 Collaboration with others

- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Collaboration with others

-
- NETWAYS -
- -

Collaboration

- -
    -
  • Work locally
  • -
  • Push to remote repository
  • -
  • Share your work with others
  • -
  • Review, discuss, collaborate
  • -
  • Change, adopt, release
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Collaboration with others

-
- NETWAYS -
- -

Collaboration with others

- -
    -
  • -git fetch - -
      -
    • Update the remote branch reference pointers to the latest commit and cache it locally.
    • -
    • Does not pull in any remote commit history.
    • -
    -
  • -
  • -git pull - -
      -
    • Fetch and update the local history from remote repository (implicit fetch).
    • -
    • This pulls in source code changes and commits.
    • -
    -
  • -
- - - - -
-
- -
- -

git fetch downloads objects and references from another remote repository.

- -

git pull invokes a fetch and updates the local history with commits from the remote repository.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Collaboration with others

-
- NETWAYS -
- -

Collaboration with others

- -
    -
  • -git push - -
      -
    • Update remote references and push local history to remote repository.
    • -
    • This pushes source code changes and commits.
    • -
    • Halts if the remote history diverged from your local history.
    • -
    -
  • -
  • -git remote - -
      -
    • Configure/list remote repository URLs (default origin).
    • -
    -
  • -
- - - - -
-
- -
- -

git push updates remote references and pushes your local commit history to the remote repository.

- -

git remote allows you to configure and list the remote repository. By default this is called origin.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Collaboration with others

-
- NETWAYS -
- -

Lab 7.1: Learn more about git push

- -
    -
  • Objective: - -
      -
    • Learn more about git push
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Edit README.md and add a note on git push -
    • -
    • Add and commit the changes
    • -
    • Push the changes
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Collaboration with others

-
- NETWAYS -
- -

Lab 7.2: Learn more about git fetch and git pull

- -
    -
  • Objective: - -
      -
    • Learn more about git fetch and git pull
    • -
    -
  • -
  • Steps: - -
      -
    • Reset your local commit history by one with git reset --hard HEAD^ -
    • -
    • Fetch and pull changes from remote
    • -
    • Explain the difference
    • -
    -
  • -
  • Bonus: - -
      -
    • Repeat push and pull multiple times
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Collaboration with others

-
- NETWAYS -
- -

Git Tags

- -
    -
  • Tag specific points in history
  • -
  • Add, list, delete
  • -
  • Push tags to remote repository
  • -
  • Checkout branches based on tags
  • -
  • Release software versions based on tags (e.g. v2.9.0)
  • -
- - - - -
-
- -
- -

Example for checking out a tag into a new branch:

- -
$ git checkout -b version01 v0.1
-$ git branch
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Collaboration with others

-
- NETWAYS -
- -

Lab 7.3: Add Git Tag

- -
    -
  • Objective: - -
      -
    • Add git tag
    • -
    -
  • -
  • Steps: - -
      -
    • Use git tag and add the v0.1 tag
    • -
    • Verify the added tag with git tag -l -
    • -
    -
  • -
  • Bonus: - -
      -
    • Add a tag description with -m -
    • -
    • Push tags to remote origin with git push --tags -
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Collaboration with others

-
- NETWAYS -
- -

Advanced Git Commands

- -
    -
  • -git stash - -
      -
    • Put current changes on a temporary stack.
    • -
    -
  • -
  • -git cherry-pick - -
      -
    • Collect specific commit into your working tree.
    • -
    -
  • -
- - - - -
-
- -
- -

git cherry-pick collects a specific commit into your working tree.

- -

git stash allows you put your current changes on a temporary stack (stash). -This comes in handy when you want to change branches with a different history -where your uncommitted changes will not apply. -Use git stash pop to fetch the changes again. You can stash multiple uncommitted -stages, git stash list will list them.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Collaboration with others

-
- NETWAYS -
- -

Lab 7.4: Learn more about git stash

- -
    -
  • Objective: - -
      -
    • Learn more about git stash
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Edit README.md -
    • -
    • Examine the status with git status
    • -
    • Stash your current changes to the working directory
    • -
    • Run git status again
    • -
    • Examine the stash with git stash list and git stash show -p -
    • -
    • Fetch the previously stashed changes with git stash pop -
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Collaboration with others

-
- NETWAYS -
- -

Reset Git Commits

- -
    -
  • -git reset - -
      -
    • Remove the current commit(s).
    • -
    • ---soft adds changes to the staging index.
    • -
    • ---hard drops them indefinitely.
    • -
    -
  • -
- -

Try it out with the trainer.

- -
$ git reset --soft HEAD^
-
-$ git reset --hard HEAD^
-
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

8 Git Workflows

- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Git Workflows

- -
    -
  • Single user environments
  • -
  • Multiple users working together
  • -
  • Branching models
  • -
  • Patch and pull request workflow integration
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Centralized Workflow

- -
    -
  • Multiple users
  • -
  • Each user has a local copy
  • -
  • Central master branch
  • -
- -

-
Centralized Workflow
- - - - -
-
- -
- -

Compared to other VCS systems, Git provides the advantage of -also storing a local copy of the repository and branches.

- -

That way a developer can work isolated on changes on its own -while other developers can do the same. These isolated environments -ensure that each developers works independantly from other -changes in the project.

- -

In addition to that the Git branching model provides a fail-safe mechanism -for integrating and sharing code changes between repositories.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Centralized Workflow - Developers

- -
    -
  • Developers clone the central repository
  • -
  • Work in local copies
  • -
  • New commits are stored locally
  • -
  • Importing the remote repository's changes is optional
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Centralized Workflow - Publish Changes

- -
    -
  • Developers push their local master branch
  • -
  • Stored in central repository
  • -
  • Adds all local commits that are not in the central master branch
  • -
- -

-
Centralized Workflow
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Centralized Workflow - Managing Conflicts

- -
    -
  • Central repository's commit history is important
  • -
  • If local commit history diverges, pushing changes is denied
  • -
- -

-
Centralized Workflow
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Lab 8.1: Collaborate in a central repository

- -
    -
  • Objective: - -
      -
    • Clone the training repository twice and add diverging commits
    • -
    -
  • -
  • Steps: - -
      -
    • Clone the training.git repository into $HOME/training1 and $HOME/training2 -
    • -
    -
  • -
  • Steps for both: - -
      -
    • Change into each directory
    • -
    • Add/modify a file and commit the change
    • -
    • Push your change to the remote repository
    • -
    -
  • -
  • Explain the error message after the second push
  • -
- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Centralized Workflow - Managing Conflicts Solution

- -
    -
  • Fetch the remote history
  • -
  • Rebase local changes on top of it
  • -
  • Linear history
  • -
- -

-
Centralized Workflow
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Lab 8.2: Resolve conflicts in a central repository

- -
    -
  • Objective: - -
      -
    • Rebase your local history with the remote repository
    • -
    -
  • -
  • Steps: - -
      -
    • Reset the local history by 2 commits with git reset --hard HEAD~2 -
    • -
    • Update and commit README.md
    • -
    • Fetch remote and compare with git diff origin/master -
    • -
    • Rebase with git rebase origin/master -
    • -
    • Resolve possible merge conflicts, add them and continue with git rebase --continue, push rebased history
    • -
    -
  • -
- -

Hint: >>> marks conflicts and show the differences on merge.

- - - - -
-
- -
- -

Instead of git fetch and git rebase you can also use -the git pull command with the additional --rebase flag. -This helps if you are familiar with SVN and svn update.

- -

If you forget the --rebase flag it will still work -but generate merge commits. This will merge your commits -in historical order but not rebase them on top of the existing -history.

- -

For using a centralized workflow it is better to use rebase -instead of generating a merge commit.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Feature Branch Workflow

- -
    -
  • Feature development happens in named branches
  • -
  • Does not interfere with the main codebase
  • -
  • Master branch does not contain broken code
  • -
  • Feature branches can be rebased against stable master branch on demand
  • -
- -

-
Feature Branch Workflow
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Feature Branch Workflow - How it works

- -
    -
  • Central repository
  • -
  • Create a new branch for each feature
  • -
  • Descriptive branch names, e.g. feature/docs-workflows -
  • -
  • Changes in a feature branch similar to centralized workflow
  • -
  • Push feature branches to central repository for collaboration with other developers
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Lab 8.3: Use Feature Branches

- -
    -
  • Objective: - -
      -
    • Create a new feature branch feature/docs-workflows -
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Use git checkout -b feature/docs-workflows to create a new feature branch based on the master
    • -
    • Add and commit changes
    • -
    • Push the branch to your central repository
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Lab 8.4: Merge Feature Branches

- -
    -
  • -

    Objective:

    - -
      -
    • Update master branch and merge feature branch feature/docs-workflows -
    • -
    -
  • -
  • -

    Steps:

    - -
      -
    • Checkout the feature branch feature/docs-workflows -
    • -
    • Edit README.md, add and commit the changes
    • -
    • Diff the feature branch to the current master with git diff master -
    • -
    • Checkout the master branch, merge the feature branch as non-fast-forward with --no-ff -
    • -
    • Show the history tree with tig or inside GitLab and explain why the forced merge commit with --no-ff is important
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Gitflow Workflow

- -
    -
  • Strict branching model for project releases
  • -
  • Based on Feature Branch Workflow
  • -
  • Assigns roles to different branches
  • -
  • Defines interaction between branches for releases - -
      -
    • Prepare
    • -
    • Maintain
    • -
    • Record
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Gitflow Workflow

- -

-
Gitflow Workflow
- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Gitflow Workflow - Historical Branches

- -
    -
  • Master branch for release history (including version tags)
  • -
  • Master branch is always stable and in production
  • -
  • Develop branch for feature integration
  • -
- -

-
Gitflow Workflow
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Gitflow Workflow - Feature Branches

- -
    -
  • New features in their own branches
  • -
  • Feature branches use develop as their parent branch
  • -
  • Once completed, merged back to develop -
  • -
- -

-
Gitflow Workflow
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Gitflow Workflow - Release Branches

- -
    -
  • Enough features in develop: release branch based on develop -
  • -
  • Ready to ship: merged to master and tagged with version
  • -
- -

-
Gitflow Workflow
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Gitflow Workflow - Maintenance Branches

- -
    -
  • Fixes based on master -
  • -
  • Merged to master, tagged and merged to develop -
  • -
- -

-
Gitflow Workflow
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Forking Workflow with GitHub/GitLab

- -
    -
  • Every developer has - -
      -
    • a server-side repository
    • -
    • a private repository as copy of the server-side repo
    • -
    -
  • -
  • Developers push their own server-side repository
  • -
  • Project maintainer pushes to official repository
  • -
- -

-
Forking Workflow
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Forking Workflow - How it works

- -
    -
  • Developers fork, commit and push into their own repository
  • -
  • Developers create a Pull Request for the official repository, CI triggers automated tests for the PR
  • -
  • Developers/Maintainers review and merge PR, CI triggers deployment task
  • -
- -

-
GitHub Workflow
- - - - -
- - -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Forking Workflow - Multiple Remote Repositories

- - - -

Example:

- -
$ git remote -v
-origin  git@github.com:dnsmichi/icinga2.git (fetch)
-origin  git@github.com:dnsmichi/icinga2.git (push)
-upstream    https://github.com/icinga/icinga2.git (fetch)
-upstream    https://github.com/icinga/icinga2.git (push)
-
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

GitHub/GitLab Workflow - Keep in Sync

- -
    -
  • Pull changes from upstream HEAD to own repository master branch to sync development
  • -
  • Remote HEAD is the default branch for this repository, usually master -
  • -
  • Remember, HEAD is just a smart pointer. You can use a branch name too.
  • -
- -

Example:

- -
$ git checkout master
-$ git fetch upstream
-$ git pull upstream HEAD
-$ git push origin master
-
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Lab 8.5: Create Merge Request

- -
    -
  • -

    Objective:

    - -
      -
    • Create merge request from feature branch
    • -
    -
  • -
  • -

    Steps:

    - -
      -
    • Change into $HOME/training -
    • -
    • Create the branch feature/docs-merge-request -
    • -
    • Edit README.md, add, commit and push the changes
    • -
    • Open the proposed GitLab URL in your browser
    • -
    • Fill in the merge request and submit it
    • -
    • Simulate a review and merge it
    • -
    • Pull changes to local master branch and use tig -
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Practical Examples for Git Workflows

- -

If you are using GitHub/GitLab repositories, use forking and pull/merge requests.

- -

Smart adoptions of the Gitflow workflow could include the following:

- -
    -
  • development branch (master)
  • -
  • release branches (support/<version>)
  • -
  • Fix and feature branches are based off the master branch
  • -
  • Bugfixes are cherry-picked into the release branches
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

More Hints: Rebase and Squash

- -

The git rebase command can also be used to perform certain -actions on a specific commit history.

- -

If you are contributing to open source projects developers -might ask you to either rebase your history or even squash -all commits into one commit.

- -
commit1  => commit
-commit2
-commit3
-
- -

Ask the trainer to draw an image for better illustration and discussion.

- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Lab 8.6: Rebase and squash commits

- -
    -
  • Objective: - -
      -
    • Rebase and squash commits
    • -
    -
  • -
  • Steps: - -
      -
    • Add 3 commits to your history
    • -
    • Use git rebase -i HEAD~3 to start the interactive mode. HEAD~3 takes the last 3 commits compared to current HEAD.
    • -
    • Use pick for the top commit
    • -
    • Replace pick with squash for the other commits
    • -
    • Save and edit the final commit message
    • -
    • Use git log to verify the history
    • -
    -
  • -
  • Bonus: - -
      -
    • Push the changed commit history using git push -f and explain what happens
    • -
    -
  • -
- - - - -
-
- -
- -

git rebase can also be used to edit the commits in your history. -This is helpful if you want to amend changes to the test commit. Or if -they are missing issue references, or just contain wrong information.

- -

This is a common scenario for code reviews before merging the actual -history into the development branches.

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

More Hints: Delete Remote Branches

- -

You have learned that you can create remote (feature) branches. But what if -you want to delete such branches?

- -

git push origin <branch> is short for git push origin <localbranch>:<remotebranch>.

- -

Pushing NULL into a remote branch will delete it.

- -

git push origin :<remotebranch>

- -

Hint: You can delete branches in GitLab/GitHub too.

- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Workflows

-
- NETWAYS -
- -

Lab 8.7: Delete remote branch

- -
    -
  • Objective: - -
      -
    • Delete remote branch
    • -
    -
  • -
  • Steps: - -
      -
    • Change into $HOME/training -
    • -
    • Create or identify a remote branch feature/docs-wrong-name -
    • -
    • Delete the remote branch
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Integrations

-
- NETWAYS -
- -

9 Git Integrations

- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Integrations

-
- NETWAYS -
- -

Git Integrations

- -
    -
  • Ticket system integration
  • -
  • Continuous integration (Jenkins, Travis)
  • -
  • Puppet environments
  • -
  • Git Hooks
  • -
  • Development workflow
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Integrations

-
- NETWAYS -
- -

Git Hooks

- -
    -
  • Client or server-side scripts
  • -
  • Conditional execution (update, post-receive, etc.)
  • -
  • Integration with external tools
  • -
  • Web hooks available in GitLab, GitHub, etc.
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Integrations

-
- NETWAYS -
- -

Client Hooks

- -
    -
  • pre-commit
  • -
  • pre-rebase
  • -
  • post-checkout
  • -
  • post-merge
  • -
  • Useful to - -
      -
    • Preserve file modes
    • -
    • Check code style/syntax
    • -
    -
  • -
- - - - -
-
- -
- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Integrations

-
- NETWAYS -
- -

Server-side Hooks

- -
    -
  • pre-receive - -
      -
    • Deny non-fast-forward pushes
    • -
    -
  • -
  • post-receive - -
      -
    • After everything is updated
    • -
    • Notify external tools (Mail, IRC, Jenkins, etc.)
    • -
    -
  • -
  • update - -
      -
    • Check branch permissions
    • -
    -
  • -
- - - - -
-
- -
- -

Server-side hooks receive the arguments through STDIN in the following -format:

- -
oldref newref refname
-
- -

Example:

- -
aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
-
- -

Example for a simple post-receive demo hook:

- -

``` -$ vim post-receive

- -

!/bin/bash

- -

oldref newref refname

- -

read line -set -- $line

- -

print the commits between oldref and newref and count the lines

- -

num=$(git log --pretty=oneline ${1}..${2}| wc -l)

- -

echo "New ref name '${3}' created. Pushed ${num} commits. Old ref '${1}' to new ref '${2}'." -exit 0

- -

$ chmod +x post-receive -```

- -

Test on the client:

- -

``` -$ whoami -$ cd $HOME/training.git -$ echo "1" > hooktest -$ git add hooktest -$ git commit -av -m "1. hooktest" -$ echo "2" >> hooktest -$ git commit -av -m "2. hooktest"

- -

$ git log -$ git push -... -remote: New ref name 'refs/heads/master' created. Pushed 2 commits. Old ref ... to new ref ... . -```

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Integrations

-
- NETWAYS -
- -

Web Hooks

- -
    -
  • HTTP Callback
  • -
  • Limit on event, e.g. push, merge, comment, etc.
  • -
  • Integrate test and deployment services - -
      -
    • Travis CI
    • -
    • Jenkins
    • -
    -
  • -
  • Chat bot integration - -
      -
    • Rocket.Chat
    • -
    • Slack
    • -
    -
  • -
- - - - -
-
- -
- -

Reference example (German): https://blog.netways.de/2016/06/29/gitlab-webhooks/

- -

Travis CI does not integrate well with GitLab, they prefer GitHub.

- -

Jenkins

- -

Jenkins builds with web books: https://github.com/jenkinsci/gitlab-plugin/wiki/Setup-Example

- -

Rocket.Chat

- -

Rocket.Chat web hook integration: https://rocket.chat/docs/administrator-guides/integrations/gitlab/

- -

Slack

- -

Official GitLab Slack integration: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/user/project/integrations/slack.md

- -

Try it out

- -

Both Rocket.Chat and GitLab are available at NWS:

- - - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Integrations

-
- NETWAYS -
- -

Puppet Environments

- -
    -
  • Multiple Puppet environments (prod, stage, ...)
  • -
  • Git branches for each environment
  • -
  • Different module versions and configuration for each environment
  • -
  • Automated deployment with r10k
  • -
- -

r10k is a toolset provided by Puppet for deploying environments and modules.

+
- - - -
-
+

Show the current branch


-

Reference blog post (German): https://blog.netways.de/2014/11/07/git-workflow-bei-puppet-mit-r10k/

- -

Puppet environments and r10k are part of the "Scaling Puppet" training: -https://www.netways.de/en/events_trainings/puppet_trainings/scaling_puppet/

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Integrations

-
- NETWAYS -
+

Example

-

Puppet Environments: r10k

+
$ cd $HOME/training
 
-

-
r10k
+$ git branch +* master
-
-
-

~~~SECTION:MAJOR~~~ Git Integrations

+
+
- NETWAYS + NETWAYS Training
-

IDEs

- -
    -
  • Atom
  • -
  • JetBrains PHPStorm, ...
  • -
  • Visual Studio
  • -
  • Eclipse
  • -
  • vim
  • -
- - - - -
-
+

Lab 5.2: Proposed Solution


- - -
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Integrations

-
- NETWAYS -
- -

Atom

- -
    -
  • Line diffs, tree view, etc.
  • -
  • Default editor for command line commits
  • -
  • GitHub integration with Pull Requests
  • -
- -

-
Atom
- +

Create and checkout a new branch

+
- -
-
+

Create the branch

-
+
$ cd $HOME/training
 
-

References:

+$ git branch feature/docs master
-

http://blog.atom.io/2014/03/13/git-integration.html -http://blog.atom.io/2017/05/16/git-and-github-integration-comes-to-atom.html

+

List the branches

-
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Integrations

-
- NETWAYS -
+
$ git branch
+* master
+  feature/docs
-

JetBrains

+

Checkout the created branch

-
    -
  • Status and change tracking
  • -
  • Add, commit, fetch, push, pull, etc.
  • -
  • GitHub integration
  • -
+
$ git checkout feature/docs
+$ git branch
+  master
+* feature/docs
-

-
PHPStorm
+

Use it all at once

+

git checkout -b creates a new branch from the current branch +and does the checkout afterwards. That way you'll safe some time +when working with branches quite often.

+
$ git checkout master
+$ git checkout -b feature/docs2
+

Open Source Training

+

by NETWAYS (netways.de)

-
-
-
-

~~~SECTION:MAJOR~~~ Git Integrations

+
+
- NETWAYS + NETWAYS Training
-

Visual Studio

- -
    -
  • Git for Windows bundled in 2015+
  • -
  • Native GUI integration
  • -
- -

-
Visual Studio
- - - - -
-
+

Lab 5.3: Proposed Solution


-

References:

+

Delete the branch

- +
-
- -
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

-
- NETWAYS -
+

Checkout the master branch

-

10 Continuous Integration

+
$ cd $HOME/training
 
-
-
- -
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

-
- NETWAYS -
+$ git checkout master
-

Continuous Integration

+

Delete the previously created branch

-
    -
  • Immediately test changes in feature branches
  • -
  • Code quality checks
  • -
  • Deploy branches into environments (dev, staging, production)
  • -
  • Visualize failures and notify users
  • -
  • Reporting
  • -
+
$ git branch -d feature/docs2
+

Try to delete the current branch

+
$ git checkout master
+$ git branch -d master
+

Open Source Training

+

by NETWAYS (netways.de)

-
- -
-
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

+
+
- NETWAYS + NETWAYS Training
-

Continuous Integration: Overview

- -
    -
  • Travis CI
  • -
  • Jenkins
  • -
  • GitLab CI
  • -
- - - - -
-
+

Lab 5.4: Proposed Solution


-
- -
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

-
- NETWAYS -
- -

Continuous Integration: Travis CI

- -
    -
  • Cloud based CI system
  • -
  • Supports Ubuntu 14.04 LTS and macOS
  • -
  • Code and unit tests
  • -
  • Test multiple PHP, Perl, etc. versions at once
  • -
  • Easy to integrate into GitHub projects
  • -
  • De-facto standard for Open Source projects hosted on GitHub
  • -
- - - - -
-
+

Show the second commit


-
- -
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

-
- NETWAYS -
- -

Travis CI Example

- -
$ cat .travis.yml
+

Example

-language: php +
$ cd $HOME/training
 
-php:
-  - '7.1'
-
-branches:
-  only:
-  - master
-
-script:
-  - php phpunit.phar -c modules/test/phpunit.xml --verbose
-
+@@@ Sh +$ git show HEAD^
+

or

+
$ git show HEAD~1
-
-
- -
-
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

+
+
- NETWAYS + NETWAYS Training
-

Continuous Integration: Jenkins

- -
    -
  • Self-hosted application
  • -
  • Jobs
  • -
  • Push trigger or time-based cronjobs
  • -
  • Build pipelines
  • -
  • Build agents for Linux/Unix, Windows, etc.
  • -
  • Written in Java
  • -
  • Many plugins available
  • -
- - - - -
-
+

Lab 5.5: Proposed Solution


-
- -
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

-
- NETWAYS -
- -

Jenkins Workflow

- -
    -
  • Trigger build jobs from git commits
  • -
  • Start build jobs from specific branches (e.g. daily snapshots)
  • -
  • Run tests which update your ticket system
  • -
  • Build packages and deploy them into your repository
  • -
- -

-
Git CI Jenkins
- - - - -
-
+

Show history of different branch


-

Adding Jenkins to your Git workflow requires additional toolsets.

+

Create a new branch

-

A Git hook configured on the git server is able to trigger a Jenkins job. -It passes the git commit id to the Jenkins job which runs a local git checkout -and further job actions afterwards, for example tests and/or package builds.

+
$ git checkout master
+$ git checkout -b feature/dpcs
-

Vice versa a Jenkins build job hook needs to update the ticket system. This will -notify the user of an unsuccessful run immediatly allowing further actions.

+

Switch to the master branch

-

The issue id can be for example passed from the git hook into the Jenkins job. -This requires strict rules on git commits - a git commit without any referenced -issue id will destroy this workflow.

+
$ git checkout master
-

Define and document a git commit format specification and enforce this -to your users. In addition to that install a git hook on the server -which rejects a git push when the commit is missing an issue id.

+

Show the history of the other branch

-
- -
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

-
- NETWAYS -
+
$ git show feature/docs
-

Continuous Integration: GitLab CI

+

Commit change on master

-
    -
  • Build Pipelines
  • -
  • Natively integrated into GitLab
  • -
  • Invokes GitLab Runners
  • -
  • Local container registry for runners
  • -
+
$ echo "I understand HEAD now" >> README.md
+$ git add README.md
+$ git commit -v README.md -m "What I've learned so far: HEAD"
+

Show diff between HEAD and branch

+
$ git diff HEAD feature/docs
-
-
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

+
+
- NETWAYS + NETWAYS Training
-

GitLab CI: Introduction

- -
    -
  • -.gitlab-ci.yml configuration file in Git repository
  • -
  • Runner is triggered on specific events, e.g. git push -
  • -
  • Jobs can be run on-demand
  • -
  • Built-in and external runners
  • -
  • Container registry enabled for the project (optional)
  • -
- - - - -
-
+

Lab 6.1: Proposed Solution


-

Documentation references:

- -

https://docs.gitlab.com/ce/user/project/container_registry.html

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

-
- NETWAYS -
- -

GitLab Runners

- -
    -
  • Written in Go
  • -
  • Linux/Unix, macOS, Windows, Docker support
  • -
  • Run multiple jobs in parallel
  • -
  • Run jobs locally, in Docker containers, remote via SSH
  • -
  • Can run Bash, Windows Batch/Powershell
  • -
- - - - -
-
+

Create a new GitLab app in NWS


-

Documentation reference: https://docs.gitlab.com/runner/

- -
- -
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

-
- NETWAYS -
- -

GitLab Runners: Installation and Configuration

- -
    -
  • Separate server
  • -
  • Installation via package repository
  • -
  • gitlab-runner register
  • -
- -

Note: This is not needed for the built-in docker executor runner.

- +

Open https://nws.netways.de in your browser and register your +personal account. Login and navigate to Apps > GitLab CE > Basic +and deploy the app.

+

Use Live View and set a secure root password. The login into GitLab.

+

Open Source Training

+

by NETWAYS (netways.de)

-
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

+
+
- NETWAYS + NETWAYS Training
-

GitLab CI: Container Registry

- -
    -
  • Enable the Container Registry (administration server setting)
  • -
  • Enable the Container Registry for the project
  • -
  • Advanced usage only
  • -
- +

Lab 6.2: Proposed Solution

+
- -
-
+

Create a new GitLab project for the current user


-

```

+

Add Project

+ +

GitLab 10.x provides New Project underneath the + icon +in the top menu bar, next to the search form.

-

vim /etc/gitlab/gitlab.rb

+

Fill in the Project name form with training and leave the +other options as default.

-

registry_external_url 'https://gitlab.example.com:5000'

+

Project View

-

gitlab-ctl reconfigure

+

You'll notice the HTTPS URL centered below the project name.

-

```

+

We will be using this remote URL for connecting our local repository +in the next step.

-

Documentation References:

+

Right now the repository is empty and does not contain any file. +GitLab offers you to add new files, e.g. a README.md file or LICENSE details +directly in the browser. In the background, it is still comitting +the changes to the Git repository.

-

https://docs.gitlab.com/ce/user/project/container_registry.html -https://docs.gitlab.com/ce/administration/container_registry.html -

+
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

+
+
- NETWAYS + NETWAYS Training
-

GitLab CI: Docker, Containers - how to use it

+

Lab 6.3: Proposed Solution

-
    -
  • Run an application in an isolated environment
  • -
  • Layered images providing additional libraries and tools, e.g. base linux, mysql, apache, ruby
  • -
  • Start container, run tests, return results
  • -
  • Light-weight and fast, can run on each Git push
  • -
  • Reliable same run each time, container is destroyed on stop
  • -
+
+

Configure client credentials helper

+
- -
-
+

Verify and set

-
+
$ git config --global --get credential.helper
+/usr/libexec/git-core/git-credential-gnome-keyring
-

Documentation References:

+

If not set, you can set it explicitly.

-

https://docs.docker.com

+
$ git config --global credential.helper /usr/libexec/git-core/git-credential-gnome-keyring
+
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

+
+
- NETWAYS + NETWAYS Training
-

GitLab CI: Docker and CI Runners

- -

-
GitLab CI Runners Docker
- +

Lab 6.4: Proposed Solution

+
- -
-
+

Add the repository as remote origin


-

Documentation References:

+

Add the remote origin

-

https://docs.docker.com -https://docs.gitlab.com/runner/install/docker.html

+
$ cd $HOME/training.git
+$ git remote add origin https://[...].nws.netways.de/root/training.git
+$ git fetch
-
- -
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

-
- NETWAYS -
+

Push the history

-

Lab 10.1: Inspect CI Runner settings

+
$ git push
-
    -
  • Objective: +

    This will not work since the local branch does not follow the remote branch. +Use --set-upstream as proposed by the cli output. Short form is -u.

    -
      -
    • Inspect CI Runner Settings
    • -
    -
  • -
  • Steps: +
    $ git push --set-upstream origin master
    -
      -
    • Navigate to Admin > Overview > Runners
    • -
    • Inspect the token
    • -
    • Check existing runners
    • -
    -
  • -
+

Set default push method

+

Git versions prior 2.0 did not define the default push method. The default behaviour +was to use the same local branch name for the remote branch name.

+

The new default method should be simple which ensures that the local branches +will only be pushed to remote branches which git pull is following.

- -
-
+

Our setup did not clone the repository (which includes a virtual git pull). Therefore +the local master branch does not follow a remote branch.

-
+

In order to fix that, add the default push method to your global configuration.

-

Reference: https://gitlab.com/gitlab-org/gitlab-runner/blob/master/docs/install/linux-repository.md

+
git config --global push.default simple
+
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

+
+
- NETWAYS + NETWAYS Training
-

GitLab CI: Configuration in .gitlab-ci.yml

+

Lab 6.5: Proposed Solution

-
    -
  • -image as container base image
  • -
  • -services which should be running
  • -
  • -all_tests as job name
  • -
+
-

Example:

+

Examine GitLab's project history

-
image: alpine:latest
+
-all_tests: - script: - - exit 1 -
+

Project History

+

Choose History and look at the Git commits, their author, subject and timestamp.

+

Compare it with the local git log or tig entries.

+
+
+
+
+
+ NETWAYS Training
-
+ +

Lab 7.1: Proposed Solution


-

Documentation References:

+

Learn more about git push

-

https://about.gitlab.com/2016/03/01/gitlab-runner-with-docker/

+
-
- -
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

-
- NETWAYS -
+

Make changes

-

Lab 10.2: Create .gitlab-ci.yml

+
$ cd $HOME/training
+$ git checkout master
 
-
    -
  • Objective: +$ vim README.md -
      -
    • Create CI configuration for the training project
    • -
    -
  • -
  • Steps: +Now I know how to publish my changes to my NWS hosted GitLab server. -
      -
    • Create the .gitlab-ci.yml file in the training directory (vim, nano, etc.)
    • -
    • Add image: alpine/latest to specify base image
    • -
    • Add job all_tests with script as array element, which itself runs exit 1 -
    • -
    -
  • -
+$ git add README.md +$ git commit -v README.md -m "Add docs for git push"
+

Push changes

+
$ git push origin master
-
-
- -
-
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

+
+
- NETWAYS + NETWAYS Training
-

Lab 10.3: Push to GitLab

+

Lab 7.2: Proposed Solution

-
    -
  • Objective: +
    -
      -
    • Add .gitlab-ci.yml to Git and push to GitLab
    • -
    -
  • -
  • Steps: +

    Learn more about git fetch and git pull

    -
      -
    • Use git add .gitlab-ci.yml and commit the change
    • -
    • Push the commit into the remote repository
    • -
    • Navigate to the project into CI / CD and verify the running job
    • -
    -
  • -
  • Bonus +
    -
      -
    • Modify the exit code to 0, add, commit, push and verify again
    • -
    -
  • -
+

Reset your local commit history by one

+
$ git log
+$ git reset --hard HEAD^
+$ git log
+

Fetch changes

- -
-
+
$ git fetch
-
+

Compare this with your local commit history - you'll see that there are +not changes pulled yet.

+ +
$ git log
+ +

Pull changes

+ +
$ git pull
+

Check the local commit history - now your local history has been +updated with the remote history.

+ +
$ git log
+ +
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

+
+
- NETWAYS + NETWAYS Training
-

GitLab CI: .gitlab-ci.yml Templates

+

Lab 7.3: Proposed Solution

- +

Add git tag

+
+

Add tag

- -
-
+
$ git log
+$ git tag -m "Release v0.1" v0.1
-
+

Verify tag

-

Documentation References:

+
$ git tag -l
-

https://docs.gitlab.com/ce/ci/README.html#examples

+

Push tags to remote origin

-

https://gitlab.com/gitlab-org/gitlab-ci-yml

+
$ git push --tags
+
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

+
+
- NETWAYS + NETWAYS Training
-

Lab 10.4: Practical Example for CI Runners: Preparations

+

Lab 7.4: Proposed Solution

-
    -
  • Objectives: +
    -
      -
    • Prepare container to convert Markdown to HTML
    • -
    -
  • -
  • Steps: +

    Learn more about git stash

    -
      -
    • Modify .gitlab-ci.yml and add a before_script section after the image section
    • -
    • Update apk package manager and install python and py-pip packages
    • -
    • Use pip to install the markdown and Pygments libraries
    • -
    • Commit and push the changes
    • -
    -
  • -
+
-

Example:

+

Edit README and add docs

-
before_script:
-  - apk update && apk add python py-pip
-  - pip install markdown Pygments
-
+
$ cd $HOME/training
+$ vim README.md
 
+Now I am learning how to use git stash and temporarily drop the changes
+e.g. to change into another branch.
+

Examine the state with git status

- -
-
+
$ git status
-
+

Stash changes

-

The base image uses Alpine Linux which has a very small installation size -and footprint.

+
$ git stash
+Saved working directory and index state WIP on master: 31dcde5 Add docs for git push
+HEAD is now at 31dcde5 Add docs for git push
-

In contrast to the "typical" Linux distribution containers, this allows for -faster tests and deployment scripts.

+

Examine the state with git status

-

If your build pipeline involves specific distributions, choose the best and -reliable container distribution you prefer.

+
$ git status
+On branch master
+nothing to commit, working tree clean
-

Alpine uses its own package manager. This exercise installs

+

Examine the stash list

-
    -
  • Python and its package manager pip -
  • -
  • Markdown conversion packages for Python
  • -
+
$ git stash list
+stash@{0}: WIP on master: 31dcde5 Add docs for git push
+
+@@@ Sh
+$ git stash show -p
+
+diff --git a/README.md b/README.md
+index 2081a37..550db95 100644
+--- a/README.md
++++ b/README.md
+@@ -15,3 +15,7 @@ Now for real.
+ ```
+ git commit --amend
+ ```
++
++## Git Stash
++
++`git stash`
-

Reference: https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management

+

Fetch previously stashed changes

+
$ git stash pop
+
+Dropped refs/stash@{0} (a9f28340e6d536a9179307bd26169368e450161f)
+ +
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

+
+
- NETWAYS + NETWAYS Training
-

Lab 10.5: Practical Example for CI Runners: Create Docs

+

Lab 8.1: Proposed Solution

-
    -
  • Objective: - -
      -
    • Create HTML docs from Markdown
    • -
    -
  • -
  • Steps: +
    -
      -
    • Add a new markdown and use script to generate README.html -
    • -
    • Add archifacts with paths pointing to README.html. Expires in 1 week -
    • -
    • Commit and push the changes, then download and view the README.html file in your browser
    • -
    -
  • -
+

Clone the training repository twice and add diverging commits

-

Example:

+
-
markdown:
-  script:
-    - python -m markdown README.md > README.html
-  artifacts:
-    paths:
-    - README.html
-    expire_in: 1 week
-
+

Clone the central repository

+

The last parameter specifies the target directory training1.

+
$ cd $HOME
+$ git clone https://[...].nws.netways.de/root/training.git training1
- -
-
+

Add/modify a file

-
+
$ echo "My Name" > AUTHORS
-
- -
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

-
- NETWAYS -
+

Commit the change

-

Lab 10.6: Practical Example for CI Runners: Update Docs

+
$ git add -A .
+$ git commit -av -m "Add myself to AUTHORS"
-
    -
  • Objective: +

    Push the changes to the remote repository

    -
      -
    • Add what you have learned so far into README.md and generate docs
    • -
    -
  • -
  • Steps: +
    $ git push origin master
    -
      -
    • Edit README.md -
    • -
    • Commit and push changes
    • -
    • Download and view the README.html file in your browser
    • -
    -
  • -
+

Repeat these steps with training2

+

The last parameter specifies the target directory training2.

+
$ cd $HOME
+$ git clone https://[...].nws.netways.de/root/training.git training2
-
-
- -
-
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

+
+
- NETWAYS + NETWAYS Training
-

GitLab Pipelines

+

Lab 8.2: Proposed Solution

-

Code => Build => Test => Deploy

+
-
    -
  • Encapsulate QA steps into pipelines
  • -
  • Visible which pipeline is affected
  • -
  • Halt if one step is failing
  • -
  • Direct feedback to developers
  • -
  • CI and CD +

    Rebase your local history with the remote repository

    -
      -
    • Continuous Integration
    • -
    • Continuous Delivery
    • -
    -
  • -
+
+

Reset the history by 2 commits

+
$ git reset --hard HEAD~2
- -
-
+

Update and commit README.md

-
+
$ vim README.md
 
-

Reference: https://docs.gitlab.com/ce/ci/pipelines.html

+Testing rebase -
- -
-
-
-

~~~SECTION:MAJOR~~~ Continuous Integration

-
- NETWAYS -
+$ git add README.md +$ git commit -v README.md "Rebase test"
-

GitLab Pipelines: Example

+

Fetch and diff the remote changes

-

-
GitLab Pipelines
+
$ git fetch
 
+$ git diff origin/master
+

Rebase your local history

- -
-
+

Rebase your local history against the remote origin master branch.

-
+
$ git rebase origin/master
-
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Hints

-
- NETWAYS -
+

Resolve merge probblems

+ +
$ git status
+$ vim README.md
-

11 Git Hints

+

Search for conflicts in vim:

+ +
/>>>
+
+ +

Resolve the conflicts, add the file and continue the rebase.

+ +
$ git add README.md
+$ git rebase --continue
+ +

Push the changes to the remote repository

+ +
$ git push origin master
+
-
-
-

~~~SECTION:MAJOR~~~ Git Hints

+
+
- NETWAYS + NETWAYS Training
-

Best Practices

+

Lab 8.3: Proposed Solution

-
    -
  • Ensure to set user configuration (name, email)
  • -
  • Always keep good commits in mind
  • -
  • Do not commit all changes at once
  • -
  • Work with branches if applicable
  • -
  • Avoid merge commits, fetch and rebase your history
  • -
+
+

Use Feature Branches

+
- -
-
+

Create a new branch

-
+

The new branch feature/docs-workflows will be based on the master branch.

-
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Hints

-
- NETWAYS -
+
$ cd $HOME/training
+$ git checkout master
+$ git checkout -b feature/docs-workflows
-

Hints for details and tests

+

Add and commit changes

-
    -
  • verbose mode for cli commands: -v -
  • -
  • test-drive but don't change anything: --dry-run -
  • -
+
$ vim README.md
 
+## Workflows
 
+Central Workflow and now feature workflows with descriptive branch names.
 
-
-
-
+$ git add README.md +$ git commit -v README.md -m "Update docs for Git workflows" -
+

Push your feature branch

+
$ git push -u origin feature/docs-workflows
+ +
-
-
-

~~~SECTION:MAJOR~~~ Git Hints

+
+
- NETWAYS + NETWAYS Training
-

Debugging

+

Lab 8.4: Proposed Solution

-
    -
  • -git bisect +
    -
      -
    • Binary search for commits causing a bug
    • -
    -
  • -
  • -git blame +

    Merge Feature Branches

    -
      -
    • Open editor with commit/author/date addition
    • -
    -
  • -
  • -git grep +
    -
      -
    • Search for pattern in commit history
    • -
    -
  • -
+

Checkout the feature branch and add a commit

+ +
$ cd $HOME/training
+$ git checkout feature/docs-workflows
+$ vim README.md
+
+I'm learning about workflows today.
+
+$ git add README.md
+$ git commit -v README.md -m "Update docs for workflows"
+$ git push origin feature/docs-workflows
+ +

Checkout the feature branch and compare it with the master branch

+
$ git branch
+$ git checkout feature/docs-workflows
+$ git diff master feature/docs
+

Checkout the master and merge the feature branch

- -
-
+
$ git checkout master
+$ git merge --no-ff feature/docs-workflows
 
-
+In this commit message, I may add a reference to a GitLab issue like this +to automatically resolve it after merge. -

git bisect can be used to invoke a binary search to find the commit that introduced a bug.

+fixes #12
-

git blame prints a file and each line changed by the latest commit and author.

+

Examine the history

-

git grep prints all lines from the commit history matching a pattern.

+
$ tig
+
-
-
-

~~~SECTION:MAJOR~~~ Git Hints

+
+
- NETWAYS + NETWAYS Training
-

Lab 11.1: Use Git Blame

+

Lab 8.5: Proposed Solution

-
    -
  • Objective: +
    -
      -
    • Use git blame -
    • -
    -
  • -
  • Steps: +

    Merge Feature Branches

    -
      -
    • Pick a file from your local git repository
    • -
    • Use git blame filename -
    • -
    • Explain the line prefix and its meaning
    • -
    -
  • -
+
+ +

Checkout the feature branch, add, commit and push changes

+ +
$ cd $HOME/training
+$ git checkout master
+$ git checkout -b feature/docs-merge-request
+$ vim README.md
+
+Let's create a merge request with GitLab.
+
+$ git add README.md
+$ git commit -v README.md -m "Update docs for merge requests"
+$ git push -u origin feature/docs-merge-request
+ +

Navigate into GitLab and create merge request

+ +

GitLab puts the URL into the shell output on pushing the branch.

+ +
$ git push -u origin feature/docs-merge-request
+Counting objects: 6, done.
+Delta compression using up to 4 threads.
+Compressing objects: 100% (6/6), done.
+Writing objects: 100% (6/6), 618 bytes | 618.00 KiB/s, done.
+Total 6 (delta 4), reused 0 (delta 0)
+remote:
+remote: To create a merge request for feature/docs-merge-request, visit:
+remote:   https://[...].nws.netways.de/root/training/merge_requests/new?merge_request%5Bsource_branch%5D=feature%2Fdocs-merge-request
+remote:
+To https://[...].nws.netways.de/root/training.git
+ * [new branch]      feature/docs-merge-request -> feature/docs-merge-request
+Branch 'feature/docs-merge-request' set up to track remote branch 'feature/docs-merge-request' from 'origin'.
+ +

Open the URL in your browser.

+ +

Specify a topic, description and create the merge request.

+ +

Merge the request to master and investigate the Git history.

+ +

Pull changes to master after merge

+ +
$ git checkout master
+$ git pull
+$ tig
-
-
-

~~~SECTION:MAJOR~~~ Git Hints

+
+
- NETWAYS + NETWAYS Training
-

Restore deleted file

+

Lab 8.6: Proposed Solution

+ +
+ +

Rebase and squash commits

+ +
+ +

Add 3 commits to your history

+ +

If you do not have any.

+ +
$ git checkout master
+$ git checkout -b feature/squash-test
+
+@@@ Sh
+$ echo "# Rebase and Squash" >> README.md
+$ git commit -av -m "commit1"
+$ echo "  " >> README.md
+$ git commit -av -m "commit2"
+$ echo "`git rebase -i` is interactive" >> README.md
+$ git commit -av -m "commit3"
+ +

Use git rebase to squash three commits

-

This is where git rev-list comes in handy.

+

Use the interactive mode by specifying the -i parameter. +HEAD~3 uses the commit range three commits to the current +HEAD commit.

-

Find the last commit which affected the given path.

+
$ git rebase -i HEAD~3
-

git rev-list -n 1 HEAD -- <filepath>.

+

The interactive mode opens the editor you are familiar with +from commit messages.

-

Then checkout the version at the commit before using the caret ^ symbol.

+

Choose the commits to squash

-

git checkout <deletingcommit>^ -- <filepath>

+
pick 5a31d9e commit1
+squash ce90e16 commit2
+squash ed6a68f commit3
-
-
-

~~~SECTION:MAJOR~~~ Git Hints

+
+
- NETWAYS + NETWAYS Training
-

Apply and Create Patches

+

Lab 8.7: Proposed Solution

-

Manually apply and create Git patches.

+
-
    -
  • -git apply: apply git patch
  • -
  • -git am: read patches from STDIN and apply them
  • -
  • -git format-patch: create git patch
  • -
+

Delete remote branch

+
+

Create and push remote branch

- -
-
+

If you do not have any.

-
+
$ cd $HOME/training
+$ git checkout master
+$ git checkout -b feature/docs-wrong-name
+$ git push -u origin feature/docs-wrong-name
+ +

Identify remote branch to delete

+ +
$ git branch -r
+  feature/docs-wrong-name
-

git apply applies a git patch file to your working tree.

+

Delete remote branch

-

git am reads git patches from your mailbox by default. It also can be used to -read patches from the shell's STDIN (e.g. curl downloading a patch from the web). -The -s option allows you to sign off the patch, for example if you have reviewed -the patch from an external committer.

+
$ git push origin :feature/docs-wrong-name
-

git format-patch requires either a negative number of commits from current HEAD or -a git commit id. It will then create numbered patch files for all required commits.

+

Now verify it is gone (Hint: -r lists remote branches).

+
$ git fetch
+$ git branch -r
+ +
-
-
-

~~~SECTION:MAJOR~~~ Git Hints

+
+
- NETWAYS + NETWAYS Training
-

Git Aliases

+

Lab 10.1: Proposed Solution

-
    -
  • Shortcuts
  • -
  • Custom commands
  • -
  • "Simulate" SVN commands
  • -
+
+

Open Runner Administration View

+
- -
-
+

Navigate to /admin/runners.

-
+

+How to setup a shared Runner for a new project +Install a Runner compatible with GitLab CI (checkout the GitLab Runner section for information on how to install it). +Specify the following URL during the Runner setup: ... +Use the following registration token during setup: ... +Start the Runner! +

-
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Hints

-
- NETWAYS -
+

Runners

-

Lab 11.2: Add an alias for git diff

+

Registered runners are listed at the bottom.

-
    -
  • Objective: +

    Register Runner

      -
    • Add an alias for git diff
    • -
    -
  • Steps:
      -
    • Edit the $HOME/.gitconfig file
    • -
    • Add a new [alias] section if not existing
    • -
    • Add d as an alias for diff +
    • Run gitlab-runner register as root
    • +
    • Use the HTTP Url as host
    • +
    • Paste the token
    • +
    • Add description training01 and tag training +
    • +
    • Untagged builds: true, Lock to current project: false +
    • +
    • Executor: docker, Default: alpine/latest
+

Reference: https://gitlab.com/gitlab-org/gitlab-runner/blob/master/docs/install/linux-repository.md +Reference: https://docs.gitlab.com/runner/install/linux-repository.html

+ +

Reference for Docker: https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/

+ +

Example on Ubuntu:

+ +

``` +apt-get install \ + apt-transport-https \ + ca-certificates \ + curl \ + software-properties-common

+ +

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

+ +

add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable"

+ +

apt-get update +apt-get install docker-ce +```

+ +

+curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash +apt-get install gitlab-runner +

+ +

Start CLI

+ +
# gitlab-runner register
+Running in system-mode.
+
+Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
+http://192.168.56.101
+
+Please enter the gitlab-ci token for this runner:
+Do1aqTvPiiBj6_u_u5Ye
+
+Please enter the gitlab-ci description for this runner:
+[ubuntu-16]: training01
+
+Please enter the gitlab-ci tags for this runner (comma separated):
+training
+
+Whether to run untagged builds [true/false]:
+[false]: true
+
+Whether to lock the Runner to current project [true/false]:
+[true]: false
+Registering runner... succeeded                     runner=Do1aqTvP
+
+Please enter the executor: docker+machine, docker-ssh, parallels, ssh, virtualbox, docker, shell, docker-ssh+machine, kubernetes:
+docker
+
+Please enter the default Docker image (e.g. ruby:2.1):
+alpine:latest
+
+Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
+
-
-
-

~~~SECTION:MAJOR~~~ Git Hints

+
+
- NETWAYS + NETWAYS Training
-

Git Attributes

+

Lab 10.2: Proposed Solution

-
    -
  • Control the file line ending mode on different OS
  • -
  • Ignore specific files on git archive
  • -
+
-

Example:

+

Create .gitlab-ci.yml file

-
$ vim .gitattributes
+
-modules/** eol=lf
+

Create CI configuration file

+
$ cd $HOME/training
+$ vim .gitlab-ci.yml
 
+image: alpine:latest
 
-
-
-
+all_tests: + script: + - exit 1 -
+

The script will always fail. We will use different exit states to fix it. +Future examples and tests work the same way.

+
-
-
-

~~~SECTION:MAJOR~~~ Git Hints

+
+
- NETWAYS + NETWAYS Training
-

Git Submodules

+

Lab 10.3: Proposed Solution

-
    -
  • Pointer to a specific commit in remote repository
  • -
  • Independent sub directory with own .git repository
  • -
+
-

Example:

+

Push CI config and trigger GitLab job

-
$ git submodule add https://github.com/Icinga/puppet-icinga2
-$ git status
-  new file: .gitmodules
-  new file: puppet-icinga2
+
-$ git submodule - ad5e309... puppet-icinga2 (heads/master) -
+

Git Add, Commit, Push

-

Fresh clone:

+
$ git add .gitlab-ci.yml
+$ git commit -av -m "Add GitLab CI config"
+$ git push origin master
-
$ git clone --recursive ...
+

Modify exit code

-$ git clone ... -$ git submodule init && git submodule update -
+
$ vim .gitlab-ci.yml
 
+image: alpine:latest
 
+all_tests:
+  script:
+    - exit 0
+ +
+
+
+
+ NETWAYS Training
-
+ +

Lab 10.4: Proposed Solution


-

Note: Git submodule removal is not trivial.

+

Prepare container to convert Markdown to HTML

-

https://davidwalsh.name/git-remove-submodule

+
-
- -
-
-
-

~~~SECTION:MAJOR~~~ Git Hints

-
- NETWAYS -
+

Edit .gitlab-ci.yml and add before_script

-

Git Subtree

+
$ vim .gitlab-ci.yml
 
-
    -
  • Merge an external git repository history
  • -
  • Directory in your main repository (--prefix)
  • -
  • Squash the remote history into one commit
  • -
  • No external dependency (e.g. git submodule repository not available anymore)
  • -
  • No local configuration - document the external reference
  • -
+image: alpine:latest -

Example for imported Puppet modules:

+before_script:
-
$ git subtree add --prefix modules/icinga2 \
-https://github.com/Icinga/puppet-icinga2 HEAD --squash
+

Update apk and install Python/pip

-$ git subtree pull --prefix modules/icinga2 \ -https://github.com/Icinga/puppet-icinga2 HEAD --squash -
+
$ vim .gitlab-ci.yml
 
+image: alpine:latest
 
+before_script:
+  - apk update && apk add python py-pip
- -
-
+

Install Markdown Python libraries

-
+
$ vim .gitlab-ci.yml
 
-

Adding a git subtree requires

+image: alpine:latest -
    -
  • Existing directory tree except for the one created
  • -
  • Git clone URL
  • -
  • The branch which should be added (use master as default)
  • -
  • Optionally --squash all commits into one
  • -
+before_script: + - apk update && apk add python py-pip + - pip install markdown Pygments
-

Example:

+

Verify the content

-
git subtree add --prefix clippy.js https://github.com/smore-inc/clippy.js.git master --squash
-
+
$ vim .gitlab-ci.yml
 
-
- -
-
-
-

~~~SECTION:MAJOR~~~ GitLab Hints

-
- NETWAYS -
+image: alpine:latest + +before_script: + - apk update && apk add python py-pip + - pip install markdown Pygments + +all_tests: + script: + - exit 0
-

12 GitLab Hints

+

Commit and push the changes

+ +
$ git commit -av -m "CI: Prepare markdown conversion"
+$ git push
-
-
-

~~~SECTION:MAJOR~~~ GitLab Hints

+
+
- NETWAYS + NETWAYS Training
-

Issues, Merge Requests, Charts

- -
    -
  • Issues applied to task workflow
  • -
  • Merge requests with branches "ready to merge"
  • -
  • Overview charts and boards for better organization
  • -
  • Your "own" development and operations workflow
  • -
- +

Lab 10.5: Proposed Solution

+
- -
-
+

Create HTML docs from Markdown


-
- -
-
-
-

~~~SECTION:MAJOR~~~ GitLab Hints

-
- NETWAYS -
+

Edit .gitlab-ci.yml and add markdown section

-

Administration

+
$ vim .gitlab-ci.yml
 
-
    -
  • Default Settings
  • -
  • Stats, Versions, Users
  • -
  • Permission Management
  • -
  • Monitoring, System Hooks
  • -
  • Appearance and Customizing
  • -
+... -

Explore this with the trainer and discuss specific topics.

+all_tests: + script: + - exit 0 +markdown:
+

Add script to convert Markdown into HTML

- -
-
+
$ vim .gitlab-ci.yml
 
-
+... -
- -
-
-
-

~~~SECTION:MAJOR~~~ GitLab Hints

-
- NETWAYS -
+markdown: + - python -m markdown README.md > README.html
-

Best Practices

+

Store artifacts

-
    -
  • HTTPS only
  • -
  • Performance tuning
  • -
  • Monitoring
  • -
  • Troubleshooting
  • -
+

Add paths section which includes README.html as entry. +Tell GitLab to expire this artifact in 1 week.

+
$ vim .gitlab-ci.yml
 
+...
 
-
-
-
+markdown: + - python -m markdown README.md > README.html + artifacts: + paths: + - README.html + expire_in: 1 week -
+

Verify the content

-
- -
-
-
-

~~~SECTION:MAJOR~~~ GitLab Hints

-
- NETWAYS -
+
$ vim .gitlab-ci.yml
 
-

Secure HTTPS environment

+image: alpine:latest -
    -
  • Use Let's Encrypt or own certificates
  • -
  • Enable HTTPS in GitLab/Nginx
  • -
  • Forward all HTTP requests to HTTPS
  • -
+before_script: + - apk update && apk add python py-pip + - pip install markdown Pygments +all_tests: + script: + - exit 0 +markdown: + - python -m markdown README.md > README.html + artifacts: + paths: + - README.html + expire_in: 1 week
- -
-
+

Commit and push the changes

-

Reference: https://docs.gitlab.com/ce/install/installation.html#using-https

+
$ git commit -av -m "CI: Generate HTML docs from Markdown"
+$ git push
-
+

Download HTML artifacts

+ +

Navigate into the repository > CI / CD > Jobs > #... and choose Job Artifacts. +Download them, extract them and open the HTML file with your browser.

+
-
-
-

~~~SECTION:MAJOR~~~ GitLab Hints

+
+
- NETWAYS + NETWAYS Training
-

Performance Tuning

+

Lab 10.6: Proposed Solution

-
    -
  • 4+ GB RAM make GitLab happy
  • -
  • Move PostgreSQL 9.2+ to a dedicated host
  • -
+
+

Update docs

+
- -
-
+

Edit README.md and add learned details

-
+
vim README.md
 
-
- -
-
-
-

~~~SECTION:MAJOR~~~ GitLab Hints

-
- NETWAYS -
+# CI Runners -

Monitoring

+....
-
    -
  • HTTP(S)
  • -
  • PostgreSQL
  • -
  • Redis
  • -
  • Background daemons
  • -
  • Logs
  • -
+

Commit and push changes

+ +
git commit -av -m "Add notes on CI runners"
+git push
+

Download HTML artifacts

+

Navigate into the repository > CI / CD > Jobs > #... and choose Job Artifacts. +Download them, extract them and open the HTML file with your browser.

-
-
- -
-
-
-
-

~~~SECTION:MAJOR~~~ GitLab Hints

+
+
- NETWAYS + NETWAYS Training
-

GitLab API

+

Lab 11.1: Proposed Solution

-
    -
  • Automation - -
      -
    • Users, Groups, Projects, etc.
    • -
    -
  • -
  • Handle Merge Requests
  • -
  • Jobs, Pipelines, CI
  • -
  • ...
  • -
+
-

You can manage nearly everything.

+

Use Git Blame

+
+

Pick a file and use Git Blame

- -
-
+
$ git blame README.md
-
+

Modify and commit changes and use Git Blame again

-

Reference: https://docs.gitlab.com/ce/api/README.html

+
$ echo "Blame me" >> README.md && git commit -av -m "Blame me"
+$ echo "Blame me, too." >> README.md && git commit -av -m "Blame me, too"
 
-

API Clients: https://about.gitlab.com/applications/#api-clients

+$ git blame README.md
+
-
-
-

~~~SECTION:MAJOR~~~ GitLab Hints

+
+
- NETWAYS + NETWAYS Training
-

GitLab Applications

+

Lab 11.2: Proposed Solution

-

GitLab provides an extensive list of external applications:

+
-

https://about.gitlab.com/applications/

+

Add an alias for git diff

-
    -
  • CLI clients
  • -
  • API clients
  • -
  • GUIs
  • -
  • ...
  • -
+
+

Edit the git configuration file

+
$ vim $HOME/.gitconfig
 
-
-
-
+[alias] + d = diff -
+

Make a change and test it

-

Reference: https://docs.gitlab.com/ce/api/README.html

+
$ vim AUTHORS
+:dd
 
-

API Clients: https://about.gitlab.com/applications/#api-clients

+$ git d
+
diff --git a/trainer/.keep b/trainer/.keep new file mode 100644 index 0000000..e69de29