Skip to content

Commit 9248ef2

Browse files
committed
Update version-grabber to include && in the output to make auto-generation easier
1 parent acd22ac commit 9248ef2

File tree

4 files changed

+36
-22
lines changed

4 files changed

+36
-22
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ All notable changes to this project will be documented in this file.
55

66
This changelog was automatically generated using [Caretaker](https://github.com/DevelopersToolbox/caretaker) by [Wolf Software](https://github.com/WolfSoftware)
77

8+
### [v0.1.2](https://github.com/DockerToolbox/version-helper/compare/v0.1.1...v0.1.2)
9+
10+
> Released on May, 25th 2021
11+
12+
- Update version-grabber to include && in the output to make auto-generation easier [`[head]`](https://github.com/DockerToolbox/version-helper/commit/)
13+
814
### [v0.1.1](https://github.com/DockerToolbox/version-helper/compare/v0.1.0...v0.1.1)
915

1016
> Released on May, 24th 2021
1117
12-
- Add code to ignore packages that have no version [`[head]`](https://github.com/DockerToolbox/version-helper/commit/)
18+
- Add code to ignore packages that have no version [`[acd22ac]`](https://github.com/DockerToolbox/version-helper/commit/acd22ac6dc488fd50717b97b7a6d578d84ac7532)
1319

1420
### [v0.1.0](https://github.com/DockerToolbox/version-helper/releases/v0.1.0)
1521

README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ RUN apk update && \
105105
curl=7.74.0-r0 \
106106
git=2.30.1-r0 \
107107
openssl-dev=1.1.1j-r0 \
108-
wget=1.21.1-r1
108+
wget=1.21.1-r1 \
109+
&& \
109110
```
110111

111112

@@ -118,7 +119,8 @@ RUN yum makecache && \
118119
curl-7.61.1 \
119120
git-2.23.3 \
120121
openssl-devel-1.0.2k \
121-
wget-1.14
122+
wget-1.14 \
123+
&& \
122124
```
123125

124126
### Centos
@@ -130,7 +132,8 @@ RUN yum makecache && \
130132
curl-7.61.1 \
131133
git-2.27.0 \
132134
openssl-devel-1.1.1g \
133-
wget-1.19.5
135+
wget-1.19.5 \
136+
&& \
134137
```
135138

136139
### Debian
@@ -142,7 +145,8 @@ RUN apt-get update && \
142145
curl=7.64.0-4+deb10u1 \
143146
git=1:2.20.1-2+deb10u3 \
144147
libssl-dev=1.1.1d-0+deb10u5 \
145-
wget=1.20.1-1.1
148+
wget=1.20.1-1.1 \
149+
&& \
146150
```
147151

148152
### Ubuntu
@@ -154,7 +158,8 @@ RUN apt-get update && \
154158
curl=7.68.0-1ubuntu2.4 \
155159
git=1:2.25.1-1ubuntu3 \
156160
libssl-dev=1.1.1f-1ubuntu2.2 \
157-
wget=1.20.3-1ubuntu1
161+
wget=1.20.3-1ubuntu1 \
162+
&& \
158163
```
159164

160165
The output is a [hadolint](https://github.com/TravisToolbox/hadolint) compliant piece of code that you can add directly to your Dockerfile, it handles the formating of the version as again different OSs require different formats.
@@ -172,7 +177,8 @@ RUN apt-get update && \
172177
curl=7.47.0-1ubuntu2.18 \
173178
git=1:2.7.4-0ubuntu1.9 \
174179
libssl-dev=1.0.2g-1ubuntu4.19 \
175-
wget=1.17.1-1ubuntu1.5
180+
wget=1.17.1-1ubuntu1.5 \
181+
&& \
176182
```
177183

178184
**Ubuntu 18.04**
@@ -184,7 +190,8 @@ RUN apt-get update && \
184190
curl=7.58.0-2ubuntu3.12 \
185191
git=1:2.17.1-1ubuntu0.7 \
186192
libssl-dev=1.1.1-1ubuntu2.1~18.04.8 \
187-
wget=1.19.4-1ubuntu2.2
193+
wget=1.19.4-1ubuntu2.2 \
194+
&& \
188195
```
189196

190197
**Ubuntu 20.04**
@@ -196,7 +203,8 @@ RUN apt-get update && \
196203
curl=7.68.0-1ubuntu2.4 \
197204
git=1:2.25.1-1ubuntu3 \
198205
libssl-dev=1.1.1f-1ubuntu2.2 \
199-
wget=1.20.3-1ubuntu1
206+
wget=1.20.3-1ubuntu1 \
207+
&& \
200208
```
201209

202210
It should be very clear to see the different versions for each of the packages.

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.1
1+
0.1.2

src/version-grabber.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ function get_apk_versions()
2424
if [[ -n "${packages}" ]]; then
2525
apk update > /dev/null 2>&1
2626

27-
output="RUN apk update && \\ \n"
28-
output="${output}\\tapk add --no-cache \\ \n"
27+
output="RUN apk update && \\\\\n"
28+
output="${output}\\tapk add --no-cache \\\\\n"
2929

3030
for package in $packages; do
3131
version=$(apk policy "${package}" 2>/dev/null | sed -n 2p | sed 's/:$//g' | sed 's/^[[:space:]]*//')
3232
if [[ -n "${version}" ]]; then
33-
output="${output}\\t\t$package=$version \\ \n"
33+
output="${output}\\t\t$package=$version \\\\\n"
3434
fi
3535
done
36-
output=${output::-5}
36+
output="${output}\t\t&& \\\\\n"
3737
echo -e "${output}"
3838
else
3939
echo " No packages have been defined."
@@ -54,16 +54,16 @@ function get_apt_versions()
5454
if [[ -n "${packages}" ]]; then
5555
apt-get update > /dev/null 2>&1
5656

57-
output="RUN apt-get update && \\ \n"
58-
output="${output}\tapt-get -y --no-install-recommends install \\ \n"
57+
output="RUN apt-get update && \\\\\n"
58+
output="${output}\tapt-get -y --no-install-recommends install \\\\\n"
5959

6060
for package in $packages; do
6161
version=$(apt-cache policy "${package}" 2>/dev/null | grep 'Candidate:' | awk -F ' ' '{print $2}')
6262
if [[ -n "${version}" ]]; then
63-
output="${output}\t\t$package=$version \\ \n"
63+
output="${output}\t\t$package=$version \\\\\n"
6464
fi
6565
done
66-
output=${output::-5}
66+
output="${output}\t\t&& \\\\\n"
6767
echo -e "${output}"
6868
else
6969
echo " No packages have been defined."
@@ -84,16 +84,16 @@ function get_yum_versions()
8484
if [[ -n "${packages}" ]]; then
8585
yum makecache > /dev/null 2>&1
8686

87-
output="RUN yum makecache && \\ \n"
88-
output="${output}\tyum install -y \\ \n"
87+
output="RUN yum makecache && \\\\\n"
88+
output="${output}\tyum install -y \\\\\n"
8989

9090
for package in $packages; do
9191
version=$(yum info "${package}" 2>/dev/null | grep '^Version' | head -n 1 | awk -F ' : ' '{print $2}')
9292
if [[ -n "${version}" ]]; then
93-
output="${output}\t\t$package-$version \\ \n"
93+
output="${output}\t\t$package-$version \\\\\n"
9494
fi
9595
done
96-
output=${output::-5}
96+
output="${output}\t\t&& \\\\\n"
9797
echo -e "${output}"
9898
else
9999
echo " No packages have been defined."

0 commit comments

Comments
 (0)