Commit 4f2d5c6 1 parent 0de0d45 commit 4f2d5c6 Copy full SHA for 4f2d5c6
File tree 21 files changed +68
-152
lines changed
21 files changed +68
-152
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ CLR_URL="https://cdn.download.clearlinux.org/releases"
4
4
5
5
# Return tag value or NULL if not found
6
6
function get_tag {
7
- pkg=$1
7
+ local pkg=$1
8
8
9
9
clr_ver=` docker run --rm clearlinux/os-core cat /usr/lib/os-release | grep VERSION_ID`
10
10
clr_ver=${clr_ver##* =}
@@ -29,20 +29,42 @@ function get_tag {
29
29
}
30
30
31
31
function get_tags_in_docker {
32
- img=$1
32
+ local img=$1
33
33
34
34
tag_url=" https://registry.hub.docker.com/v2/repositories/$img /tags/"
35
35
tags=$( curl $tag_url 2> /dev/null | docker run -i stedolan/jq ' ."results"[]["name"]' )
36
36
echo $tags
37
37
}
38
38
39
+ # For version format x.y.z, three tags as below
40
+ # x.y.z, x.y and x
39
41
function tag_and_push {
42
+ # For version format x.y.z, three tags as below
43
+ # tag: x.y.z
44
+ # tag1: x.y
45
+ # tag2: x
40
46
local tag=$1
41
- local major_tag=$2
47
+ local tag1=${tag% .* }
48
+ local tag2=${tag%% .* }
49
+ local image=$2
42
50
43
51
set -e
44
52
docker tag $image :latest $image :$tag
45
53
docker push $image :$tag
46
- docker tag $image :latest $image :$major_tag
47
- docker push $image :$major_tag
54
+ docker tag $image :latest $image :$tag1
55
+ docker push $image :$tag1
56
+ docker tag $image :latest $image :$tag2
57
+ docker push $image :$tag2
58
+ }
59
+
60
+ function do_tag {
61
+ local image=$1
62
+ local pkg=$2
63
+
64
+ echo " => Tagging the $image "
65
+ local tag=$( get_tag $pkg )
66
+
67
+ if [ $? -eq 0 ] && [ -n " $tag " ]; then
68
+ tag_and_push $tag $image
69
+ fi
48
70
}
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/golang"
7
- tag= $( get_tag go )
5
+ package=go
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- # major tag format x.y, such as 1.12, 1.13
11
- major_tag=${tag% .* }
12
- tag_and_push $tag $major_tag
13
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/haproxy"
7
- tag= $( get_tag haproxy)
5
+ package= haproxy
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- # major tag format 1.6 or 2.0
11
- major_tag=${tag% .* }
12
- tag_and_push $tag $major_tag
13
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/httpd"
7
- tag= $( get_tag httpd)
5
+ package= httpd
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/iperf"
7
- tag= $( get_tag iperf)
5
+ package= iperf
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/mariadb"
7
- tag= $( get_tag mariadb)
5
+ package= mariadb
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/memcached"
7
- tag= $( get_tag memcached)
5
+ package= memcached
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- # major tag format like 1.4 or 1.5
11
- major_tag=${tag% .* }
12
- tag_and_push $tag $major_tag
13
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/nginx"
7
- tag= $( get_tag nginx-mainline)
5
+ package= nginx-mainline
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- # major tag format 1.16 or 1.17
11
- major_tag=${tag% .* }
12
- tag_and_push $tag $major_tag
13
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/node"
7
- tag= $( get_tag nodejs)
5
+ package= nodejs
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/openjdk"
7
- tag= $( get_tag openjdk13)
5
+ package= openjdk13
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/openvino"
7
- tag= $( get_tag dldt)
5
+ package= dldt
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/perl"
7
- tag=$( get_tag perl)
5
+ package=perl
6
+
7
+ do_tag $image $package
8
8
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/php-fpm"
7
- tag= $( get_tag php)
5
+ package= php
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/php"
7
- tag= $( get_tag php)
5
+ package= php
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/postgres"
7
- tag= $( get_tag postgresql11)
5
+ package= postgresql11
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/python"
7
- tag= $( get_tag python3)
5
+ package= python3
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- # major tag format x.y, such as 3.6 , 3.7
11
- major_tag=${tag% .* }
12
- tag_and_push $tag $major_tag
13
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/rabbitmq"
7
- tag= $( get_tag rabbitmq-server)
5
+ package= rabbitmq-server
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/redis"
7
- tag= $( get_tag redis-native)
5
+ package= redis-native
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/ruby"
7
- tag= $( get_tag ruby)
5
+ package= ruby
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- major_tag=${tag%% .* }
11
- tag_and_push $tag $major_tag
12
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/tensorflow-serving"
7
- tag= $( get_tag tensorflow-serving)
5
+ package= tensorflow-serving
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- # major tag format x.y, such as 1.14
11
- major_tag=${tag% .* }
12
- tag_and_push $tag $major_tag
13
- fi
7
+ do_tag $image $package
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
- echo " => Tagging the image"
3
-
4
2
. ../docker-hooks.sh
5
3
6
4
image=" clearlinux/tensorflow"
7
- tag= $( get_tag tensorflow)
5
+ package= tensorflow
8
6
9
- if [ $? -eq 0 ] && [ -n " $tag " ]; then
10
- # major tag format x.y, such as 1.16
11
- major_tag=${tag% .* }
12
- tag_and_push $tag $major_tag
13
- fi
7
+ do_tag $image $package
You can’t perform that action at this time.
0 commit comments