| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
12504
|
use strict; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
41
|
|
|
2
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
884
|
|
|
3
|
|
|
|
|
|
|
package continuous::delivery::template; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
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 |
|
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 |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item Docker Hub Container Registry: |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item CPAN: |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
L |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item CPANTESTERS: |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
L |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 PROJECT LAYOUT |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=over |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item C<.gitlab-ci.yml> |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
L. |
|
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 |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Docker container file, use C as base image. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item C |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
L. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L 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 |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item * |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
L |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=back |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub hello { |
|
134
|
1
|
|
|
1
|
0
|
29
|
return join(' ', "Hello! I'm", __PACKAGE__, "version $VERSION."); |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |