Skip to content

Commit

Permalink
Merge pull request #3 from sbe-arg/feature/gcr
Browse files Browse the repository at this point in the history
feat: add support for google gcr.io
  • Loading branch information
sbe-arg authored Aug 25, 2023
2 parents 08a4597 + c2da83f commit 38cd6b7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ jobs:
- your compose files must be on your repo root.
- your compose files must match '\*compose\*.yaml' or '\*compose\*.yml'
- your images in compose files must include the full registry:
- docker.io/somecompany/theimage:x.x.x
- mcr.microsoft.com/part/theimage:x.x.x
- `docker.io/somecompany/theimage:x.x.x` (ie, docker.io/grafana/grafana:10.0.1)
- `mcr.microsoft.com/part/theimage:x.x.x` (ie, mcr.microsoft.com/azure-cli:2.50.0)
- `gcr.io/project/image:x.x.x` (ie, gcr.io/cadvisor/cadvisor:v0.47.1)

## what for:

Expand All @@ -63,6 +64,7 @@ jobs:

- dockerhub
- microsoft mcr
- google gcr
- other? open an issue or open pr

## what does it look like
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.0
v0.1.1
17 changes: 17 additions & 0 deletions bin/pincher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,23 @@ do
[ -n "$latest_version_in_registry" ] && versions_magic
done

# google gcr
versions_gcr=$(yq '.services[].image' ./*compose*.y* | grep gcr.io | sort | uniq)
for version in $versions_gcr
do
latest_version_in_registry=""

[[ $version =~ gcr.io\/(.*)\:(.*) ]]
image=${BASH_REMATCH[1]}
v_rematched=${BASH_REMATCH[2]}
echo "image: $image, v: $v_rematched"

latest_version_in_registry="$(curl -s https://gcr.io/v2/$image/tags/list | jq -r '.tags[]' | sort -V -t. -k1,1 -k2,2 -k3,3 | grep -oP '^v?[0-9]+\.[0-9]+\.[0-9]+$' | tail -n 1)"

# the magic
[ -n "$latest_version_in_registry" ] && versions_magic
done

# considerations "how to edit/contribute"
# add each new registry in a separated block loop as per the existing ones
# authentication happens via env_vars in the action block if required
Expand Down

0 comments on commit 38cd6b7

Please sign in to comment.