Skip to content

Commit 3380eff

Browse files
authored
Merge pull request #29 from dgannon991/feat/3178/use-our-own-images
Build out own images and use them in our examples
2 parents 3046bce + bd5cddc commit 3380eff

File tree

15 files changed

+378
-11
lines changed

15 files changed

+378
-11
lines changed

airgap/charts/whalegap/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ msg: "Whale aren't you special?"
88
replicaCount: 1
99

1010
image:
11-
repository: "carolynvs/whalesayd"
12-
digest: "sha256:8b92b7269f59e3ed824e811a1ff1ee64f0d44c0218efefada57a4bebc2d7ef6f"
11+
repository: "ghcr.io/getporter/examples/images/whalesayd"
12+
digest: "sha256:18c099989986f61c0678b8040cc8d2e80ba20ecd096da51f8da3a31c5d1138b8"
1313
pullPolicy: IfNotPresent
1414

1515
imagePullSecrets: []

airgap/porter.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
schemaVersion: 1.0.0-alpha.1
22
name: examples/whalegap
3-
version: 0.2.0
3+
version: 0.2.1
44
description: "An example bundle that demonstrates how to sneak a whale-sized bundle through an airgap"
55
registry: ghcr.io/getporter
66

@@ -22,8 +22,8 @@ images:
2222
whalesayd:
2323
description: "Whalesay as a service"
2424
imageType: "docker"
25-
repository: "carolynvs/whalesayd"
26-
digest: "sha256:8b92b7269f59e3ed824e811a1ff1ee64f0d44c0218efefada57a4bebc2d7ef6f"
25+
repository: "ghcr.io/getporter/examples/images/whalesayd"
26+
digest: "sha256:18c099989986f61c0678b8040cc8d2e80ba20ecd096da51f8da3a31c5d1138b8"
2727

2828
mixins:
2929
- helm3

docker/porter.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
schemaVersion: 1.0.0-alpha.1
22
name: examples/whalesay
3-
version: 0.2.0
3+
version: 0.2.1
44
description: "An example bundle that uses docker through the magic of whalespeak"
55
registry: ghcr.io/getporter
66

@@ -21,16 +21,16 @@ mixins:
2121
install:
2222
- docker:
2323
run:
24-
image: "docker/whalesay:latest"
24+
image: "ghcr.io/getporter/examples/images/whalesay:latest"
2525
rm: true
2626
arguments:
2727
- cowsay
2828
- Hello World
29-
29+
3030
upgrade:
3131
- docker:
3232
run:
33-
image: "docker/whalesay:latest"
33+
image: "ghcr.io/getporter/examples/images/whalesay:latest"
3434
rm: true
3535
arguments:
3636
- cowsay
@@ -39,7 +39,7 @@ upgrade:
3939
say:
4040
- docker:
4141
run:
42-
image: "docker/whalesay:latest"
42+
image: "ghcr.io/getporter/examples/images/whalesay:latest"
4343
rm: true
4444
arguments:
4545
- cowsay
@@ -48,7 +48,7 @@ say:
4848
uninstall:
4949
- docker:
5050
run:
51-
image: "docker/whalesay:latest"
51+
image: "ghcr.io/getporter/examples/images/whalesay:latest"
5252
rm: true
5353
arguments:
5454
- cowsay

images/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Porter Example Images
2+
3+
A collection of images used within the porter examples, and published to the getporter/examples/images container registry

images/whalesay/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM alpine
2+
RUN apk add --no-cache perl
3+
COPY cowsay /usr/local/bin/cowsay
4+
COPY docker.cow /usr/local/share/cows/default.cow
5+
ENTRYPOINT ["/usr/local/bin/cowsay"]

