├── .gitignore ├── LICENSE ├── README.md ├── build-env.sh ├── consul └── setup-consul.sh ├── docs ├── .gitignore ├── Makefile ├── Preso │ ├── CI-CD Local Demo.pptx │ └── CI-CD Local Demo_xsmall.pptx ├── _static │ ├── class1 │ │ ├── module1 │ │ │ ├── img001.png │ │ │ ├── img002.png │ │ │ ├── img003.png │ │ │ ├── img004.png │ │ │ ├── img005.png │ │ │ ├── img006.png │ │ │ ├── img007.png │ │ │ ├── img008.png │ │ │ ├── img009.png │ │ │ ├── img010.png │ │ │ ├── img011.png │ │ │ ├── img012.png │ │ │ ├── img013.png │ │ │ ├── img014.png │ │ │ ├── img015.png │ │ │ ├── img016.png │ │ │ ├── img017.png │ │ │ ├── img018.png │ │ │ ├── img019.png │ │ │ ├── img020.png │ │ │ ├── img021.png │ │ │ ├── img022.png │ │ │ ├── img023.png │ │ │ ├── img024.png │ │ │ ├── img025.png │ │ │ ├── img026.png │ │ │ ├── img027.png │ │ │ └── img028.png │ │ └── module2 │ │ │ ├── img001.png │ │ │ ├── img002.png │ │ │ ├── img004.png │ │ │ ├── img005.png │ │ │ ├── img006.png │ │ │ ├── img007.png │ │ │ ├── img008.png │ │ │ ├── img009.png │ │ │ ├── img010.png │ │ │ ├── img011.png │ │ │ ├── img012.png │ │ │ ├── img013.png │ │ │ ├── img014.png │ │ │ ├── img015.png │ │ │ ├── img016.png │ │ │ ├── img017.png │ │ │ ├── img018.png │ │ │ ├── img019.png │ │ │ ├── img020.png │ │ │ ├── img021.png │ │ │ ├── img022.png │ │ │ ├── img023.png │ │ │ ├── img024.png │ │ │ ├── img025.png │ │ │ ├── img026.png │ │ │ ├── img027.png │ │ │ ├── img028.png │ │ │ ├── img029.png │ │ │ └── img030.png │ └── class2 │ │ ├── module1 │ │ ├── img001.png │ │ ├── img002.png │ │ ├── img003.png │ │ ├── img004.png │ │ ├── img005.png │ │ ├── img006.png │ │ ├── img007.png │ │ ├── img008.png │ │ ├── img009.png │ │ ├── img010.png │ │ ├── img011.png │ │ ├── img012.png │ │ ├── img013.png │ │ ├── img014.png │ │ ├── img015.png │ │ ├── img016.png │ │ ├── img017.png │ │ ├── img018.png │ │ ├── img019.png │ │ ├── img020.png │ │ ├── img021.png │ │ ├── img022.png │ │ └── img023.png │ │ └── module2 │ │ ├── img001.png │ │ ├── img002.png │ │ ├── img003.png │ │ ├── img004.png │ │ ├── img005.png │ │ ├── img006a.png │ │ ├── img006b.png │ │ ├── img007.png │ │ ├── img008.png │ │ ├── img009.png │ │ ├── img010.png │ │ ├── img011.png │ │ ├── img012.png │ │ ├── img013.png │ │ ├── img014.png │ │ ├── img015.png │ │ ├── img016.png │ │ ├── img017.png │ │ ├── img018.png │ │ ├── img019.png │ │ ├── img020.png │ │ ├── img021.png │ │ ├── img022.png │ │ ├── img023.png │ │ ├── img024.png │ │ ├── img025.png │ │ ├── img026.png │ │ ├── img027.png │ │ ├── img028.png │ │ ├── img029.png │ │ ├── img030.png │ │ ├── img031a.png │ │ ├── img031b.png │ │ └── img032.png ├── class1 │ ├── class1.rst │ ├── module1 │ │ ├── lab1.rst │ │ ├── lab2.rst │ │ └── module1.rst │ └── module2 │ │ ├── lab1.rst │ │ ├── lab2.rst │ │ └── module2.rst ├── class2 │ ├── class2.rst │ ├── module1 │ │ ├── lab1.rst │ │ ├── lab2.rst │ │ ├── lab3.rst │ │ └── module1.rst │ └── module2 │ │ ├── lab1.rst │ │ ├── lab2.rst │ │ └── module2.rst ├── conf.py └── index.rst ├── gitlab └── setup-gitlab.sh └── jenkins ├── Dockerfile └── setup-jenkins.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/* -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SETUP CI CD ENV 2 | =============== 3 | 4 | This repo will automatically setup a "CI/CD" environment on the laptop with: Gitlab, Jenkins, Consul, Minishift and some default pipeline/examples 5 | 6 | The documentation of the examples with labs can be found hee: 7 | 8 | Requirements 9 | ------------ 10 | 11 | * This solution is created for MAC OS X or 2xVM Running Centos. 12 | * AS3 must be installed on the BIG-IP devices used 13 | 14 | CentOs specific requirements: 15 | 16 | Prepare the CentOs platforms 17 | ---------------------------- 18 | 19 | * The user must be allowed to do sudo commands without password () 20 | 21 | sudo visudo 22 | # add a line like this: 23 | "centos ALL=(ALL) NOPASSWD: ALL" 24 | 25 | 26 | * You must have created a ssh key and use ssh-copy-id locally on the IP of the device (not localhost)\ 27 | 28 | ssh-keygen 29 | ssh-copy-id centos@hostIP 30 | 31 | * Disable SELinux (a reboot is required after) 32 | 33 | sudo vi /etc/selinux/config 34 | # and modify 35 | "SELINUX=enforcing" to: "SELINUX=disabled" 36 | 37 | * Reboot the instance 38 | 39 | then: 40 | 41 | sudo yum update -y 42 | sudo yum upgrade -y 43 | sudo yum install -y git docker net-tools wget firewalld 44 | sudo systemctl start docker 45 | sudo systemctl enable docker 46 | sudo systemctl start firewalld 47 | sudo systemctl enable firewalld 48 | # Allow the user to run docker command without sudo - needed for Minishift 49 | sudo groupadd docker 50 | sudo usermod -aG docker $USER 51 | 52 | If you use vanilla CentOS, you need to: 53 | 54 | sudo yum install libvirt -y 55 | sudo yum install quemu-kvm -y 56 | sudo usermod -a -G libvirt $(whoami) 57 | newgrp libvirt 58 | 59 | see: 60 | 61 | Make sure that your PATH variable contains /usr/local/bin 62 | 63 | PATH=$PATH:/usr/local/bin; export PATH 64 | 65 | Reboot your VM. it's required to be able to run docker command without sudo. Changes won't be taken 66 | into account until a restart is done. 67 | 68 | Make sure that docker and firewalld are runnning: 69 | 70 | sudo systemctl status docker 71 | sudo systemctl status firewalld 72 | 73 | Installing the env - pipeline tools 74 | ----------------------------------- 75 | 76 | ** YOU MUST INSTALL THE PIPELINE TOOLS FIRST ** 77 | 78 | On one of the VM, we will install all the pipeline tools: 79 | 80 | * Gitlab 81 | * Jenkins 82 | * Consul 83 | 84 | To install the pipeline tools, retrieve the github repository: 85 | 86 | git clone https://github.com/nmenant/ci-cd-env-setup 87 | cd ci-cd-env-setup 88 | 89 | Run 90 | 91 | build-env.sh pipeline 92 | to install the different components: 93 | 94 | * Update the system 95 | * A user-defined network (ci-cd-docker-net) in docker will be created (172.18.0.0/16) 96 | * Gitlab will run on 172.18.0.2 97 | * Jenkins will run on 172.18.0.3 98 | * Consul will run on 172.18.0.4 99 | 100 | Everything will be started at the same time 101 | 102 | Installing the env - minishift 103 | ----------------------------------- 104 | 105 | On the other VM, we will install minishift 106 | 107 | To install minishift, retrieve the github repository: 108 | 109 | git clone https://github.com/nmenant/ci-cd-env-setup 110 | cd ci-cd-env-setup 111 | 112 | Run 113 | 114 | build-env.sh minishift 115 | to install minishift: 116 | 117 | * Update the system 118 | * Install Minishift in the VM. You'll be requested for the IP of this VM, the IP of the VM running the pipeline tools and the IP of the BIG-IP 119 | Consider that the credentials are *admin*/*admin* to it - if not, you need to update the Consul KV for BIG-IP credentials - see below) 120 | 121 | Once minishift started, its GUI will be available on 122 | 123 | login by default with: 124 | 125 | * Login: dev 126 | * Password: dev 127 | 128 | Credentials 129 | ----------- 130 | 131 | Here is the list of login/password for the different tools: 132 | 133 | * Gitlab: TenantA/Pa55w0rd 134 | * Jenkins: TenantA/Pa55w0rd 135 | * Minishift: dev/dev 136 | * Consul: no auth needed to handle the kv database 137 | 138 | Finalize the setup 139 | ------------------ 140 | 141 | There is one last step to do to finalize your setup: update the service definition tied to the demo app. 142 | 143 | To update the service definition, you may go to your gitlab 144 | 145 | You need to edit this file to change : 146 | 147 | * the Virtual Server IP Address of the service. 148 | 149 | "virtualAddresses": [ 150 | "172.16.1.90" 151 | ], 152 | 153 | * the URI of the security policy. 154 | 155 | change the following line to replace *192.168.143.1* with the IP of your VM running Gitlab: 156 | 157 | "url": "http://192.168.143.1:1080/Larry/Security-Policies/raw/master/policies/asm-policy-linux-high.xml", 158 | 159 | This will trigger a webhook in Jenkins but it's irrelevant, it won't be processed 160 | 161 | Trigger a deployment/Delete the app 162 | ----------------------------------- 163 | 164 | To deploy/delete the App, it is fairly straightforward. You need to add/delete the "DELETE" file in the repo *my-webapp-ci-cd-demo*. 165 | 166 | **Don't forget to go to the Dev branch!!!** 167 | 168 | By default this file exist. You just need to delete it from the repo and the app will be deployed. 169 | 170 | If you want to remove the App, you just need to put back a DELETE file at the root of the directory. 171 | 172 | you have a more detailed lab guide here: 173 | 174 | UDF - Restart the environment 175 | ----------------------------- 176 | 177 | If you switch off/pause off your VMs, you'll need to restart some of your components: 178 | 179 | * the gitlab/jenkins/consul containers should restart automatically since they have been started with the option *--restart always* 180 | * You'll need to start again minishift. To do this, just run again the command in the *ci-cd-env-setup* folder 181 | 182 | build-env.sh minishift 183 | 184 | Update Consul 185 | ------------- 186 | 187 | Consul can be used to store infrastructure information leveraged by Jenkins. By default it contains the following default KV: 188 | 189 | GET http://127.0.0.1:8500/v1/kv/?keys 190 | 191 | [ 192 | "Minishift/minishift_ip", 193 | "Minishift/minishift_port", 194 | "Minishift/minishift_token", 195 | "tenanta/ADC-Services/cluster-nicolas/cluster_credentials", 196 | "tenanta/ADC-Services/cluster-nicolas/cluster_ips" 197 | ] 198 | 199 | They are used in the 2 default jenkins pipeline. You still need to update a few variables based on your env: 200 | 201 | * you need to update minishift_ip with the IP of your minishift cluster. You can get this information with the command 202 | 203 | minishift ip 204 | * you need to update minishift_token with the token you'll get by creating a service account allowed to do API calls in your minishift project ( - right now there is a bug in the doc, it's 205 | 206 | eval $(minishift oc-env) 207 | oc policy add-role-to-user admin system:serviceaccount:test:robot 208 | oc serviceaccounts get-token robot > robot-token.json 209 | 210 | and not *oc policy add-role-to-user admin system:serviceaccounts:test:robot*) 211 | 212 | * you need to update cluster_ips with the cluster of your BIG-IPs. You can put a single IP for a standalone deployment 213 | 214 | curl -X PUT -d cluster_ip http://127.0.0.1:8500/v1/kv/tenanta/ADC-Services/cluster-nicolas/cluster_ips 215 | * if you changed the default credentials of your BIG-IP, you'll need to also update cluster_credentials. 216 | Consul credentials have the format of "username:password" 217 | 218 | curl -X PUT -d username:password tenanta/ADC-Services/cluster-nicolas/cluster_credentials 219 | 220 | Update those values accordingly to your infrastructure 221 | 222 | # To check a key value: 223 | curl http://127.0.0.1:8500/v1/kv/tenanta/ADC-Services/cluster-nicolas/cluster_ips?raw 224 | # IMPORTANT: 225 | # Consul encodes values per default in base64. To optain a non base64 value the GET request has to end with "?raw" 226 | # If "?raw" is not appendd then Consul will respond with a json blob and an base64 encoded value. 227 | 228 | # To update the value of a key: 229 | curl -X PUT -d "value" http://127.0.0.1:8500/v1/kv/tenanta/ADC-Services/cluster-nicolas/cluster_ips 230 | 231 | # To update the BIG-IP credentials: 232 | curl -X PUT -d username:password tenanta/ADC-Services/cluster-nicolas/cluster_credentials 233 | 234 | 235 | -------------------------------------------------------------------------------- /build-env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## We consider two scenarios: 4 | ## 1- you use a MAC and want to install it on your laptop 5 | ## If you use a MAC, we consider that you already have brew and docker installed 6 | ## 2- you want to use a VM to do this, use Centos 7 7 | ## Follow the README guide to check the pre requisites 8 | ## Any other deployment is not supported today 9 | ## 10 | 11 | function error_syntax () { 12 | echo "#################################" 13 | echo "Syntax for build-env.sh: " 14 | echo " ./build-env.sh minishift: will install minishift and update consul accordingly" 15 | echo " ./build-env.sh pipeline: will install gitlab, jenkins, consul" 16 | echo "You cannot run minishift and pipeline on the same VM (except if set this up on your MAC)" 17 | echo "#################################" 18 | } 19 | 20 | function install_minishift() { 21 | ## 22 | ## Need to identify the platform to make sure we can install Minishift 23 | ## installation guide is here: ## update accordingly: https://docs.okd.io/latest/minishift/getting-started/installing.html 24 | ## 25 | 26 | echo "#################################################" 27 | echo "SETTING UP MINISHIFT" 28 | echo "#################################################" 29 | 30 | read -p 'Your VM IP: ' serverip 31 | read -p 'Consul IP: ' consulip 32 | read -p 'BIG-IP IP: ' bigipip 33 | read -p 'BIG-IP Admin Port': bigipport 34 | if [[ "$unamestr" == 'Linux' ]]; then 35 | #setup required packages 36 | sudo curl -L https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.10.0/docker-machine-driver-kvm-centos7 -o /usr/local/bin/docker-machine-driver-kvm 37 | sudo sudo chmod +x /usr/local/bin/docker-machine-driver-kvm 38 | sudo systemctl start libvirtd 39 | #echo "Linux deployment is not automated yet, please set it up yourself: https://docs.okd.io/latest/minishift/using/run-against-an-existing-machine.html#configuring-existing-remote-machine" 40 | mkdir minishift 41 | wget https://github.com/minishift/minishift/releases/download/v1.31.0/minishift-1.31.0-linux-amd64.tgz 42 | tar zxf minishift-1.31.0-linux-amd64.tgz -C minishift/ 43 | sudo mv minishift/minishift-1.31.0-linux-amd64/minishift /usr/local/bin/ 44 | sudo firewall-cmd --permanent --add-port 2376/tcp --add-port 8443/tcp --add-port 80/tcp 45 | dockernet=`sudo docker network inspect -f "{{range .IPAM.Config }}{{ .Subnet }}{{end}}" bridge` 46 | sudo firewall-cmd --permanent --new-zone minishift 47 | sudo firewall-cmd --permanent --zone minishift --add-source $dockernet 48 | sudo firewall-cmd --permanent --zone minishift --add-port 53/udp --add-port 8053/udp 49 | sudo firewall-cmd --reload 50 | minishift addons install --defaults 51 | minishift addons enable admin-user 52 | minishift start --vm-driver generic --remote-ipaddress $serverip --remote-ssh-user $USER --remote-ssh-key $HOME/.ssh/id_rsa --memory 4Gb 53 | minishift addon apply admin-user 54 | rm minishift-1.31.0-linux-amd64.tgz 55 | elif [[ "$platform" == 'MACOSX' ]]; then 56 | echo "Installing Minishift on a MACOSX platform" 57 | brew cask install minishift 58 | 59 | minishift addons install --defaults 60 | minishift addons enable admin-user 61 | minishift addon apply admin-user 62 | minishift start 63 | fi 64 | 65 | ## 66 | ## We setup minishift and create a user for API interaction 67 | ## 68 | echo "#################################################" 69 | echo "CONFIGURING PROJECT IN MINISHIFT" 70 | echo "#################################################" 71 | eval $(minishift oc-env) 72 | oc login -u dev -p dev 73 | oc new-project tenanta-dev 74 | oc create serviceaccount robot 75 | oc policy add-role-to-user admin system:serviceaccount:tenanta-dev:robot 76 | oc serviceaccounts get-token robot > robot-token.json 77 | echo "Robot API Token:" 78 | cat robot-token.json 79 | ## 80 | ## We update Consul based on our Minishift Setup 81 | ## 82 | echo "#################################################" 83 | echo "CONFIGURING CONSUL - Update Minishift keys" 84 | echo "#################################################" 85 | curl -X PUT -d @robot-token.json http://$consulip:8500/v1/kv/Minishift/minishift_token 86 | curl -X PUT -d $serverip http://$consulip:8500/v1/kv/Minishift/minishift_ip 87 | 88 | ## 89 | ## We update Consul based on our Minishift Setup 90 | ## 91 | echo "#################################################" 92 | echo "CONFIGURING CONSUL - Update BIG-IP IP Address/port" 93 | echo "#################################################" 94 | curl -X PUT -d $bigipip http://$consulip:8500/v1/kv/tenanta/ADC-Services/cluster-nicolas/cluster_ips 95 | curl -X PUT -d $bigipport http://$consulip:8500/v1/kv/tenanta/ADC-Services/cluster-nicolas/cluster_port 96 | } 97 | 98 | function install_pipeline() 99 | { 100 | echo "##############INSTALLING PIPELINE###################" 101 | gitlab_archive='1540557175_2018_10_26_11.2.3_gitlab_backup.tar' 102 | 103 | ## 104 | ## Retrieve the containers' volumes/backups from AWS S3 105 | ## 106 | 107 | echo "#################################################" 108 | echo "Retrieving the containers volumes/Backups" 109 | echo "#################################################" 110 | 111 | mkdir docker_volumes 112 | curl https://s3.eu-west-3.amazonaws.com/nmenant-public/CI-CD+docker-volumes/consul.tgz --output consul.tgz 113 | tar zxf consul.tgz -C docker_volumes 114 | 115 | ## 116 | ## Permission issues with consul - TO BE INVESTIGATED 117 | ## 118 | chmod -R 777 docker_volumes/consul/* 119 | 120 | curl https://s3.eu-west-3.amazonaws.com/nmenant-public/CI-CD+docker-volumes/jenkins.tgz --output jenkins.tgz 121 | tar zxf jenkins.tgz -C docker_volumes 122 | 123 | curl https://s3.eu-west-3.amazonaws.com/nmenant-public/CI-CD+docker-volumes/$gitlab_archive --output $gitlab_archive 124 | mkdir docker_volumes/gitlab 125 | mkdir docker_volumes/gitlab/data 126 | mkdir docker_volumes/gitlab/logs 127 | mkdir docker_volumes/gitlab/config 128 | 129 | ## 130 | ## Check if the docker network ci-cd-docker-net exists. If not, we create it 131 | ## we check for a docker network called ci-cd-docker-net. The subnet use will be 172.18.0.0/16 132 | ## 133 | 134 | output="" 135 | output=`docker network ls | grep ci-cd-docker-net` 136 | 137 | if [[ "$output" == '' ]]; then 138 | echo "creating docker network" 139 | sudo docker network create --subnet=172.18.0.0/16 ci-cd-docker-net 140 | fi 141 | 142 | echo "#################################################" 143 | echo "CONTAINER: SETTING UP GITLAB" 144 | echo "#################################################" 145 | 146 | ## Launch Gitlab container 147 | docker rm gitlab 148 | sh gitlab/setup-gitlab.sh $PWD $gitlab_archive 149 | 150 | # Give time for the gitlab container to start 151 | sleep 30 152 | 153 | # We start working on restoring the archive 154 | # https://gitlab.com/gitlab-org/gitlab-ce/issues/14740 155 | # https://docs.gitlab.com/ee/raketasks/backup_restore.html 156 | echo "#################################################" 157 | echo "Gitlab - Reconfigure GITLAB container" 158 | echo "#################################################" 159 | docker exec gitlab gitlab-ctl reconfigure 160 | 161 | echo "#################################################" 162 | echo "Gitlab - Checking state of GITLAB container" 163 | echo "#################################################" 164 | docker exec gitlab gitlab-rake gitlab:check SANITIZE=true 165 | 166 | # restore backup now for gitlab container 167 | echo "#################################################" 168 | echo "Gitlab - loading archive of GITLAB container" 169 | echo "#################################################" 170 | docker cp $gitlab_archive gitlab:/var/opt/gitlab/backups 171 | docker exec gitlab gitlab-ctl stop unicorn 172 | docker exec gitlab gitlab-ctl stop sidekiq 173 | docker exec gitlab chmod -R 775 /var/opt/gitlab/backups 174 | 175 | archive_name=`echo $gitlab_archive | sed s/_gitlab_backup.tar//g` 176 | # note -it flag so you can respond to questions that restore script asks! 177 | docker exec -it gitlab gitlab-rake gitlab:backup:restore BACKUP=$archive_name 178 | echo "#################################################" 179 | echo "Gitlab - restarting GITLAB container...." 180 | echo "#################################################" 181 | docker exec gitlab gitlab-ctl start 182 | 183 | echo "#################################################" 184 | echo "Gitlab - Checking state of GITLAB container - FINAL" 185 | echo "#################################################" 186 | docker exec gitlab gitlab-rake gitlab:check SANITIZE=true 187 | 188 | echo "#################################################" 189 | echo "CONTAINER: SETTING UP JENKINS" 190 | echo "#################################################" 191 | ## Launch Jenkins containers 192 | docker rm jenkins 193 | docker rmi jenkins-with-python-docker 194 | if [[ "$unamestr" == 'Linux' ]]; then 195 | sh jenkins/setup-jenkins.sh $PWD /usr/bin/docker 196 | elif [[ "$unamestr" == 'Darwin' ]]; then 197 | sh jenkins/setup-jenkins.sh $PWD /usr/local/bin/docker 198 | fi 199 | 200 | echo "#################################################" 201 | echo "CONTAINER: SETTING UP CONSUL" 202 | echo "#################################################" 203 | ## Launch consul container 204 | docker rm consul 205 | sh consul/setup-consul.sh $PWD 206 | 207 | echo "#################################################" 208 | echo "CONTAINER: Cleaning up folder" 209 | echo "#################################################" 210 | rm jenkins.tgz 211 | rm consul.tgz 212 | rm $gitlab_archive 213 | 214 | } 215 | 216 | if [ "$#" -ne 1 ]; then 217 | error_syntax 218 | exit -1 219 | fi 220 | 221 | platform='unknown' 222 | unamestr=`uname` 223 | if [[ "$unamestr" == 'Linux' ]]; then 224 | if [ -f /etc/redhat-release ]; then 225 | platform='CentOS' 226 | elif [ -f /etc/lsb-release ]; then 227 | platform="Ubuntu" 228 | fi 229 | elif [[ "$unamestr" == 'Darwin' ]]; then 230 | platform='MACOSX' 231 | fi 232 | 233 | if [ "$1" == "minishift" ] | [ "$1" == "pipeline" ]; then 234 | ## 235 | ## We make sure that the system is up to date 236 | ## 237 | echo "#################################################" 238 | echo "Updating the platform" 239 | echo "#################################################" 240 | if [[ "$platform" == 'Ubuntu' ]]; then 241 | echo "Ubuntu is not support, Only CentOs is supported as a platform" 242 | echo -1 243 | elif [[ "$platform" == 'Darwin' ]]; then 244 | brew update 245 | elif [[ "$platform" == 'CentOS' ]]; then 246 | sudo yum update -y 247 | sudo yum upgrade -y 248 | fi 249 | fi 250 | 251 | if [ "$1" == "minishift" ]; then 252 | install_minishift 253 | elif [ "$1" == "pipeline" ] ; then 254 | install_pipeline 255 | else 256 | error_syntax 257 | fi 258 | 259 | -------------------------------------------------------------------------------- /consul/setup-consul.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker run \ 4 | --name consul \ 5 | -d --net ci-cd-docker-net --ip='172.18.0.4' -p 8301:8301 -p 8302:8302 -p 8400:8400 \ 6 | --restart always -p 8500:8500 -p 8600:8600/udp \ 7 | -v $1/docker_volumes/consul/:/consul/data consul \ 8 | consul agent -server -bind=127.0.0.1 -bootstrap -data-dir=/consul/data -client 0.0.0.0 9 | 10 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _build/* 2 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = CICDwithDevOpstools 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /docs/Preso/CI-CD Local Demo.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/Preso/CI-CD Local Demo.pptx -------------------------------------------------------------------------------- /docs/Preso/CI-CD Local Demo_xsmall.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/Preso/CI-CD Local Demo_xsmall.pptx -------------------------------------------------------------------------------- /docs/_static/class1/module1/img001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img001.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img002.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img003.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img004.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img005.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img006.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img007.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img008.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img009.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img010.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img011.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img012.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img013.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img014.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img015.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img016.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img017.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img018.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img018.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img019.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img019.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img020.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img021.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img021.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img022.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img022.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img023.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img023.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img024.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img025.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img025.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img026.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img026.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img027.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img027.png -------------------------------------------------------------------------------- /docs/_static/class1/module1/img028.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module1/img028.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img001.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img002.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img004.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img005.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img006.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img007.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img008.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img009.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img010.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img011.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img012.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img013.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img014.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img015.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img016.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img017.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img018.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img018.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img019.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img019.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img020.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img021.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img021.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img022.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img022.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img023.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img023.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img024.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img025.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img025.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img026.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img026.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img027.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img027.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img028.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img028.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img029.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img029.png -------------------------------------------------------------------------------- /docs/_static/class1/module2/img030.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class1/module2/img030.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img001.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img002.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img003.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img004.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img005.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img006.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img007.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img008.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img009.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img010.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img011.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img012.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img013.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img014.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img015.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img016.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img017.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img018.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img018.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img019.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img019.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img020.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img021.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img021.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img022.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img022.png -------------------------------------------------------------------------------- /docs/_static/class2/module1/img023.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module1/img023.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img001.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img002.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img003.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img004.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img005.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img006a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img006a.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img006b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img006b.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img007.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img008.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img009.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img010.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img011.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img012.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img013.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img014.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img015.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img015.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img016.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img016.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img017.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img018.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img018.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img019.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img019.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img020.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img021.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img021.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img022.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img022.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img023.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img023.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img024.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img025.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img025.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img026.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img026.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img027.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img027.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img028.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img028.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img029.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img029.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img030.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img030.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img031a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img031a.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img031b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img031b.png -------------------------------------------------------------------------------- /docs/_static/class2/module2/img032.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nmenant/ci-cd-env-setup/8a573fd5ed1eaf5d400915989c5c087a3975b09f/docs/_static/class2/module2/img032.png -------------------------------------------------------------------------------- /docs/class1/class1.rst: -------------------------------------------------------------------------------- 1 | *********************************** 2 | Class 1 - demo IaC with CI/CD Tools 3 | *********************************** 4 | 5 | This class will teach you how to do Infrastructure as Code (IaC) with F5 solutions. 6 | 7 | In this class, we have setup different DevOps tools to do the demonstration: 8 | 9 | * Gitlab: It will host our applications and services definition 10 | * Jenkins: it will be our CI Server 11 | * Consul: it will be used to store *secrets* and infrastructure information like BIG-IP IP, ... 12 | * Openshift: We will use Minishift to host our deployed applications 13 | * AS3: We will leverage the AS3 extension to be able to consume a declarative interface for 14 | services instantiation. To know more about AS3, please visit AS3_. 15 | 16 | .. _AS3: https://clouddocs.f5.com/products/extensions/f5-appsvcs-extension/3/ 17 | 18 | If you just want to do a CI/CD Demo with F5 *BIG-IP* and *AS3*, you may review module2 to see how 19 | to do a demo. 20 | If you want a deeper understanding of the setup, module1 will give you an overview of how everything 21 | is setup to work together. 22 | 23 | 24 | .. toctree:: 25 | :maxdepth: 1 26 | :glob: 27 | 28 | module*/module* -------------------------------------------------------------------------------- /docs/class1/module1/lab1.rst: -------------------------------------------------------------------------------- 1 | Review Gitlab setup 2 | ------------------- 3 | 4 | We have setup the following in GitLab: 5 | 6 | * A Tenant/User called **TenantA**. It hosts all the applications and adc services tied to this tenant. 7 | You can have multiple applications owned by this user and multiple BIG-IP/ADC services here. 8 | For this demo, we will use two different repos in **TenantA**: *my-webapp-ci-cd-demo* and *ADC-Services* 9 | * Another Tenant/User called **Larry**. It hosts all the *Web Application Firewall* policies that people 10 | can leverage/consume. 11 | 12 | Connect to your Gitlab. It should be http://:1080/ 13 | 14 | * Login: root 15 | * Password: Pa55w0rd 16 | 17 | Click on *Projects* > *Explore Projects* > *All* 18 | 19 | .. image:: ../../_static/class1/module1/img009.png 20 | :align: center 21 | :scale: 50% 22 | 23 | **my-webapp-ci-cd-demo** contains the application definition and the *ADC services* we want to attach to it. 24 | It leverages the AS3 definition of a service. It is owned by the user/group called *TenantA* 25 | 26 | **ADC Services** contains all the services tied to this User/Tenant. It will contain all the different services needed 27 | by the application defined in this tenant. It is owned by the user/group called *TenantA* 28 | 29 | .. note:: it is worth highlighting that in each repo, we leverage the dev branch. The idea is to explain how you can 30 | create a CI/CD pipeline for the dev branch and replicate the same process for the *master* or *prod* branch. For this 31 | demo, we will use the dev branch. Make sure to select the right branch when browsing *GitLab*. 32 | 33 | **Security-Policies** contains all the approved *Web Application Firewall* policies. People can retrieve them to use on their 34 | WAF solution. It is owned by the user/group called *Larry* 35 | 36 | Gitlab setup - my-webapp-ci-cd-demo 37 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 38 | 39 | Once you've selected the *dev* branch, you should see different folders in the **my-webapp-ci-cd-demo** repo. 40 | 41 | .. image:: ../../_static/class1/module1/img002.png 42 | :align: center 43 | :scale: 50% 44 | 45 | * *jenkins*: This is folder that will be consumed by the CI Server. It contains all the right scripts to process this folder and 46 | do the app deployment, update the ADC-services repo, ... 47 | * *my-adc-cluster*: this folder will contain the ADC cluster target to host our ADC service. It contains the name of the targetted 48 | cluster. Consul will provide us with all the right information related to it: BIG-IP IPs, credentials, 49 | ... You will also see the service we want to deploy on our ADC cluster. Take some time to review the service definition. 50 | You will see that: we leverage the AS3 service definition schema, pool members are not *yet* defined and that our service 51 | definition includes a WAF policy. 52 | 53 | .. image:: ../../_static/class1/module1/img012.png 54 | :align: center 55 | :scale: 50% 56 | 57 | The pool member(s) are not defined already because the application is not deployed. In a dynamic environment, you can't guess 58 | what the pool member(s) will be. We will need to deploy the application, get the pool member(s) information and update our service 59 | definition accordingly. 60 | * *my-app-definition*: this folder contains the app definition. It contains files that we will use to deploy the app on Openshift: 61 | deployment, services, route 62 | * *test*: this folder contains multiple tests to do against the app to ensure it is up and running as expected. 63 | 64 | 65 | .. note:: it is worth highlighting that the ADC service definition is based on the AS3 schema 66 | but only contains the service definition! not the full tenant definition needed by **AS3**. 67 | The whole **AS3** declaration for this tenant is within the **ADC-Services** repo that we will 68 | review later. 69 | 70 | There is also an important file at the root of the repo: *jenkinsFile*. 71 | When you trigger a webhook from GitLab to Jenkins, the first thing Jenkins will do is to 72 | retrieve this repo. 73 | From here, it will process the jenkinsFile to know what to do (there are other ways but that is 74 | how we will proceed here). The whole pipeline is defined in this file and it will execute scripts 75 | in the jenkins folder 76 | 77 | Every time this repo is updated, it will trigger an already defined *WebHook*. 78 | This *WebHook* will trigger a pipeline on the Jenkins server. In your **my-webapp-ci-cd-demo** repo, 79 | Go to *Setting* > *Integration* to review the WebHook defined. 80 | 81 | .. image:: ../../_static/class1/module1/img003.png 82 | :align: center 83 | :scale: 50% 84 | 85 | You can learn more about *WebHooks* here: WebHooks_. 86 | 87 | .. _WebHooks: https://docs.gitlab.com/ee/user/project/integrations/webhooks.html 88 | 89 | Here you can see that *GitLab* is setup to send a "signal" to: 90 | 91 | .. code:: 92 | 93 | http://172.18.0.3:8080/project/my-webapp-ci-cd-demo-dev 94 | 95 | 172.18.0.3 is the IP Address of our container running *Jenkins* (it's a docker network). 96 | The URI: */project/my-webapp-ci-cd-demo-dev* defines a project/job/pipeline defined on *Jenkins*. 97 | This is our pipeline. 98 | 99 | This specific pipeline will be triggered every time we update our **my-webapp-ci-cd-demo** repo. 100 | 101 | .. note:: There is a file called *DELETE* at the root of the **my-webapp-ci-cd-demo** repo. This file 102 | is needed to do the IaC demo. We will explain this in module2. 103 | 104 | .. image:: ../../_static/class1/module1/img004.png 105 | :align: center 106 | :scale: 30% 107 | 108 | Gitlab setup - ADC-Services 109 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 110 | 111 | If you go into the repo **ADC-Services** and select the *dev* branch, you should see this: 112 | 113 | .. image:: ../../_static/class1/module1/img005.png 114 | :align: center 115 | :scale: 30% 116 | 117 | Here you should have a folder(s) (here one). Each directory represents a BIG-IP cluster. 118 | In this case, we have a single cluster called **cluster-nicolas** 119 | 120 | .. note:: this cluster is defined in consul so that we can automatically retrieve its IP information, 121 | credentials and which port is used to access the management interface. We could add more cluster here 122 | if needed 123 | 124 | The different python scripts available here will be used by the *jenkinsFile* to execute the *Jenkins pipeline* 125 | called **adc-services-dev**. 126 | 127 | if you check the folder **cluster-nicolas**, you'll see that its empty for now. The reason is that we 128 | haven't deployed yet an application in this cluster. There is only one file called *OWNER*. 129 | 130 | .. image:: ../../_static/class1/module1/img006.png 131 | :align: center 132 | :scale: 30% 133 | 134 | The main reason for this *OWNER* file was to put something into the folder. If the folder was empty, it wouldn't 135 | show up in *GitLab*. 136 | 137 | We can also check the *WebHook* created by going into *Settings* > *Integration*: 138 | 139 | .. image:: ../../_static/class1/module1/img007.png 140 | :align: center 141 | :scale: 30% 142 | 143 | .. warning:: There is something really specific about this **ADC-Services** repo: **IT IS NEVER HANDLED MANUALLY**. 144 | The expectation here is that the different applications deployed via *GitLab* will automatically update accordingly 145 | this repo. This is something we will be able to test/confirm when doing module2. 146 | 147 | Gitlab setup - Larry/Security-Policies 148 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 149 | 150 | Here there is no *dev* branch. We only have already "approved" security policies that can be consumed by 151 | the different application teams. They can retrieve those security policies and import them into their *CI/CD pipelines*. 152 | 153 | If you browse this repository, you'll see the following: 154 | 155 | .. image:: ../../_static/class1/module1/img010.png 156 | :align: center 157 | :scale: 30% 158 | 159 | Click on the folder *policies* to see what is available to the application teams. 160 | 161 | .. image:: ../../_static/class1/module1/img011.png 162 | :align: center 163 | :scale: 30% 164 | 165 | Here we see that people have access to three different WAF policies. In our demo, we will use the policy called 166 | *asm-policy-linux-high.xml*. -------------------------------------------------------------------------------- /docs/class1/module1/lab2.rst: -------------------------------------------------------------------------------- 1 | Review Jenkins setup 2 | -------------------- 3 | 4 | the next DevOps tools we leverage in this environment is *Jenkins*. It is a *CI Server* that we will use 5 | to execute DevOps *pipeline*. 6 | 7 | Here is a good overview of Jenkins_ and how to work with *pipelines*. 8 | 9 | .. _Jenkins: https://www.infoworld.com/article/3239666/devops/what-is-jenkins-the-ci-server-explained.html 10 | 11 | Connect to your *Jenkins* Server. It should be http://:1180/ 12 | 13 | * Login: TenantA 14 | * Password: Pa55w0rd 15 | 16 | .. image:: ../../_static/class1/module1/img008.png 17 | :align: center 18 | :scale: 50% 19 | 20 | On the main page, we can see two different items: 21 | 22 | * adc-services-dev 23 | * my-webapp-ci-cd-demo-dev 24 | 25 | Those 2 items are pipelines. Each of them will be *triggered* by the *WebHooks* we have seen during the *GitLab* 26 | review. You can see those *WebHooks* by going back to the *GitLab* interface and go into *Settings* > 27 | *Integration* in each of the different repo **my-webapp-ci-cd-demo** and **ADC-Services** (Login: TenantA, 28 | Password: Pa55w0rd) 29 | 30 | .. image:: ../../_static/class1/module1/img003.png 31 | :align: center 32 | :scale: 50% 33 | 34 | | 35 | 36 | .. image:: ../../_static/class1/module1/img007.png 37 | :align: center 38 | :scale: 50% 39 | 40 | The my-webapp-ci-cd-demo-dev pipeline 41 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 42 | 43 | On the *Jenkins* GUI, click on the pipeline called *my-webapp-ci-cd-demo-dev* 44 | 45 | .. image:: ../../_static/class1/module1/img013.png 46 | :align: center 47 | :scale: 50% 48 | 49 | You should see something like this : 50 | 51 | .. image:: ../../_static/class1/module1/img015.png 52 | :align: center 53 | :scale: 50% 54 | 55 | If you have already triggered the pipeline, the build section may look like this: 56 | 57 | .. image:: ../../_static/class1/module1/img014.png 58 | :align: center 59 | :scale: 50% 60 | 61 | A *build* is one execution of your *pipeline*. It will show: 62 | 63 | * the different steps of your pipeline (here we can see *build app*, *test app*, ...) 64 | * if each step is successful or not. If a step fail, it will be red and the pipeline will stop immediately 65 | 66 | if you click on a build number, you will be able to review in details this *pipeline* execution. It will 67 | help you review its execution and whether it has been executed successfully or not 68 | 69 | .. image:: ../../_static/class1/module1/img016.png 70 | :align: center 71 | :scale: 50% 72 | 73 | We can review a few options in the left menu : 74 | 75 | * *Build now*: This would trigger the execution of the *pipeline* even if *GitLab* didn't send a *WebHook*. 76 | it's convenient when working on a pipeline for troubleshooting purposes 77 | * *Configure*: Give you access to the setup of this *pipeline*. We will review it later 78 | * *GitHub*: Link to send you to the related *Github*/*GitLab* repo. It's defined in the setup. 79 | 80 | We can click on *Configure* to review the setup of this *pipeline*. 81 | 82 | .. image:: ../../_static/class1/module1/img017.png 83 | :align: center 84 | :scale: 50% 85 | 86 | | 87 | 88 | .. image:: ../../_static/class1/module1/img018.png 89 | :align: center 90 | :scale: 50% 91 | 92 | Let's review the different sections of our *pipeline* 93 | 94 | Scroll down to the *Github* section: 95 | 96 | .. image:: ../../_static/class1/module1/img019.png 97 | :align: center 98 | :scale: 50% 99 | 100 | Here we reference our related *GitLab* project. We specify the URL to it and how to authenticate on 101 | this repo (in case it's needed). We reference *GitLab local* which has been setup previously. You 102 | can check the authentication that has been setup here: *Jenkins Home page* > *Manage Jenkins* > 103 | *Configure System* and scroll down to the *GitLab* section 104 | 105 | .. image:: ../../_static/class1/module1/img020.png 106 | :align: center 107 | :scale: 50% 108 | 109 | In the *Build Triggers* section of your *pipeline*, you can see the following: 110 | 111 | .. image:: ../../_static/class1/module1/img021.png 112 | :align: center 113 | :scale: 50% 114 | 115 | Here we explain when a new *build* of our *pipeline* should be triggered: We explain that if we receive 116 | a *WebHook* to this specific URL: *http://172.18.0.3:8080/project/my-webapp-ci-cd-demo-dev* , we will 117 | trigger a *build* 118 | 119 | If you remember the *GitLab* setup, we specified for the **my-webapp-ci-cd-demo** repo a *WebHook* 120 | targetting this URL: 121 | 122 | .. image:: ../../_static/class1/module1/img003.png 123 | :align: center 124 | :scale: 50% 125 | 126 | Go to the last section of our setup, called *Pipeline* 127 | 128 | .. image:: ../../_static/class1/module1/img022.png 129 | :align: center 130 | :scale: 50% 131 | 132 | Here it explains how our *pipeline* will be executed: 133 | 134 | * we specify the *GitHub*/*GitLab* repo and *branch* to retrieve automatically when the *build* 135 | is triggered. Here it means that as soon as a new *build* is happening, *Jenkins* will 136 | automatically retrieve this repo to make it available for processing 137 | * we specify the *Script Path*. Here it is the jenkinsFile that contains the logic of our pipeline 138 | and what needs to be executed. Here we specify the name of the file: *jenkinsFile* and that it's 139 | at the root of the repo we retrieved : **my-webapp-ci-cd-demo** 140 | 141 | .. image:: ../../_static/class1/module1/img023.png 142 | :align: center 143 | :scale: 50% 144 | 145 | If you want to know more about jenkinsFile, you can check this JenkinsFileLink_ 146 | 147 | .. _JenkinsFileLink: https://jenkins.io/doc/book/pipeline/jenkinsfile/ 148 | 149 | This is our *jenkinsFile*: 150 | 151 | :: 152 | 153 | #!groovy 154 | 155 | pipeline { 156 | agent any 157 | stages { 158 | stage('Setup Env') { 159 | steps { 160 | sh 'python --version' 161 | echo 'Setup environment and needed modules' 162 | sh 'git config --global user.email "n.menant@f5.com"' 163 | sh 'git config --global user.name "Nicolas Menant"' 164 | echo 'Cloning ADC-Services repo' 165 | sh 'git clone http://TenantA:Pa55w0rd@172.18.0.2/nicolas/ADC-Services.git' 166 | dir('ADC-Services') { 167 | sh 'git checkout dev' 168 | } 169 | } 170 | } 171 | stage('Build App') { 172 | steps { 173 | echo 'Building Application...' 174 | sh 'python jenkins/deploy-app/deploy-app.py' 175 | } 176 | } 177 | stage('Test App') { 178 | steps { 179 | echo 'Testing Application...' 180 | sh 'sleep 10' 181 | sh 'python tests/run_tests.py' 182 | } 183 | } 184 | stage('Build ADC Services definition') { 185 | steps { 186 | echo 'Build ADC Services definition...' 187 | sh 'python jenkins/adc-services/create-adc-services-definition.py' 188 | } 189 | } 190 | stage('Test ADC Service definition') { 191 | steps { 192 | echo 'Testing ADC Service Definition ..' 193 | sh 'python jenkins/adc-services/test-service-definition.py' 194 | } 195 | } 196 | stage('Push ADC Service definition') { 197 | steps { 198 | sh 'echo ${GIT_URL##*/} > appname.tmp' 199 | sh 'python jenkins/adc-services/push-adc-services-definition.py' 200 | dir('ADC-Services') { 201 | sh 'git add .' 202 | sh 'git commit -m "update from $GIT_URL / $GIT_BRANCH=`cat ../appname.tmp`###`cat ../my-adc-cluster/target-cluster`"' 203 | sh 'git push' 204 | } 205 | } 206 | } 207 | } 208 | post { 209 | always { 210 | cleanWs() 211 | } 212 | success { 213 | updateGitlabCommitStatus name: 'build', state: 'success' 214 | } 215 | failure { 216 | updateGitlabCommitStatus name: 'build', state: 'failed' 217 | } 218 | } 219 | } 220 | 221 | 222 | Our jenkinsFile will do the following: 223 | 224 | * Retrieve another *GitLab* repo: **ADC-Services**. Once the app is deployed, we want to update this 225 | repo with the new service definition 226 | * Execute the file *jenkins/deploy-app/deploy-app.py* in the repo **my-webapp-ci-cd-demo** we retrieved. 227 | it is the step called *Build App* in the *build* 228 | * Execute the file *tests/run_tests.py* in the repo **my-webapp-ci-cd-demo** we retrieved. 229 | it is the step called *Test App* in the *build* 230 | * Execute the file *jenkins/adc-services/create-adc-services-definition.py* in the repo 231 | **my-webapp-ci-cd-demo** we retrieved. it is the step called *Build ADC Services definition* in the 232 | *build* 233 | * Execute the file *jenkins/adc-services/test-service-definition.py* in the repo 234 | **my-webapp-ci-cd-demo** we retrieved. it is the step called *Test ADC Service definition* in the 235 | *build* 236 | * Execute the file *jenkins/adc-services/push-adc-services-definition.py* in the repo 237 | **my-webapp-ci-cd-demo** we retrieved. it is the step called *Push ADC Service definition* in the 238 | *build*. This script will update the repo **ADC-Services** and then will push the changes to *GitLab* 239 | 240 | The adc-services-dev pipeline 241 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 242 | 243 | The other *pipeline* available on *Jenkins* is called **adc-services-dev**. 244 | 245 | .. image:: ../../_static/class1/module1/img024.png 246 | :align: center 247 | :scale: 50% 248 | 249 | You can click on *Configure* to review its setup. 250 | 251 | .. image:: ../../_static/class1/module1/img025.png 252 | :align: center 253 | :scale: 50% 254 | 255 | Here a summary of its configuration: 256 | 257 | * It's "linked" to the *GitLab* repo **ADC-Services** 258 | * It's setup to be triggered by a *WebHook* going to *http://172.18.0.3:8080/project/adc-services-dev*. 259 | Remember that the **ADC-Services** *GitLab* repository has been setup to reach to this URL when a commit 260 | happen. 261 | * It will rely on the script path *jenkinsFile* setup in the **ADC-Services** repo (root directory) 262 | 263 | .. image:: ../../_static/class1/module1/img026.png 264 | :align: center 265 | :scale: 50% 266 | 267 | | 268 | 269 | .. image:: ../../_static/class1/module1/img027.png 270 | :align: center 271 | :scale: 50% 272 | 273 | | 274 | 275 | .. image:: ../../_static/class1/module1/img027.png 276 | :align: center 277 | :scale: 50% 278 | 279 | Here is the jenkinsFile in the **ADC-Services** repo: 280 | 281 | :: 282 | 283 | #!groovy 284 | 285 | pipeline { 286 | agent any 287 | stages { 288 | stage('Setup Env') { 289 | steps { 290 | sh 'python --version' 291 | echo 'Setup environment and needed modules' 292 | } 293 | } 294 | stage('Build AS3 Declaration') { 295 | steps { 296 | echo 'Building Application...' 297 | sh 'git log -1 > commit_msg.tmp' 298 | sh 'python create-as3-declaration.py `cat commit_msg.tmp | grep "=" | rev | cut -d= -f1 | rev` $GIT_URL $GIT_BRANCH' 299 | } 300 | } 301 | stage('Test AS3 Declaration') { 302 | steps { 303 | echo 'Test AS3 Declaration...' 304 | sh 'python test-adc-services.py' 305 | } 306 | } 307 | stage('Deploy AS3 Declaration') { 308 | steps { 309 | echo 'Deploy ADC Services' 310 | sh 'python deploy-adc-services.py' 311 | } 312 | } 313 | stage('Test ADC and App') { 314 | steps { 315 | echo 'Testing ADC and Application...' 316 | sh 'python test-app-adc-services.py `cat commit_msg.tmp | grep "=" | rev | cut -d= -f1 | rev`' 317 | } 318 | } 319 | } 320 | post { 321 | always { 322 | cleanWs() 323 | } 324 | success { 325 | updateGitlabCommitStatus name: 'build', state: 'success' 326 | } 327 | failure { 328 | updateGitlabCommitStatus name: 'build', state: 'failed' 329 | } 330 | } 331 | 332 | Here you can review the different "steps" of the pipeline and which scripts are tied to each steps. 333 | -------------------------------------------------------------------------------- /docs/class1/module1/module1.rst: -------------------------------------------------------------------------------- 1 | Module 1 - Review the setup 2 | =========================== 3 | 4 | In this module, we will show you how to do a demo of IaC (*Infrastructure as Code*) 5 | with F5 solutions: 6 | 7 | * We will use GitLab to host our application definition and 8 | also services tied to it : *ADC* and *Web Application Firewall* services 9 | * We will trigger our CI/CD *pipeline* by updating our *Gitlab* repo 10 | * We will monitor how our application is deployed. 11 | * We will ensure that the relevant *ADC* services are deployed on our *BIG-IP* 12 | 13 | To do this demo, we need to get a proper understanding of the setup. 14 | 15 | Through Module1, you'll review the overall setup and be able to trigger a demo of IaC 16 | 17 | You have a preso you can use/review to see the overall workflow, Here is the Preso_. 18 | 19 | .. _Preso: https://github.com/nmenant/ci-cd-env-setup/blob/master/docs/Preso/CI-CD%20Local%20Demo.pptx 20 | 21 | Here is the workflow of the solution: 22 | 23 | #. We leverage a *GitLab* repo called **my-webapp-ci-cd-demo** that contains our app definition and the *ADC Services* tied to it. 24 | #. We update this repo to trigger a *WebHook* that will ask our CI Server to retrieve this repo and process its *jenkinsFile* 25 | #. Our CI server will do the following: 26 | 27 | * retrieve the repo 28 | * deploy the app based on its definition 29 | * test that the app is up and running based on the tests defined in the repo 30 | * review the *ADC services* definition in the repo and ensure its fine. 31 | * Update another repo called **ADC-Services** to add its ADC service definition and the tests to validate its proper deployment 32 | 33 | #. Since we updated our **ADC-Services** repo on *GitLab*, it will also send a *WebHook* to *Jenkins* to trigger another *pipeline* 34 | 35 | #. Our CI server will execute the relevant pipeline that will do the following: 36 | 37 | * review the commit log to know which app has been added 38 | * find in which cluster this app has been added 39 | * review and put all the app services for this cluster in a single AS3 declaration 40 | * Test this tenant definition against the relevant cluster 41 | * Deploy this declaration 42 | * Trigger the tests tied to this app through BIG-IP to make sure it is still successfull 43 | 44 | **Exercises in this Module** 45 | 46 | .. toctree:: 47 | :maxdepth: 1 48 | :glob: 49 | 50 | lab* -------------------------------------------------------------------------------- /docs/class1/module2/lab1.rst: -------------------------------------------------------------------------------- 1 | Deploy a new application 2 | ------------------------ 3 | 4 | Prepare the demo 5 | ^^^^^^^^^^^^^^^^ 6 | 7 | Here is the recommended worklow to do this demo. 8 | 9 | Open different tabs in your browser: 10 | 11 | * Open 3 *GitLab* tabs: 12 | 13 | * one for the **my-webapp-ci-cd-demo** repo. **don't forget to go to the DEV branch** 14 | (login: TenantA,Password: Pa55w0rd) 15 | * one for the **ADC-Services** repo. **don't forget to go to the DEV branch**. 16 | (Login: TenantA,Password: Pa55w0rd) 17 | * one for the **Security Policies** repo. (login: root, Password: Pa55w0rd - go to *Projects* > 18 | *Explore Projects* > *All*) 19 | 20 | * Open 2 *Jenkins* tabs: one for the **my-webapp-ci-cd-demo-dev** project and the other one 21 | for the **adc-services-dev** project. **don't forget to go to the DEV branch**. 22 | * Open 1 tab on your BIG-IP to show its configuration (highlight that there is no *tenanta-dev* partition) 23 | 24 | .. note:: if you use the **UDF** Blueprint, the BIG-IP login/password is admin/admin. 25 | 26 | * Open 1 tab on your minishift deployment (*login*: dev, *password*: dev). Go in the *tenanta-dev* project 27 | 28 | .. note:: if you use the **UDF** Blueprint, we can't access directly *Minishift* unfortunately. 29 | Use the the **Jumphost** to access *Minishift* 30 | 31 | .. WARNING:: if you use F5 private cloud UDF, make sure minishift is up and running. If it's not, check the 32 | steps mentioned in the documentation of the blueprint/deployment. You likely need to run again: 33 | 34 | :: 35 | 36 | /home/centos/ci-cd-env-setup/build-env.sh minishift 37 | 38 | if it doesn't work, you can try the following: 39 | 40 | :: 41 | 42 | cd /home/centos/ci-cd-env-setup 43 | minishift stop 44 | minishift delete 45 | rm -rf minishift 46 | ./build-env.sh minishift 47 | 48 | 49 | Make sure that: 50 | 51 | * the *DELETE* file exists in the **my-webapp-ci-cd-demo** repo. 52 | * the *cluster-nicolas* folder in the **ADC-Services** repo should be empty except for an *OWNER* file. 53 | * Your BIG-IP configuration doesn't have a *tenanta-dev* partition 54 | * You don't have any App deployed in your minishift system in the tenanta-dev project. 55 | 56 | .. image:: ../../_static/class1/module2/img002.png 57 | :align: center 58 | :scale: 30% 59 | 60 | | 61 | 62 | .. image:: ../../_static/class1/module2/img007.png 63 | :align: center 64 | :scale: 30% 65 | 66 | | 67 | 68 | .. image:: ../../_static/class1/module2/img008.png 69 | :align: center 70 | :scale: 30% 71 | 72 | | 73 | 74 | .. image:: ../../_static/class1/module2/img009.png 75 | :align: center 76 | :scale: 30% 77 | 78 | | 79 | 80 | Before triggering the application deployment, it may good good to give a brief overview of the setup: 81 | 82 | * Highlights the different DevOps tools used: Gitlab, Jenkins, Consul, Minishift, BIG-IP, AS3 83 | * Explain what are the 3 *GitLab* repo and who owns each (TenantA is an application owner while Larry 84 | is part of the SecOps team). 85 | * Describe how *WebHooks* will trigger our *Jenkins pipelines* 86 | * Explain how the *my-webapp-ci-cd-demo-dev* *pipeline* will automatically manage the **ADC-Services** repo. 87 | * Explain that the **ADC-Services** repo becomes the "*Source of Truth*" of ADC services deployment (you can 88 | talk about *Infrastructure as Code (IaC)* 89 | 90 | Everything is detailed in module1. 91 | 92 | Trigger the application deployment 93 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 94 | 95 | In this demo, we use the *DELETE* file to leverage either the APP deployment, or its removal: 96 | 97 | * if the *DELETE* file is added to the repo: we will remove the application and its ADC services 98 | * if the *DELETE* file is removed from the repo: we will deploy the application and its ADC services 99 | 100 | If everything is up and running as expected, you'll only need to do the following to trigger the deployment 101 | of the application: 102 | 103 | * Remove the *DELETE* file from the **my-webapp-ci-cd-demo** repo. 104 | * if you use an editor instead of the GitLab UI, make sure to commit your changes to trigger the WebHook. 105 | 106 | Here is how to do it from the *GitLab* UI: 107 | 108 | * Open the tab showing your **my-webapp-ci-cd-demo** repo and click on the *DELETE* file. 109 | (make sure to be in the *dev* repo!) 110 | 111 | .. image:: ../../_static/class1/module2/img004.png 112 | :align: center 113 | :scale: 30% 114 | 115 | * Click on the red *DELETE* button on the right 116 | 117 | .. image:: ../../_static/class1/module2/img005.png 118 | :align: center 119 | :scale: 30% 120 | 121 | * Confirm that you want to delete the file by clicking on the *Delete File* button. 122 | 123 | .. image:: ../../_static/class1/module2/img006.png 124 | :align: center 125 | :scale: 30% 126 | 127 | As soon as you'll do it from the GUI of *GitLab*, it will be committed. 128 | 129 | .. image:: ../../_static/class1/module2/img010.png 130 | :align: center 131 | :scale: 30% 132 | 133 | At this moment, switch to the *Jenkins* tab showing the pipeline called **my-webapp-ci-cd-demo-dev**. 134 | You will see a new *build* being triggered after a few seconds. 135 | 136 | .. image:: ../../_static/class1/module2/img011.png 137 | :align: center 138 | :scale: 30% 139 | 140 | Here you can see the different steps being processed in this pipeline: 141 | 142 | * *build app*: the application gets deployed in Openshift 143 | * *test app*: we run the different tests against the application and make sure we get the right response code 144 | (defined in the folder **tests** in the repo **my-webapp-ci-cd-demo**) 145 | * *build ADC services definition*: we extract the IP of the application to add it to the service definition 146 | provided in the **my-webapp-ci-cd-demo** repo. 147 | * *Test ADC Service definition*: We test this service definition against the targetted BIG-IP cluster to 148 | ensure it is properly defined without errors 149 | * *Push ADC Service definition*: We update the repo **ADC-Services** in our *Gitlab* repo to add this application 150 | in the right cluster. Here it is in the **cluster-nicolas** directory 151 | 152 | If everything goes as expected, you should see the whole line of the build being green: 153 | 154 | .. image:: ../../_static/class1/module2/img012.png 155 | :align: center 156 | :scale: 30% 157 | 158 | .. note:: if you have a step failing, the whole build will stop. To troubleshoot it, don't hesitate to click on the build 159 | number and then *Console Output* 160 | 161 | .. image:: ../../_static/class1/module2/img014.png 162 | :align: center 163 | :scale: 30% 164 | 165 | .. image:: ../../_static/class1/module2/img015.png 166 | :align: center 167 | :scale: 30% 168 | 169 | Here you'll see the whole pipeline being executed with all the different outputs. Check for any relevant error messages 170 | 171 | We can check that the application has been deployed successfully, go to your minishift tab and you should see 172 | a new application: 173 | 174 | .. image:: ../../_static/class1/module2/img016.png 175 | :align: center 176 | :scale: 30% 177 | 178 | You can click on the route link to ensure the application works as expected. 179 | 180 | .. image:: ../../_static/class1/module2/img017.png 181 | :align: center 182 | :scale: 30% 183 | 184 | | 185 | 186 | .. image:: ../../_static/class1/module2/img018.png 187 | :align: center 188 | :scale: 30% 189 | 190 | The last step of the build updated the **ADC-Services** repo to add our new application services. 191 | 192 | Go to the tab opened on *GitLab* and on your **ADC-Services** repo (make sure to be in the **dev** branch!). 193 | 194 | Click on the folder **cluster-nicolas**. you should see a new directory called **my-webapp-ci-cd-demo**. 195 | This was pushed by our pipeline processed by *Jenkins* 196 | 197 | .. image:: ../../_static/class1/module2/img019.png 198 | :align: center 199 | :scale: 30% 200 | 201 | Click on this newly provisioned folder **my-webapp-ci-cd-demo** 202 | 203 | .. image:: ../../_static/class1/module2/img019.png 204 | :align: center 205 | :scale: 30% 206 | 207 | You'll see two files: 208 | 209 | * service-definition: it contains the service definition that was provided by the app owner in the other repo. 210 | This service definition was updated with the relevant pool member delivering the app (minishift IP) 211 | * tests.json: we also copied the *tests* file from the application repo since we want to make sure the same tests 212 | will behave in an identical manner through the ADC 213 | 214 | We can review the *commit* that was done by the *CI server* *Jenkins* by clicking on the *commit* menu 215 | 216 | .. image:: ../../_static/class1/module2/img021.png 217 | :align: center 218 | :scale: 30% 219 | 220 | Here we can see that the commit message provide some useful information that will be used later: the application name and 221 | which BIG-IP cluster has been targetted for this new ADC service. 222 | 223 | Since we updated the **ADC-Services** repo, it also triggered a *WebHook* to the *CI Server* *Jenkins*. Go to your 224 | other tab on *Jenkins* related to the project called **adc-services-dev**. You will see that a *build* has also 225 | been triggered: 226 | 227 | .. image:: ../../_static/class1/module2/img013.png 228 | :align: center 229 | :scale: 30% 230 | 231 | Here are the different steps of this build: 232 | 233 | * *Build AS3 Declaration*: We identify which cluster has been updated based on the commit log that we reviewed previously. 234 | We will parse all the application folders in the relevant BIG-IP cluster to create a single AS3 declaration for the whole 235 | tenant. The AS3 tenant name will be based on the *Gitlab* tenant (ie TenantA) and the related branch (*dev*) 236 | * *Test AS3 Declaration*: we do a *dry run* of the AS3 declaration to make sure no errors, mistakes are identified 237 | * *Deploy AS3 Declaration*: if the previous *dry run* is successful, we *deploy* this time the AS3 declaration 238 | * *Test ADC and App*: We run the different tests against the updated BIG-IP to ensure all the tests still behave as expected 239 | 240 | If everything is processed properly, the whole build line should be green as you may see on the picture above. 241 | 242 | You can go to your BIG-IP tab, to see if a new application service has been deployed: 243 | 244 | * Select the partition *tenanta-dev* 245 | * check the virtual server and its description. The description of the VS will be the name of the application to which we appended the branch name 246 | 247 | .. image:: ../../_static/class1/module2/img022.png 248 | :align: center 249 | :scale: 30% 250 | 251 | Check the settings of the Virtual Server to show that a WAF policy has been assigned to it. 252 | 253 | You can try to reach the application through the BIG-IP now. Be aware that you'll need to either: 254 | 255 | * update your hosts file to add the minishift/openshift FQDN of the app and tie it to your virtual server IP 256 | * use the IP but you need to enforce a *Host header* with the right fqdn 257 | 258 | This is because Openshift/Minishift route based on the FQDN of the app. 259 | 260 | .. image:: ../../_static/class1/module2/img017.png 261 | :align: center 262 | :scale: 30% 263 | 264 | In this example, the FQDN to use is : my-frontend-route-tenanta-dev.192.168.143.212.nip.io 265 | -------------------------------------------------------------------------------- /docs/class1/module2/lab2.rst: -------------------------------------------------------------------------------- 1 | Remove the application 2 | ---------------------- 3 | 4 | We expect that you still have the different tabs opened during the previous lab: 5 | 6 | * 2 *GitLab* tabs: one for the **my-webapp-ci-cd-demo** repo and the other one for the 7 | **ADC-Services** repo. **don't forget to go to the DEV branch**. 8 | * 2 *Jenkins* tabs: one for the **my-webapp-ci-cd-demo-dev** project and the other one 9 | for the **adc-services-dev** project. **don't forget to go to the DEV branch**. 10 | * 1 tab on your BIG-IP to show its configuration 11 | * 1 tab on your minishift deployment (*login*: dev, *password*: dev). Go in the *tenanta-dev* project 12 | 13 | Trigger the removal 14 | ^^^^^^^^^^^^^^^^^^^ 15 | 16 | To trigger the removal of the application, it is fairly straightforward: we simply need to add a *DELETE* 17 | file back into the **my-webapp-ci-cd-demo** repo. 18 | 19 | #. Go to the tab opened showing your repo **my-webapp-ci-cd-demo** repo. Make sure to be in the **dev** branch 20 | #. Click on the *+* sign and select *new file* 21 | 22 | .. image:: ../../_static/class1/module2/img023.png 23 | :align: center 24 | :scale: 30% 25 | 26 | #. Call the file *DELETE*. If you want to put a custom *commit* message, feel free to do so. 27 | #. Click on *Commit changes* 28 | 29 | .. image:: ../../_static/class1/module2/img024.png 30 | :align: center 31 | :scale: 30% 32 | 33 | | 34 | 35 | .. image:: ../../_static/class1/module2/img025.png 36 | :align: center 37 | :scale: 30% 38 | 39 | As soon as you've done this. The *WebHook* will be triggered and you'll see a new build happening on 40 | the *CI Server Jenkins*. Go to the tab open on *Jenkins* and showing the projet **my-webapp-ci-cd-demo-dev** 41 | 42 | .. image:: ../../_static/class1/module2/img026.png 43 | :align: center 44 | :scale: 30% 45 | 46 | Here we can see that a new build has been processed and its all green. It means that: 47 | 48 | * The application should have been removed from Minishift: 49 | 50 | .. image:: ../../_static/class1/module2/img027.png 51 | :align: center 52 | :scale: 30% 53 | 54 | * Our *GitLab* repo **ADC-Services** should have the directory called **cluster-nicolas** empty except for an *OWNER* 55 | file. Validate this by going to your opened tab on *GitLab* and showing the **ADC-Services* repo: 56 | 57 | .. image:: ../../_static/class1/module2/img028.png 58 | :align: center 59 | :scale: 30% 60 | 61 | * Since we updated the *GitLab* **ADC-Services** repo, the other *pipeline* should have been triggered. Go to your tab 62 | opened on *Jenkins* and on the job called **adc-services-dev**. A new build should have been triggered: 63 | 64 | .. image:: ../../_static/class1/module2/img029.png 65 | :align: center 66 | :scale: 30% 67 | 68 | * The pipeline has been successfull so we can validate that the configuration was also removed from our BIG-IP. Since the 69 | partition is empty, AS3 will have removed it also. There is no more *tenanta-dev* partition. 70 | 71 | .. image:: ../../_static/class1/module2/img030.png 72 | :align: center 73 | :scale: 30% 74 | -------------------------------------------------------------------------------- /docs/class1/module2/module2.rst: -------------------------------------------------------------------------------- 1 | Module 2 - Trigger the IaC Demo 2 | =============================== 3 | 4 | In this module, we will show you how to do a demo of IaC (*Infrastructure as Code*) 5 | with F5 solutions: 6 | 7 | * We will use GitLab to host our application definition and 8 | also services tied to it : *ADC* and *Web Application Firewall* services 9 | * We will trigger our CI/CD *pipeline* by updating our *Gitlab* repo 10 | * We will monitor how our application is deployed. 11 | * We will ensure that the relevant *ADC* services are deployed on our *BIG-IP* 12 | 13 | To do this demo, we need to get a proper understanding of the setup. 14 | 15 | Through Module1, we have reviewed the overall setup. In Module2, we will see how to trigger a demo of IaC 16 | 17 | You have a preso you can use/review to see the overall workflow, Here is the Preso_. 18 | 19 | .. _Preso: https://github.com/nmenant/ci-cd-env-setup/blob/master/docs/Preso/CI-CD%20Local%20Demo.pptx 20 | 21 | Here is the workflow of the solution: 22 | 23 | #. We leverage a *GitLab* repo called **my-webapp-ci-cd-demo** that contains our app definition and the *ADC Services* tied to it. 24 | #. We update this repo to trigger a *WebHook* that will ask our CI Server to retrieve this repo and process its *jenkinsFile* 25 | #. Our CI server will do the following: 26 | 27 | * retrieve the repo 28 | * deploy the app based on its definition 29 | * test that the app is up and running based on the tests defined in the repo 30 | * review the *ADC services* definition in the repo and ensure its fine. 31 | * Update another repo called **ADC-Services** to add this new service definition 32 | 33 | #. Since we updated our **ADC-Services** repo on *GitLab*, it will also send a *WebHook* to *Jenkins* to trigger another *pipeline* 34 | 35 | #. Our CI server will execute the relevant pipeline that will do the following: 36 | 37 | * review the commit log to know which app has been added 38 | * find in which cluster this app has been added 39 | * review and put all the app services for this cluster in a single AS3 declaration 40 | * Test this tenant definition against the relevant cluster 41 | * Deploy this declaration 42 | * Trigger the tests tied to this app through BIG-IP to make sure it is still successfull 43 | 44 | **Exercises in this Module** 45 | 46 | .. toctree:: 47 | :maxdepth: 1 48 | :glob: 49 | 50 | lab* -------------------------------------------------------------------------------- /docs/class2/class2.rst: -------------------------------------------------------------------------------- 1 | ********************************** 2 | Class 2 - Setup our first pipeline 3 | ********************************** 4 | 5 | With Class1, we have reviewed an IaC (Infrastructure as Code) setup. 6 | 7 | In this class, we will setup a basic pipeline with *GitLab* and *Jenkins*. 8 | 9 | * Gitlab: It will host our project 10 | * Jenkins: it will be our CI Server. We will use Jenkins to retrieve the *GitLab* repo every time a change happen in it. 11 | 12 | .. toctree:: 13 | :maxdepth: 1 14 | :glob: 15 | 16 | module*/module* -------------------------------------------------------------------------------- /docs/class2/module1/lab1.rst: -------------------------------------------------------------------------------- 1 | Setup a new GitLab repo 2 | ----------------------- 3 | 4 | In this lab, we will create a new repo called **Class2** on *GitLab*. 5 | 6 | Access GitLab 7 | ^^^^^^^^^^^^^ 8 | 9 | Connect to *GitLab*. It should be http://:1080/ 10 | 11 | * Login: TenantA 12 | * Password: Pa55w0rd 13 | 14 | .. note:: If you use UDF (F5 private cloud), you ``must`` use the RDP Jumphost to access *GitLab*. 15 | You have a shortcut on Chrome to access it. 16 | 17 | .. image:: ../../_static/class2/module1/img006.png 18 | :align: center 19 | :scale: 50% 20 | 21 | | 22 | 23 | .. image:: ../../_static/class2/module1/img001.png 24 | :align: center 25 | :scale: 50% 26 | 27 | Create the new repo 28 | ^^^^^^^^^^^^^^^^^^^ 29 | 30 | Click on the *New project* button. 31 | 32 | .. image:: ../../_static/class2/module1/img002.png 33 | :align: center 34 | :scale: 50% 35 | 36 | You'll get a new page asking about the project information: 37 | 38 | * Project name: Class2 39 | * Project description: this is class 2 of the CI CD lab 40 | * Visibility level: Internal 41 | * Check the box for the *Initialize repository with a README* option 42 | 43 | 44 | .. image:: ../../_static/class2/module1/img003.png 45 | :align: center 46 | :scale: 50% 47 | 48 | .. note:: If you use UDF, don't use the GitLab HTTP access to do this. You need to use the jumphost to do this. Otherwise 49 | the project path will not be good. 50 | 51 | .. image:: ../../_static/class2/module1/img004.png 52 | :align: center 53 | :scale: 50% 54 | 55 | .. image:: ../../_static/class2/module1/img005.png 56 | :align: center 57 | :scale: 50% 58 | 59 | In the next lab, we will update our *GitLab* repo. -------------------------------------------------------------------------------- /docs/class2/module1/lab2.rst: -------------------------------------------------------------------------------- 1 | Update the GitLab repo 2 | ---------------------- 3 | 4 | Access GitLab 5 | ^^^^^^^^^^^^^ 6 | 7 | In this lab, we will update our new repo called **Class2** on *GitLab*. 8 | 9 | Connect to *GitLab*. It should be http://:1080/ 10 | 11 | * Login: TenantA 12 | * Password: Pa55w0rd 13 | 14 | .. note:: If you use UDF (F5 private cloud), you may use the RDP Jumphost to access *GitLab* 15 | or the direct HTTP access from UDF interface 16 | 17 | .. image:: ../../_static/class2/module1/img006.png 18 | :align: center 19 | :scale: 50% 20 | 21 | | 22 | 23 | .. image:: ../../_static/class2/module1/img016.png 24 | :align: center 25 | :scale: 50% 26 | 27 | | 28 | 29 | .. image:: ../../_static/class2/module1/img007.png 30 | :align: center 31 | :scale: 50% 32 | 33 | On *GitLab*, Click on the project **class2** 34 | 35 | .. image:: ../../_static/class2/module1/img008.png 36 | :align: center 37 | :scale: 50% 38 | 39 | You will see this: 40 | 41 | .. image:: ../../_static/class2/module1/img009.png 42 | :align: center 43 | :scale: 50% 44 | 45 | It is fairly rare that people will handle/manage their repositories (*repo*) through the GUI. 46 | People will use *git* commands to handle it. *git* is available through well known editors like 47 | *VS Code*, *Atom*, ... but it can also be managed through CLI. We will use our CLI to do this lab. 48 | 49 | Update the new repo 50 | ^^^^^^^^^^^^^^^^^^^ 51 | 52 | for this lab we will consider the following: 53 | 54 | * If you use your own lab, you'll need access to the VM hosting *GitLab* from your terminal (via SSH) 55 | * If you use UDF. you can either use the **Jumphost** and the *Git Bash* app OR ``open a SSH connection 56 | to the CI/CD System`` 57 | 58 | Once you are connected to your system, we need to retrieve our *repo*. Our repo is 59 | available on *Gitlab* on a URI that is structure this way: 60 | **//.git** 61 | 62 | Run the following command: 63 | 64 | .. code:: 65 | 66 | git clone http://:1080/TenantA/Class2.git 67 | 68 | 69 | .. note:: you need to make sure that *git* is installed on your system. 70 | 71 | You should see the following: 72 | 73 | .. code:: 74 | 75 | [centos@ip-10-1-1-5 ~]$ git clone http://10.1.1.5:1080/TenantA/Class2.git 76 | Cloning into 'Class2'... 77 | Username for 'http://10.1.1.5:1080': TenantA 78 | Password for 'http://TenantA@10.1.1.5:1080': 79 | remote: Enumerating objects: 3, done. 80 | remote: Counting objects: 100% (3/3), done. 81 | remote: Total 3 (delta 0), reused 0 (delta 0) 82 | Unpacking objects: 100% (3/3), done. 83 | 84 | .. note:: Remember that the login is *TenantA* and password is *Pa55w0rd* 85 | 86 | We can see now that a new directory is available called **Class2**. Go into this 87 | directory and check the content 88 | 89 | .. code:: 90 | 91 | [centos@ip-10-1-1-5 ~]$ ls 92 | ci-cd-env-setup Class2 93 | [centos@ip-10-1-1-5 ~]$ cd Class2 94 | [centos@ip-10-1-1-5 Class2]$ ls 95 | README.md 96 | [centos@ip-10-1-1-5 Class2]$ cat README.md 97 | # Class2 98 | 99 | this is class 2 of the CI CD lab 100 | 101 | Now we have a copy of our *repo* locally. However any changes done locally will not be replicated 102 | automatically on *GitLab*. 103 | 104 | run the following command: 105 | 106 | git branch 107 | 108 | You should see this: 109 | 110 | .. code:: 111 | 112 | [centos@ip-10-1-1-5 Class2]$ git branch 113 | * master 114 | 115 | This is also what we see in the GUI of *GitLab* 116 | 117 | .. image:: ../../_static/class2/module1/img011.png 118 | :align: center 119 | :scale: 50% 120 | 121 | As we can see in the GUI, right now we have only one branch and it is called **master**. 122 | Usually we consider the **master** branch, the offical branch of the *repo*. This is the 123 | branch you usually want to check for the latest viable/stable/recommended version of a 124 | *repo*. 125 | 126 | When people want to work on a new version of the project, a new feature of the project, an 127 | extension to it, ... they will create a new *branch*. By default, this new *branch* will be 128 | identical to the *master* branch until you start changing stuff in it. We will be able to 129 | merge later our changes into the **master** branch (when required) 130 | 131 | If you want to know more about *branch*, you can review this link: Branch_. 132 | 133 | .. _Branch: https://git-scm.com/book/en/v1/Git-Branching-What-a-Branch-Is 134 | 135 | Let's create our new branch, we will call it **development** 136 | 137 | run the following commands: 138 | 139 | .. code:: 140 | 141 | git branch development 142 | 143 | git branch 144 | 145 | git checkout development 146 | 147 | git branch 148 | 149 | You should see something like this: 150 | 151 | .. code:: 152 | 153 | [centos@ip-10-1-1-5 Class2]$ git branch 154 | * master 155 | [centos@ip-10-1-1-5 Class2]$ git branch development 156 | [centos@ip-10-1-1-5 Class2]$ git branch 157 | development 158 | * master 159 | [centos@ip-10-1-1-5 Class2]$ git checkout development 160 | Switched to branch 'development' 161 | [centos@ip-10-1-1-5 Class2]$ git branch 162 | * development 163 | master 164 | [centos@ip-10-1-1-5 Class2]$ 165 | 166 | When you run the ``git branch`` command, it will show you all the branches you have 167 | but also which *branch* is active. You can see the active *branch* by the "*" before 168 | the branch name 169 | 170 | We have a new branch now called **development** and we will work on it. Remember that 171 | our changes are **LOCAL**. Nothing is yet on *GitLab*. You can review this by checking 172 | your *GitLab* GUI again and look for a new *branch*. 173 | 174 | .. image:: ../../_static/class2/module1/img012.png 175 | :align: center 176 | :scale: 50% 177 | 178 | Let's update the README.md file and create a new file. 179 | 180 | To create the new file, run the following command: 181 | 182 | .. code:: 183 | 184 | echo "git is awesome" > GitRocks 185 | 186 | To update the README.md file, run the following command: 187 | 188 | .. code:: 189 | 190 | echo ".Welcome to this Lab" >> README.md 191 | 192 | If you check your folder now, you should have a new file called **Gitrocks** and an updated *README.md* file 193 | 194 | We need to push our changes on *GitLab*: 195 | 196 | .. code:: 197 | 198 | git add . 199 | 200 | This command will add files to the index 201 | 202 | .. code:: 203 | 204 | git commit -m "this is our first git push" 205 | 206 | This command will record the changes in our repository and add a message related to our changes 207 | 208 | .. code:: 209 | 210 | git push origin development 211 | 212 | This command will update the remote *repo* on *GitLab* and create the relevant *branch* on *GitLab* 213 | 214 | You should see something like this: 215 | 216 | .. code:: 217 | 218 | [centos@ip-10-1-1-5 Class2]$ git add . 219 | 220 | [centos@ip-10-1-1-5 Class2]$ git commit -m "this is our first git push" 221 | [development 1e98130] this is our first git push 222 | Committer: Cloud User 223 | Your name and email address were configured automatically based 224 | on your username and hostname. Please check that they are accurate. 225 | You can suppress this message by setting them explicitly: 226 | 227 | git config --global user.name "Your Name" 228 | git config --global user.email you@example.com 229 | 230 | After doing this, you may fix the identity used for this commit with: 231 | 232 | git commit --amend --reset-author 233 | 234 | 2 files changed, 3 insertions(+), 1 deletion(-) 235 | create mode 100644 GitRocks 236 | 237 | [centos@ip-10-1-1-5 Class2]$ git push origin development 238 | Username for 'http://10.1.1.5:1080': TenantA 239 | Password for 'http://TenantA@10.1.1.5:1080': 240 | Counting objects: 6, done. 241 | Delta compression using up to 4 threads. 242 | Compressing objects: 100% (3/3), done. 243 | Writing objects: 100% (4/4), 389 bytes | 0 bytes/s, done. 244 | Total 4 (delta 0), reused 0 (delta 0) 245 | remote: 246 | remote: To create a merge request for development, visit: 247 | remote: http://d5969ebd2af4/TenantA/Class2/merge_requests/new?merge_request%5Bsource_branch%5D=development 248 | remote: 249 | To http://10.1.1.5:1080/TenantA/Class2.git 250 | * [new branch] development -> development 251 | 252 | If you check your *GitLab* GUI, refresh the GUI. You'll see that the **master** branch 253 | doesn't have any of our changes 254 | 255 | .. image:: ../../_static/class2/module1/img014.png 256 | :align: center 257 | :scale: 50% 258 | 259 | If you click on the dropdown list where **master** is selected, you'll see that a new *branch* has been created. Select 260 | the **development** branch. 261 | 262 | .. image:: ../../_static/class2/module1/img015.png 263 | :align: center 264 | :scale: 50% 265 | 266 | Here you can see that: 267 | 268 | * we see our new file **GitRocks** 269 | * you can see that the **README.md** file has been updated 270 | 271 | .. image:: ../../_static/class2/module1/img013.png 272 | :align: center 273 | :scale: 50% 274 | 275 | -------------------------------------------------------------------------------- /docs/class2/module1/lab3.rst: -------------------------------------------------------------------------------- 1 | Merge branches 2 | -------------- 3 | 4 | If you have used a *branch* to work on a new version of your project; once 5 | your update is done, you'll want to *merge* this branch with another branch 6 | like **master** to highlight that this is the latest/recommended "version" 7 | to use. 8 | 9 | In this lab, we will merge our changes from the **development** branch to 10 | the **master** branch. 11 | 12 | Merge branch via the GUI 13 | ^^^^^^^^^^^^^^^^^^^^^^^^ 14 | 15 | Connect to *GitLab*. It should be http://:1080/ 16 | 17 | * Login: TenantA 18 | * Password: Pa55w0rd 19 | 20 | .. note:: If you use UDF (F5 private cloud), you may use the RDP Jumphost to access *GitLab* 21 | or the direct HTTP access from UDF interface 22 | 23 | .. image:: ../../_static/class2/module1/img016.png 24 | :align: center 25 | :scale: 50% 26 | 27 | | 28 | 29 | Click on the project **class2** 30 | 31 | .. image:: ../../_static/class2/module1/img008.png 32 | :align: center 33 | :scale: 50% 34 | 35 | You will see this: 36 | 37 | .. image:: ../../_static/class2/module1/img009.png 38 | :align: center 39 | :scale: 50% 40 | 41 | We can see that the **master** branch doesn't reflect the changes we did in 42 | the **development** branch. 43 | 44 | Let's merge our two **branches**. Click on *Repository* > *Branches*. 45 | 46 | .. image:: ../../_static/class2/module1/img017.png 47 | :align: center 48 | :scale: 50% 49 | 50 | On the next screen, click on *Compare*. 51 | 52 | .. image:: ../../_static/class2/module1/img018.png 53 | :align: center 54 | :scale: 50% 55 | 56 | Here we can see that we are comparing our two *branch*. What you see in **green** has been 57 | added (text or files). What is in Red has been removed/changed. 58 | 59 | .. image:: ../../_static/class2/module1/img019.png 60 | :align: center 61 | :scale: 50% 62 | 63 | This window gives us the opportunity to review the difference in our **branches** 64 | before asking for a *merge*. We are fine with those updates so we can move forward. 65 | 66 | Click on *Create merge request*. The next screen shows us that we want to do a *merge request* 67 | from **development** into **master**. 68 | 69 | We can see the following: 70 | 71 | * the *Title* of the merge request has retrieved the *commit* log we created with the ``git commit`` 72 | command 73 | * you can add a custom *Description* to your *merge request*. This is important if someone else will 74 | approve your *merge request*. The more detailed/explicit it is, the easier it will be for the reviewer 75 | to check your request 76 | 77 | .. image:: ../../_static/class2/module1/img020.png 78 | :align: center 79 | :scale: 50% 80 | 81 | Scroll down and click on *Submit merge request*. 82 | 83 | On this page, we can see our "official" *merge request*. Because we are the owner of this repo, 84 | we also have the capability to approve/reject this *merge request*. 85 | Here we can: 86 | 87 | * Approve the *merge request* by clicking on the *Merge* green button 88 | * Reject/Cancel the request by clicking on the *Close merge request* orange button 89 | * Use the discussion area to communicate with the owner of the merge request. Since it's us, 90 | there is no need here. 91 | 92 | .. image:: ../../_static/class2/module1/img021.png 93 | :align: center 94 | :scale: 50% 95 | 96 | Click on the *Merge* button. We can see on the next screen that our *branches* have been merged. 97 | 98 | .. note:: We can also delete the **development** branch if it's not needed anymore by clicking on 99 | the *Remove Source Branch*. 100 | 101 | .. image:: ../../_static/class2/module1/img022.png 102 | :align: center 103 | :scale: 50% 104 | 105 | Click on the **master** link on this screen to be redirected to the **master** branch of this 106 | repository. 107 | 108 | .. image:: ../../_static/class2/module1/img023.png 109 | :align: center 110 | :scale: 50% 111 | 112 | This is how you can do a *merge request* when you need to merge two different *branches*. 113 | 114 | if you want to know more about merging, you may review the *git* doc: BranchingMerging_. 115 | 116 | .. _BranchingMerging: https://git-scm.com/book/en/v1/Git-Branching-Basic-Branching-and-Merging -------------------------------------------------------------------------------- /docs/class2/module1/module1.rst: -------------------------------------------------------------------------------- 1 | Module 1 - Setup Gitlab 2 | ======================= 3 | 4 | In this first module, we will create a new repo on *GitLab*. 5 | 6 | This repository will not contain much. It is mostly to see how it is done and give you 7 | a first experience. 8 | 9 | We will do the following: 10 | 11 | * Create a new repository 12 | * Access the repository via a terminal and run some *git* commands to update the content of 13 | our repo 14 | * Merge different "versions" of our *repo* 15 | 16 | 17 | **Exercises in this Module** 18 | 19 | .. toctree:: 20 | :maxdepth: 1 21 | :glob: 22 | 23 | lab* -------------------------------------------------------------------------------- /docs/class2/module2/lab1.rst: -------------------------------------------------------------------------------- 1 | Setup a new Jenkins pipeline 2 | ---------------------------- 3 | 4 | In this lab, we will create a new pipeline called **class2-master** on *Jenkins*. 5 | 6 | Access Jenkins 7 | ^^^^^^^^^^^^^^ 8 | 9 | Connect to *Jenkins*. It should be http://:1180/ 10 | 11 | * Login: TenantA 12 | * Password: Pa55w0rd 13 | 14 | .. note:: If you use UDF (F5 private cloud), you can either use the RDP Jumphost to access *Jenkins* 15 | or the shortcut in the interface 16 | 17 | .. image:: ../../_static/class2/module2/img001.png 18 | :align: center 19 | :scale: 50% 20 | 21 | Once you're authenticated, you should see something like this: 22 | 23 | .. image:: ../../_static/class2/module2/img002.png 24 | :align: center 25 | :scale: 50% 26 | 27 | Since we already have some pipeline working with our *GitLab* server, some configuration has already 28 | been made. The main item is how to authenticate with *GitLab*. To review this setup, click on 29 | **Manage Jenkins** and then **Configure System**. 30 | 31 | .. image:: ../../_static/class2/module2/img009.png 32 | :align: center 33 | :scale: 50% 34 | 35 | Scroll down to the **Gitlab** section. You'll see that we have already setup a *GitLab* connection 36 | called **local gitlab**. We will use this connection name later in our new *pipeline*. 37 | 38 | .. image:: ../../_static/class2/module2/img010.png 39 | :align: center 40 | :scale: 50% 41 | 42 | .. note:: You can see here that we referenced a credential called **GitLAb API token**. This token was 43 | created in *GitLab*. To generate an *API Token*, in *GitLab* go to your *User Settings* once you're 44 | authenticated as **TenantA**. 45 | 46 | .. image:: ../../_static/class2/module2/img011.png 47 | :align: center 48 | :scale: 50% 49 | 50 | Select the **Access Tokens** and you'll see the *API Token* we referenced in *Jenkins* 51 | 52 | .. image:: ../../_static/class2/module2/img012.png 53 | :align: center 54 | :scale: 50% 55 | 56 | For *Jenkins* to be able to retrieve our *repositories* from *GitLab*, we also have setup some credentials. 57 | On the main page, click on **Credentials**. Here you'll see an *ID* called **TenantA-Gitlab**, we will use 58 | this also in our new *pipeline. 59 | 60 | .. image:: ../../_static/class2/module2/img025.png 61 | :align: center 62 | :scale: 50% 63 | 64 | 65 | 66 | 67 | Create a new pipeline 68 | ^^^^^^^^^^^^^^^^^^^^^ 69 | 70 | To create a new pipeline, click on the **New Item** link. 71 | 72 | .. image:: ../../_static/class2/module2/img003.png 73 | :align: center 74 | :scale: 50% 75 | 76 | Setup the following: 77 | 78 | * Item name: *class2-pipeline* 79 | * Select *Pipeline* 80 | 81 | .. image:: ../../_static/class2/module2/img004.png 82 | :align: center 83 | :scale: 50% 84 | 85 | Click **OK**. 86 | 87 | Here we setup the following: 88 | 89 | * Check **github project**. 90 | 91 | * *Project url*: http://:1080/TenantA/Class2 92 | * *Gitlab Connection*: Select **local gitlab** 93 | 94 | .. image:: ../../_static/class2/module2/img005.png 95 | :align: center 96 | :scale: 50% 97 | 98 | * In the *Build Triggers* section, check **Build when a change is pushed to 99 | GitLab. GitLab webhook URL: http://172.18.0.3:8080/project/class2-pipeline**. 100 | We will need to setup this *WebHook* later in *GitLab* 101 | 102 | * Click on the *Advanced* button. Check the button **Filter branches by name** 103 | and in the *include* field: **development** 104 | 105 | .. image:: ../../_static/class2/module2/img006a.png 106 | :align: center 107 | :scale: 50% 108 | 109 | .. image:: ../../_static/class2/module2/img006b.png 110 | :align: center 111 | :scale: 50% 112 | 113 | .. note:: sometimes you may see an error when specifying the **development** branch. 114 | Ignore the error and keep creating the *pipeline*. 115 | 116 | 117 | * In the *Pipeline* section, Select **Pipeline script from SCM**. 118 | 119 | * For the *SCM* field, select **git** 120 | 121 | * For the *Repository URL*, specify the URL for your *GitLab* project 122 | 123 | .. note:: if you use UDF or the VM, here you need to specify the IP of the 124 | *GitLab* container; hence: http://172.18.0.2/TenantA/Class2 125 | 126 | * *Credentials*, Select **TenantA/...** 127 | 128 | * *Branches to build*: **development**. This means that we will retrieve the branch that 129 | got updated and triggered the pipeline. 130 | 131 | * The *Script Path* field is to mention a **File Name** that 132 | *Jenkins* will look for into our repo to know what it needs to do. We will 133 | have to create this file later. Here it will look for a file called **Jenkinsfile** 134 | 135 | .. image:: ../../_static/class2/module2/img007.png 136 | :align: center 137 | :scale: 50% 138 | 139 | * Click on **Apply/Save**. Your pipeline has been created. 140 | 141 | .. image:: ../../_static/class2/module2/img008.png 142 | :align: center 143 | :scale: 50% 144 | 145 | We still need to do two things: 146 | 147 | * Create a *WebHook* in *GitLab* to trigger our *pipeline* when our repo is updated 148 | * add a *Jenkinsfile* to our *GitLab* repo to details what we need to do when our pipeline 149 | is triggered 150 | 151 | Setup our GitLab Webhook 152 | ^^^^^^^^^^^^^^^^^^^^^^^^ 153 | 154 | To create the *WebHook*, connect to your *GitLab* GUI. 155 | 156 | .. note:: reminder to login into *GitLab* 157 | 158 | * Login: TenantA 159 | * Password: Pa55w0rd 160 | 161 | .. image:: ../../_static/class2/module2/img013.png 162 | :align: center 163 | :scale: 50% 164 | 165 | Click on your repo **TenantA / Class 2**. Click on **Settings** > **Integrations**. 166 | 167 | .. image:: ../../_static/class2/module2/img014.png 168 | :align: center 169 | :scale: 50% 170 | 171 | When we created our **class2-pipeline**, we saw the following during its setup: 172 | 173 | .. image:: ../../_static/class2/module2/img006a.png 174 | :align: center 175 | :scale: 50% 176 | 177 | This is the URL we should use as our *WebHook*: http://172.18.0.3:8080/project/class2-pipeline. 178 | In the *GitLab* GUI: 179 | 180 | * use this URL in the *URL* field. 181 | * leave *Secret Token* empty. 182 | * uncheck *Enable SSL verification* 183 | 184 | Click the **Add webhook** button. Once it's saved, you should see the following (you may need to 185 | scroll down). 186 | 187 | .. image:: ../../_static/class2/module2/img015.png 188 | :align: center 189 | :scale: 50% 190 | 191 | .. note:: don't use the test button it won't work. This is because we setup our pipeline to only accept 192 | push events from the *development* branch. 193 | 194 | If you want to test your setup, go to your *development* branch and update the content of one of the file. 195 | 196 | .. image:: ../../_static/class2/module2/img016.png 197 | :align: center 198 | :scale: 50% 199 | 200 | Once you've updated one of the two files, it will trigger our webhook. 201 | 202 | * If you go back to the *Jenkins* GUI. You will see a red icon and 203 | "stormy" cloud next our **class2-pipeline** pipeline. It means that the pipeline 204 | failed. This is expected and it shows that it got triggered by our *WebHook* test. 205 | 206 | .. image:: ../../_static/class2/module2/img018.png 207 | :align: center 208 | :scale: 50% 209 | 210 | | 211 | 212 | Click on the **class2-pipeline** link and then click on the latest build history number. It 213 | should be #1 214 | 215 | | 216 | 217 | .. image:: ../../_static/class2/module2/img019.png 218 | :align: center 219 | :scale: 50% 220 | 221 | | 222 | 223 | Click on **Console Output** to see what happens with this *build*. 224 | 225 | | 226 | 227 | .. image:: ../../_static/class2/module2/img020.png 228 | :align: center 229 | :scale: 50% 230 | 231 | 232 | You'll see the output related to our *pipeline* being executed 233 | 234 | .. code:: 235 | 236 | Started by GitLab push by TenantA 237 | [Office365connector] No webhooks to notify 238 | [Office365connector] No webhooks to notify 239 | java.io.FileNotFoundException 240 | at jenkins.plugins.git.GitSCMFile$3.invoke(GitSCMFile.java:167) 241 | at jenkins.plugins.git.GitSCMFile$3.invoke(GitSCMFile.java:159) 242 | at jenkins.plugins.git.GitSCMFileSystem$3.invoke(GitSCMFileSystem.java:193) 243 | at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:29) 244 | at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:72) 245 | at jenkins.plugins.git.GitSCMFileSystem.invoke(GitSCMFileSystem.java:189) 246 | at jenkins.plugins.git.GitSCMFile.content(GitSCMFile.java:159) 247 | at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:338) 248 | at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:110) 249 | at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:67) 250 | at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:303) 251 | at hudson.model.ResourceController.execute(ResourceController.java:97) 252 | at hudson.model.Executor.run(Executor.java:429) 253 | Finished: FAILURE 254 | 255 | This is expected. Here it happens because we triggered the *WebHook* when the *Jenkinsfile* has not been created. 256 | 257 | We will setup the Jenkinsfile in our next lab. 258 | 259 | -------------------------------------------------------------------------------- /docs/class2/module2/lab2.rst: -------------------------------------------------------------------------------- 1 | Setup the Jenkinsfile 2 | --------------------- 3 | 4 | In this lab, we will create the relevant **Jenkinsfile**. To learn more about *Jenkinsfile*, 5 | don't hesitate to check this link: Jenkinsfile_. 6 | 7 | .. _Jenkinsfile: https://jenkins.io/doc/book/pipeline/jenkinsfile/ 8 | 9 | 10 | Create the Jenkinsfile 11 | ^^^^^^^^^^^^^^^^^^^^^^ 12 | 13 | Connect to your *GitLab* GUI and go into your **Class2** project/repository. 14 | 15 | .. note:: it may be a good practice for you to try to do the same in CLI. 16 | 17 | Select your **development** branch. Click on the **+** sign and select **New file**. 18 | 19 | * *File Name*: **Jenkinsfile** 20 | * in the text section, copy/paste the following: 21 | 22 | .. code:: 23 | 24 | #!groovy 25 | 26 | pipeline { 27 | agent any 28 | 29 | stages { 30 | stage('Build') { 31 | steps { 32 | echo 'Building.. ' 33 | sh 'echo GIT branch is $GIT_BRANCH' 34 | sh 'ls -l' 35 | } 36 | } 37 | stage('Test') { 38 | steps { 39 | echo 'Testing..' 40 | } 41 | } 42 | stage('Deploy') { 43 | steps { 44 | echo 'Deploying....' 45 | } 46 | } 47 | } 48 | post { 49 | always { 50 | cleanWs() 51 | } 52 | } 53 | } 54 | 55 | .. image:: ../../_static/class2/module2/img022.png 56 | :align: center 57 | :scale: 50% 58 | 59 | | 60 | 61 | Specify a Commit message, validate that you're on the **development** branch and 62 | click on the **Commit changes** button. 63 | 64 | .. image:: ../../_static/class2/module2/img023.png 65 | :align: center 66 | :scale: 50% 67 | 68 | You should see a blue banner to confirm the file creation 69 | 70 | .. image:: ../../_static/class2/module2/img024.png 71 | :align: center 72 | :scale: 50% 73 | 74 | Since we have "pushed" a change in our repo, our *Jenkins* pipeline has been triggered. Go 75 | back to the *Jenkins* GUI to see what happened. You should see the following in your 76 | **class2-pipeline** *pipeline*: 77 | 78 | .. image:: ../../_static/class2/module2/img026.png 79 | :align: center 80 | :scale: 50% 81 | 82 | Here we can see that the *build* is successful since we got a "green" line. We can see the different 83 | *stages* that were listed in our *Jenkinsfile* ! Build, Test, Deploy. 84 | 85 | If you want to know more, click on the *build* number on the bottom left. 86 | 87 | .. image:: ../../_static/class2/module2/img027.png 88 | :align: center 89 | :scale: 50% 90 | 91 | Here you'll see the different *stages* of your *pipeline* execution. 92 | 93 | Jenkins is notified by the *WebHook* and retrieved the *Jenkinsfile* 94 | 95 | .. code:: 96 | 97 | Started by GitLab push by TenantA 98 | [Office365connector] No webhooks to notify 99 | Obtained Jenkinsfile from git http://172.18.0.2/TenantA/Class2 100 | Running in Durability level: MAX_SURVIVABILITY 101 | [Pipeline] node 102 | Running on Jenkins in /var/jenkins_home/workspace/class2-pipeline 103 | 104 | Then it starts to execute our *Jenkinsfile*. You can follow the processing of our file through the 105 | light grey text. the dark grey text is the output of what is executed. 106 | 107 | We specified in our *pipeline* configuration that we wanted to checkout the SCM so it 108 | retrieves the **developement** branch of our *repo* 109 | 110 | .. code:: 111 | 112 | [Pipeline] { (Declarative: Checkout SCM) 113 | [Pipeline] checkout 114 | Cloning the remote Git repository 115 | Cloning repository http://172.18.0.2/TenantA/Class2 116 | > git init /var/jenkins_home/workspace/class2-pipeline # timeout=10 117 | Fetching upstream changes from http://172.18.0.2/TenantA/Class2 118 | > git --version # timeout=10 119 | using GIT_ASKPASS to set credentials Gitlab user for TenantA 120 | > git fetch --tags --progress http://172.18.0.2/TenantA/Class2 +refs/heads/*:refs/remotes/origin/* 121 | > git config remote.origin.url http://172.18.0.2/TenantA/Class2 # timeout=10 122 | > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 123 | > git config remote.origin.url http://172.18.0.2/TenantA/Class2 # timeout=10 124 | Fetching upstream changes from http://172.18.0.2/TenantA/Class2 125 | using GIT_ASKPASS to set credentials Gitlab user for TenantA 126 | > git fetch --tags --progress http://172.18.0.2/TenantA/Class2 +refs/heads/*:refs/remotes/origin/* 127 | skipping resolution of commit 9d7ccaf9cb8eb5d682eb4eba4d7d8d75835da3b0, since it originates from another repository 128 | > git rev-parse origin/development^{commit} # timeout=10 129 | Checking out Revision 9d7ccaf9cb8eb5d682eb4eba4d7d8d75835da3b0 (origin/development) 130 | > git config core.sparsecheckout # timeout=10 131 | > git checkout -f 9d7ccaf9cb8eb5d682eb4eba4d7d8d75835da3b0 132 | Commit message: "Create Jenkinsfile for pipeline processing" 133 | First time build. Skipping changelog. 134 | 135 | then we start executing the content of our *Jenkinsfile*: 136 | 137 | .. code:: 138 | 139 | stage('Build') { 140 | steps { 141 | echo 'Building.. ' 142 | sh 'echo GIT branch is $GIT_BRANCH' 143 | sh 'ls -l' 144 | } 145 | 146 | This is one of the *stage* we saw in the previous page (one of the green box). Here we mostly 147 | create some ouput for tracing purposes, highlight which branch we retrieved and then list the 148 | content of the directory where we are. 149 | 150 | this is the output of this in our console 151 | 152 | .. code:: 153 | 154 | [Pipeline] echo 155 | Building.. 156 | [Pipeline] sh 157 | [class2-pipeline] Running shell script 158 | + echo GIT branch is origin/development 159 | GIT branch is origin/development 160 | [Pipeline] sh 161 | [class2-pipeline] Running shell script 162 | + ls -l 163 | total 12 164 | -rw-r--r-- 1 jenkins jenkins 15 Nov 26 16:26 GitRocks 165 | -rw-r--r-- 1 jenkins jenkins 517 Nov 26 16:26 Jenkinsfile 166 | -rw-r--r-- 1 jenkins jenkins 63 Nov 26 16:26 README.md 167 | 168 | You can see that we retrieved our *repository* but also got placed in our repository automatically. 169 | 170 | This is the logic of the *Jenkinsfile*. If you want to see more examples of *Jenkinsfile*, don't 171 | hesitate to check the files in our **ADC-Services** and **my-webapp-ci-cd-demo** repositories 172 | 173 | .. note:: remember to go into the **dev** branch of those *repositories* 174 | 175 | .. image:: ../../_static/class2/module2/img028.png 176 | :align: center 177 | :scale: 50% 178 | 179 | | 180 | 181 | .. image:: ../../_static/class2/module2/img029.png 182 | :align: center 183 | :scale: 50% 184 | 185 | -------------------------------------------------------------------------------- /docs/class2/module2/module2.rst: -------------------------------------------------------------------------------- 1 | Module 2 - Setup Jenkins 2 | ======================== 3 | 4 | In this second module, we will create our first pipeline in *Jenkins*. 5 | 6 | With this pipeline, we will do the following: 7 | 8 | * Create a pipeline that automatically retrieves our *Gitlab* repository 9 | * Browse and list the retrieved repository 10 | * Update our *Gitlab* repo with a *WebHook* so that our pipeline is triggered automatically 11 | when an update is done. 12 | 13 | 14 | **Exercises in this Module** 15 | 16 | .. toctree:: 17 | :maxdepth: 1 18 | :glob: 19 | 20 | lab* -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Configuration file for the Sphinx documentation builder. 4 | # 5 | # This file does only contain a selection of the most common options. For a 6 | # full list see the documentation: 7 | # http://www.sphinx-doc.org/en/stable/config 8 | 9 | # -- Path setup -------------------------------------------------------------- 10 | 11 | # If extensions (or modules to document with autodoc) are in another directory, 12 | # add these directories to sys.path here. If the directory is relative to the 13 | # documentation root, use os.path.abspath to make it absolute, like shown here. 14 | # 15 | # import os 16 | # import sys 17 | # sys.path.insert(0, os.path.abspath('.')) 18 | 19 | 20 | # -- Project information ----------------------------------------------------- 21 | 22 | project = u'CI CD with DevOps tools' 23 | copyright = u'2018, Nicolas Ménant' 24 | author = u'Nicolas Ménant' 25 | 26 | # The short X.Y version 27 | version = u'' 28 | # The full version, including alpha/beta/rc tags 29 | release = u'0.9' 30 | 31 | import os 32 | import sys 33 | import time 34 | import re 35 | import pkgutil 36 | import string 37 | sys.path.insert(0, os.path.abspath('.')) 38 | 39 | # -- General configuration --------------------------------------------------- 40 | 41 | # If your documentation needs a minimal Sphinx version, state it here. 42 | # 43 | # needs_sphinx = '1.0' 44 | 45 | # Add any Sphinx extension module names here, as strings. They can be 46 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 47 | # ones. 48 | extensions = [ 49 | ] 50 | 51 | # Add any paths that contain templates here, relative to this directory. 52 | templates_path = ['_templates'] 53 | 54 | # The suffix(es) of source filenames. 55 | # You can specify multiple suffix as a list of string: 56 | # 57 | # source_suffix = ['.rst', '.md'] 58 | source_suffix = '.rst' 59 | 60 | # The master toctree document. 61 | master_doc = 'index' 62 | 63 | # The language for content autogenerated by Sphinx. Refer to documentation 64 | # for a list of supported languages. 65 | # 66 | # This is also used if you do content translation via gettext catalogs. 67 | # Usually you set "language" from the command line for these cases. 68 | language = None 69 | 70 | # List of patterns, relative to source directory, that match files and 71 | # directories to ignore when looking for source files. 72 | # This pattern also affects html_static_path and html_extra_path . 73 | exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store'] 74 | 75 | # The name of the Pygments (syntax highlighting) style to use. 76 | pygments_style = 'sphinx' 77 | 78 | 79 | # -- Options for HTML output ------------------------------------------------- 80 | 81 | # The theme to use for HTML and HTML Help pages. See the documentation for 82 | # a list of builtin themes. 83 | # 84 | html_theme = 'sphinx_rtd_theme' 85 | 86 | # Theme options are theme-specific and customize the look and feel of a theme 87 | # further. For a list of options available for each theme, see the 88 | # documentation. 89 | # 90 | # html_theme_options = {} 91 | 92 | # Add any paths that contain custom static files (such as style sheets) here, 93 | # relative to this directory. They are copied after the builtin static files, 94 | # so a file named "default.css" will overwrite the builtin "default.css". 95 | html_static_path = ['_static'] 96 | 97 | # Custom sidebar templates, must be a dictionary that maps document names 98 | # to template names. 99 | # 100 | # The default sidebars (for documents that don't match any pattern) are 101 | # defined by theme itself. Builtin themes are using these templates by 102 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', 103 | # 'searchbox.html']``. 104 | # 105 | # html_sidebars = {} 106 | 107 | 108 | # -- Options for HTMLHelp output --------------------------------------------- 109 | 110 | # Output file base name for HTML help builder. 111 | htmlhelp_basename = 'CICDwithDevOpstoolsdoc' 112 | 113 | 114 | # -- Options for LaTeX output ------------------------------------------------ 115 | 116 | latex_elements = { 117 | # The paper size ('letterpaper' or 'a4paper'). 118 | # 119 | # 'papersize': 'letterpaper', 120 | 121 | # The font size ('10pt', '11pt' or '12pt'). 122 | # 123 | # 'pointsize': '10pt', 124 | 125 | # Additional stuff for the LaTeX preamble. 126 | # 127 | # 'preamble': '', 128 | 129 | # Latex figure (float) alignment 130 | # 131 | # 'figure_align': 'htbp', 132 | } 133 | 134 | # Grouping the document tree into LaTeX files. List of tuples 135 | # (source start file, target name, title, 136 | # author, documentclass [howto, manual, or own class]). 137 | latex_documents = [ 138 | (master_doc, 'CICDwithDevOpstools.tex', u'CI CD with DevOps tools Documentation', 139 | u'Nicolas Ménant', 'manual'), 140 | ] 141 | 142 | 143 | # -- Options for manual page output ------------------------------------------ 144 | 145 | # One entry per manual page. List of tuples 146 | # (source start file, name, description, authors, manual section). 147 | man_pages = [ 148 | (master_doc, 'cicdwithdevopstools', u'CI CD with DevOps tools Documentation', 149 | [author], 1) 150 | ] 151 | 152 | 153 | # -- Options for Texinfo output ---------------------------------------------- 154 | 155 | # Grouping the document tree into Texinfo files. List of tuples 156 | # (source start file, target name, title, author, 157 | # dir menu entry, description, category) 158 | texinfo_documents = [ 159 | (master_doc, 'CICDwithDevOpstools', u'CI CD with DevOps tools Documentation', 160 | author, 'CICDwithDevOpstools', 'One line description of project.', 161 | 'Miscellaneous'), 162 | ] 163 | 164 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. CI CD with DevOps tools documentation master file, created by 2 | sphinx-quickstart on Mon Oct 29 12:53:05 2018. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to CI CD with DevOps tools's documentation! 7 | =================================================== 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :caption: Contents: 12 | :glob: 13 | 14 | class*/class* 15 | 16 | 17 | Indices and tables 18 | ================== 19 | 20 | * :ref:`genindex` 21 | * :ref:`modindex` 22 | * :ref:`search` 23 | -------------------------------------------------------------------------------- /gitlab/setup-gitlab.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## 4 | ## We extract from the archive name the gitlab version (if we don't run the same version, it will fail) 5 | ## 6 | 7 | gitlab_version=`echo $2 | cut -d'_' -f 5` 8 | 9 | docker run \ 10 | -d --restart always -v $1/docker_volumes/gitlab/data:/var/opt/gitlab \ 11 | -v $1/docker_volumes/gitlab/logs:/var/log/gitlab \ 12 | -v $1/docker_volumes/gitlab/config:/etc/gitlab \ 13 | -p 1022:22 \ 14 | -p 1080:80 \ 15 | -p 10443:443 \ 16 | --net ci-cd-docker-net --ip='172.18.0.2' \ 17 | --name gitlab \ 18 | gitlab/gitlab-ce:$gitlab_version-ce.0 19 | 20 | -------------------------------------------------------------------------------- /jenkins/Dockerfile: -------------------------------------------------------------------------------- 1 | # In general, you should always provide exact version (eg. 2.89.3) 2 | # rather than some more general tag (latest/lts) 3 | FROM jenkins/jenkins:lts 4 | 5 | USER root 6 | 7 | #ARG HOST_DOCKER_GROUP_ID 8 | 9 | # Create 'docker' group with provided group ID 10 | # and add 'jenkins' user to it 11 | #RUN groupadd docker -g ${HOST_DOCKER_GROUP_ID} && \ 12 | # usermod -a -G docker jenkins 13 | 14 | RUN apt-get update && \ 15 | apt-get install -y --no-install-recommends \ 16 | apt-transport-https \ 17 | ca-certificates \ 18 | curl \ 19 | software-properties-common \ 20 | jq \ 21 | python \ 22 | python-pip \ 23 | wget \ 24 | git \ 25 | python-setuptools \ 26 | python-requests && \ 27 | curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add - && \ 28 | add-apt-repository \ 29 | "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable" && \ 30 | apt-get update && \ 31 | apt-get install -y --no-install-recommends \ 32 | docker-ce && \ 33 | apt-get clean 34 | 35 | 36 | RUN usermod -a -G root jenkins 37 | 38 | RUN usermod -aG docker jenkins 39 | 40 | # Run Jenkins as dedicated non-root user 41 | USER jenkins 42 | -------------------------------------------------------------------------------- /jenkins/setup-jenkins.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build -t jenkins-with-python-docker jenkins/ 4 | 5 | docker run \ 6 | -d --restart always -v /var/run/docker.sock:/var/run/docker.sock \ 7 | -v $2:/usr/bin/docker \ 8 | -v $1/docker_volumes/jenkins:/var/jenkins_home \ 9 | -p 1180:8080 \ 10 | -p 11000:50000 \ 11 | --net ci-cd-docker-net --ip='172.18.0.3' \ 12 | --name jenkins \ 13 | jenkins-with-python-docker 14 | 15 | 16 | --------------------------------------------------------------------------------