| 1 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | package continuous::delivery::template; | ||
| 4 | |||
| 5 | 1 | our $VERSION = 0.02; | |
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | continuous-delivery-template - continuous delivery workflow dockerhub, gitlab, and cpan | ||
| 10 | |||
| 11 | =head1 DESCRIPTION | ||
| 12 | |||
| 13 | Perl template application configured to use Gitlab CI/CD service | ||
| 14 | as continuous delivery workflow. | ||
| 15 | |||
| 16 | On the Perl side, this application template uses Dist::Zilla as building, | ||
| 17 | testing and releasing framework. | ||
| 18 | |||
| 19 | hack on application code | ||
| 20 | git commit ... | ||
| 21 | git push | ||
| 22 | |||
| 23 | This will trigger building, testing and publishing the docker image | ||
| 24 | with :ci tag to dockerhub. | ||
| 25 | |||
| 26 | If all tests pass and you are going to release a new version should | ||
| 27 | use Dist::Zila as follows: | ||
| 28 | |||
| 29 | dzil release | ||
| 30 | |||
| 31 | Dist::Zilla will create a new git tag based on version number on | ||
| 32 | lib/continuous/delivery/template.pm file and push the tag to github. | ||
| 33 | |||
| 34 | Dist::Zilla will publish the release on CPAN, the CPAN will run | ||
| 35 | tests under a variety of platforns and environments throught CPANTESTERS. | ||
| 36 | |||
| 37 | When a new git tag is created on gitlab repository, the pipeline will | ||
| 38 | build the stages: build -> test -> deploy. The deploy stage is executed | ||
| 39 | only when a new tag is pushed to repository. | ||
| 40 | |||
| 41 | The deploy job will upload a stable image to dockerhub Container Registry. | ||
| 42 | |||
| 43 | Before you can upload Perl modules to CPAN you need to create an | ||
| 44 | account on The [Perl programming] Authors Upload Server: | ||
| 45 | |||
| 46 | =over | ||
| 47 | |||
| 48 | =item * | ||
| 49 | |||
| 50 | L<https://pause.perl.org> | ||
| 51 | |||
| 52 | =back | ||
| 53 | |||
| 54 | You need create an account on Docker Hub Container Regitry and configure | ||
| 55 | the following secret variables on Gitlab CI / CD settings: | ||
| 56 | |||
| 57 | =over | ||
| 58 | |||
| 59 | =item $DOCKER_USER | ||
| 60 | |||
| 61 | Your username on hub.docker.com. | ||
| 62 | |||
| 63 | =item $DOCKER_PASSWORD | ||
| 64 | |||
| 65 | Your password on hub.docker.com. | ||
| 66 | |||
| 67 | =back | ||
| 68 | |||
| 69 | =head2 PROJECT LINKS | ||
| 70 | |||
| 71 | =over | ||
| 72 | |||
| 73 | =item Gitlab Repository: | ||
| 74 | |||
| 75 | L<https://gitlab.com/joenio/continuous-delivery-template> | ||
| 76 | |||
| 77 | =item Docker Hub Container Registry: | ||
| 78 | |||
| 79 | L<https://hub.docker.com/r/joenio/continuous-delivery-template> | ||
| 80 | |||
| 81 | =item CPAN: | ||
| 82 | |||
| 83 | L<https://metacpan.org/release/continuous::delivery::template> | ||
| 84 | |||
| 85 | =item CPANTESTERS: | ||
| 86 | |||
| 87 | L<http://matrix.cpantesters.org/?dist=continuous-delivery-template> | ||
| 88 | |||
| 89 | =back | ||
| 90 | |||
| 91 | =head2 PROJECT LAYOUT | ||
| 92 | |||
| 93 | =over | ||
| 94 | |||
| 95 | =item C<.gitlab-ci.yml> | ||
| 96 | |||
| 97 | L<https://gitlab.com/joenio/continuous-delivery-template/blob/master/.gitlab-ci.yml>. | ||
| 98 | |||
| 99 | This file configures Gitlab CI/CD pipeline for build, test and deploy. | ||
| 100 | |||
| 101 | Gitlab CI/CD stages: build -> test -> deploy | ||
| 102 | |||
| 103 | =item C<Dockerfile> | ||
| 104 | |||
| 105 | L<https://gitlab.com/joenio/continuous-delivery-template/blob/master/Dockerfile>. | ||
| 106 | |||
| 107 | Docker container file, use C<debian:stretch> as base image. | ||
| 108 | |||
| 109 | =item C<dist.ini> | ||
| 110 | |||
| 111 | L<https://gitlab.com/joenio/continuous-delivery-template/blob/master/dist.ini>. | ||
| 112 | |||
| 113 | L<Dist::Zilla> settings for build, test and release this project. | ||
| 114 | |||
| 115 | =back | ||
| 116 | |||
| 117 | =head2 USEFULL DOCUMENTS | ||
| 118 | |||
| 119 | =over | ||
| 120 | |||
| 121 | =item * | ||
| 122 | |||
| 123 | L<GitLab CI/CD Examples|https://gitlab.com/help/ci/examples/README.md> | ||
| 124 | |||
| 125 | =item * | ||
| 126 | |||
| 127 | L<Building Docker images with GitLab CI/CD|https://docs.gitlab.com/ee/ci/docker/using_docker_build.html> | ||
| 128 | |||
| 129 | =back | ||
| 130 | |||
| 131 | =cut | ||
| 132 | |||
| 133 | 1 | ▶ | sub hello { |
|
Subroutine
hello: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 134 | 1 | return join(' ', "Hello! I'm", __PACKAGE__, "version $VERSION."); | |
| 135 | } | ||
| 136 | |||
| 137 | 1 | 1; | |