images/whalesay/LICENSE

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
==============
2+
cowsay License
3+
==============
4+
5+
cowsay is distributed under the same licensing terms as Perl: the
6+
Artistic License or the GNU General Public License. If you don't
7+
want to track down these licenses and read them for yourself, use
8+
the parts that I'd prefer:
9+
10+
(0) I wrote it and you didn't.
11+
12+
(1) Give credit where credit is due if you borrow the code for some
13+
other purpose.
14+
15+
(2) If you have any bugfixes or suggestions, please notify me so
16+
that I may incorporate them.
17+
18+
(3) If you try to make money off of cowsay, you suck.
19+
20+
===============
21+
cowsay Legalese
22+
===============
23+
24+
(0) Copyright (c) 1999 Tony Monroe. All rights reserved. All
25+
lefts may or may not be reversed at my discretion.
26+
27+
(1) This software package can be freely redistributed or modified
28+
under the terms described above in the "cowsay License" section
29+
of this file.
30+
31+
(2) cowsay is provided "as is," with no warranties whatsoever,
32+
expressed or implied. If you want some implied warranty about
33+
merchantability and/or fitness for a particular purpose, you will
34+
not find it here, because there is no such thing here.
35+
36+
(3) I hate legalese.

images/whalesay/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
REGISTRY?=ghcr.io/getporter/examples/images/whalesay
2+
LATEST=$(REGISTRY):latest
3+
4+
build:
5+
docker build -t $(LATEST) .
6+
7+
publish: build
8+
docker push $(LATEST)

images/whalesay/cowsay

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
#!/usr/bin/perl
2+
3+
##
4+
## Cowsay 3.03
5+
##
6+
## This file is part of cowsay. (c) 1999-2000 Tony Monroe.
7+
##
8+
9+
use Text::Tabs qw(expand);
10+
use Text::Wrap qw(wrap fill $columns);
11+
use File::Basename;
12+
use Getopt::Std;
13+
use Cwd;
14+
15+
$version = "3.03";
16+
$progname = basename($0);
17+
$eyes = "oo";
18+
$tongue = " ";
19+
$cowpath = $ENV{'COWPATH'} || '/usr/local/share/cows';
20+
@message = ();
21+
$thoughts = "";
22+
23+
## Yeah, this is rude, I know. But hopefully it gets around a nasty
24+
## little version dependency.
25+
26+
$Text::Wrap::initial_tab = 8;
27+
$Text::Wrap::subsequent_tab = 8;
28+
$Text::Wrap::tabstop = 8;
29+
30+
## One of these days, we'll get it ported to Windows. Yeah, right.
31+
32+
if (($^O eq "MSWin32") or ($^O eq "Windows_NT")) { ## Many perls, eek!
33+
$pathsep = ';';
34+
} else {
35+
$pathsep = ':';
36+
}
37+
38+
%opts = (
39+
'e' => 'oo',
40+
'f' => 'default.cow',
41+
'n' => 0,
42+
'T' => ' ',
43+
'W' => 40,
44+
);
45+
46+
getopts('bde:f:ghlLnNpstT:wW:y', \%opts);
47+
48+
&display_usage if $opts{'h'};
49+
&list_cowfiles if $opts{'l'};
50+
51+
$borg = $opts{'b'};
52+
$dead = $opts{'d'};
53+
$greedy = $opts{'g'};
54+
$paranoid = $opts{'p'};
55+
$stoned = $opts{'s'};
56+
$tired = $opts{'t'};
57+
$wired = $opts{'w'};
58+
$young = $opts{'y'};
59+
$eyes = substr($opts{'e'}, 0, 2);
60+
$tongue = substr($opts{'T'}, 0, 2);
61+
$the_cow = "";
62+
63+
&slurp_input;
64+
$Text::Wrap::columns = $opts{'W'};
65+
@message = ($opts{'n'} ? expand(@message) :
66+
split("\n", fill("", "", @message)));
67+
&construct_balloon;
68+
&construct_face;
69+
&get_cow;
70+
print @balloon_lines;
71+
print $the_cow;
72+
73+
sub list_cowfiles {
74+
my $basedir;
75+
my @dirfiles;
76+
chop($basedir = cwd);
77+
for my $d (split(/$pathsep/, $cowpath)) {
78+
print "Cow files in $d:\n";
79+
opendir(COWDIR, $d) || die "$0: Cannot open $d\n";
80+
for my $file (readdir COWDIR) {
81+
if ($file =~ s/\.cow$//) {
82+
push(@dirfiles, $file);
83+
}
84+
}
85+
closedir(COWDIR);
86+
print wrap("", "", sort @dirfiles), "\n";
87+
@dirfiles = ();
88+
chdir($basedir);
89+
}
90+
exit(0);
91+
}
92+
93+
sub slurp_input {
94+
unless ($ARGV[0]) {
95+
chomp(@message = <STDIN>);
96+
} else {
97+
&display_usage if $opts{'n'};
98+
@message = join(' ', @ARGV);
99+
}
100+
}
101+
102+
sub maxlength {
103+
my ($l, $m);
104+
$m = -1;
105+
for my $i (@_) {
106+
$l = length $i;
107+
$m = $l if ($l > $m);
108+
}
109+
return $m;
110+
}
111+
112+
sub construct_balloon {
113+
my $max = &maxlength(@message);
114+
my $max2 = $max + 2; ## border space fudge.
115+
my $format = "%s %-${max}s %s\n";
116+
my @border; ## up-left, up-right, down-left, down-right, left, right
117+
if ($0 =~ /think/i) {
118+
$thoughts = 'o';
119+
@border = qw[ ( ) ( ) ( ) ];
120+
} elsif (@message < 2) {
121+
$thoughts = '\\';
122+
@border = qw[ < > ];
123+
} else {
124+
$thoughts = '\\';
125+
if ($V and $V gt v5.6.0) { # Thanks, perldelta.
126+
@border = qw[ / \\ \\ / | | ];
127+
} else {
128+
@border = qw[ / \ \ / | | ];
129+
}
130+
}
131+
push(@balloon_lines,
132+
" " . ("_" x $max2) . " \n" ,
133+
sprintf($format, $border[0], $message[0], $border[1]),
134+
(@message < 2 ? "" :
135+
map { sprintf($format, $border[4], $_, $border[5]) }
136+
@message[1 .. $#message - 1]),
137+
(@message < 2 ? "" :
138+
sprintf($format, $border[2], $message[$#message], $border[3])),
139+
" " . ("-" x $max2) . " \n"
140+
);
141+
}
142+
143+
sub construct_face {
144+
if ($borg) { $eyes = "=="; }
145+
if ($dead) { $eyes = "xx"; $tongue = "U "; }
146+
if ($greedy) { $eyes = "\$\$"; }
147+
if ($paranoid) { $eyes = "@@"; }
148+
if ($stoned) { $eyes = "**"; $tongue = "U "; }
149+
if ($tired) { $eyes = "--"; }
150+
if ($wired) { $eyes = "OO"; }
151+
if ($young) { $eyes = ".."; }
152+
}
153+
154+
sub get_cow {
155+
##
156+
## Get a cow from the specified cowfile; otherwise use the default cow
157+
## which was defined above in $the_cow.
158+
##
159+
my $f = $opts{'f'};
160+
my $full = "";
161+
if ($opts{'f'} =~ m,/,) {
162+
$full = $opts{'f'};
163+
} else {
164+
for my $d (split(/:/, $cowpath)) {
165+
if (-f "$d/$f") {
166+
$full = "$d/$f";
167+
last;
168+
} elsif (-f "$d/$f.cow") {
169+
$full = "$d/$f.cow";
170+
last;
171+
}
172+
}
173+
if ($full eq "") {
174+
die "$progname: Could not find $f cowfile!\n";
175+
}
176+
}
177+
do $full;
178+
die "$progname: $@\n" if $@;
179+
}
180+
181+
sub display_usage {
182+
die <<EOF;
183+
cow{say,think} version $version, (c) 1999 Tony Monroe
184+
Usage: $progname [-bdgpstwy] [-h] [-e eyes] [-f cowfile]
185+
[-l] [-n] [-T tongue] [-W wrapcolumn] [message]
186+
EOF
187+
}

images/whalesay/docker.cow

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
##
2+
## Docker Cow
3+
##
4+
$the_cow = <<EOC;
5+
$thoughts
6+
$thoughts
7+
$thoughts
8+
EOC
9+
$the_cow .= <<'EOC';
10+
## .
11+
## ## ## ==
12+
## ## ## ## ## ===
13+
/"""""""""""""""""\___/ ===
14+
{ / ===-
15+
\______ O __/
16+
\ \ __/
17+
\____\_______/
18+
19+
EOC

images/whalesayd/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/whalesayd

0 commit comments

Comments
 (0)