Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
docker-baseimage-ubuntu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Prosper
docker-baseimage-ubuntu
Commits
140c558b
Commit
140c558b
authored
3 years ago
by
thelamer
Browse files
Options
Downloads
Patches
Plain Diff
install and use jq to parse json returns
parent
762eac73
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
root/docker-mods
+7
-11
7 additions, 11 deletions
root/docker-mods
with
7 additions
and
11 deletions
root/docker-mods
+
7
−
11
View file @
140c558b
...
@@ -12,11 +12,13 @@ if [ ! -f /usr/bin/curl ]; then
...
@@ -12,11 +12,13 @@ if [ ! -f /usr/bin/curl ]; then
## Ubuntu
## Ubuntu
apt-get update
apt-get update
apt-get
install
--no-install-recommends
-y
\
apt-get
install
--no-install-recommends
-y
\
curl
curl
\
jq
elif
[
-f
/sbin/apk
]
;
then
elif
[
-f
/sbin/apk
]
;
then
# Alpine
# Alpine
apk add
--no-cache
\
apk add
--no-cache
\
curl
curl
\
jq
fi
fi
fi
fi
...
@@ -30,19 +32,14 @@ get_blob_sha () {
...
@@ -30,19 +32,14 @@ get_blob_sha () {
--location
\
--location
\
--request
GET
\
--request
GET
\
--header
"Authorization: Bearer
$2
"
\
--header
"Authorization: Bearer
$2
"
\
$3
|
\
$3
| jq
-r
'.layers[0].digest'
grep
-A4
'layers'
|
\
grep
-m1
'digest'
|
\
awk
-F
'"'
'{print $4}'
else
else
curl
\
curl
\
--silent
\
--silent
\
--location
\
--location
\
--request
GET
\
--request
GET
\
--header
"Authorization: Bearer
$2
"
\
--header
"Authorization: Bearer
$2
"
\
$3
|
\
$3
| jq
-r
'.fsLayers[0].blobSum'
grep
-m1
"blobSum"
|
\
awk
-F
'"'
'{print $4}'
fi
fi
}
}
...
@@ -101,8 +98,7 @@ for DOCKER_MOD in "${DOCKER_MODS[@]}"; do
...
@@ -101,8 +98,7 @@ for DOCKER_MOD in "${DOCKER_MODS[@]}"; do
--silent
\
--silent
\
--header
'GET'
\
--header
'GET'
\
"
${
AUTH_URL
}
"
\
"
${
AUTH_URL
}
"
\
|
grep
-m1
"token"
\
| jq
-r
'.token'
\
|
awk
-F
'"'
'{print $4}'
\
)
"
)
"
# Determine first and only layer of image
# Determine first and only layer of image
SHALAYER
=
$(
get_blob_sha
"
${
MODE
}
"
"
${
TOKEN
}
"
"
${
MANIFEST_URL
}
"
)
SHALAYER
=
$(
get_blob_sha
"
${
MODE
}
"
"
${
TOKEN
}
"
"
${
MANIFEST_URL
}
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment