Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Docker
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Public data
Docker
Commits
72213365
Commit
72213365
authored
1 year ago
by
Marek Sterzik
Browse files
Options
Downloads
Patches
Plain Diff
initial commit of the reg tool (listing part)
parent
db986ea6
No related merge requests found
Pipeline
#7937
passed with stage
in 2 minutes and 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docker/builder/reg
+66
-0
66 additions, 0 deletions
docker/builder/reg
with
66 additions
and
0 deletions
docker/builder/reg
0 → 100755
+
66
−
0
View file @
72213365
#!/bin/bash
prod_tag
=
"prod-running"
declare
-A
digests
i
=
0
while
read
tag
;
do
digest
=
"
`
regctl image digest
"
$1
:
$tag
"
`
"
if
[
-z
"
$digest
"
]
;
then
digest
=
"standalone-
$tag
"
fi
sp
=
" "
if
[
-z
"
${
digests
[
$digest
]
}
"
]
;
then
sp
=
"
$i
"
((
i++
))
fi
digests[
"
$digest
"
]=
"
${
digests
[
$digest
]
}
$sp$tag
"
done
< <
(
regctl tag list
"
$1
"
| semversort
-r
-L
)
for
val
in
"
${
digests
[@]
}
"
;
do
echo
"
$val
"
done
|
sort
-n
-t
" "
|
sed
's/^[0-9]\+ //'
|
while
read
line
;
do
line_out
=
""
running_out
=
""
prod
=
""
for
tag
in
$line
;
do
if
[
"
$tag
"
=
"
$prod_tag
"
]
;
then
prod
=
1
else
sp
=
""
if
[
-n
"
$line_out
"
]
;
then
sp
=
" "
fi
line_out
=
"
$line_out$sp$tag
"
fi
done
if
[
-z
"
$line_out
"
]
;
then
line_out
=
"?"
fi
if
[
-t
1
-a
-n
"
$prod
"
]
;
then
echo
-ne
'\033[0;32m'
echo
-n
"
$line_out
"
echo
-ne
'\033[0m'
else
echo
-n
"
$line_out
"
fi
if
[
-n
"
$prod
"
]
;
then
if
[
-t
1
]
;
then
echo
-e
' [\033[0;31mR\033[0m]'
else
echo
' [R]'
fi
else
echo
fi
done
#for digest in "${!digests[@]}"; do
# echo "$digest ${digests[$digest]}"
#done
This diff is collapsed.
Click to expand it.
Preview
0%
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