Skip to content

Commit

Permalink
🐛 Fix registries initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
fanshan committed Nov 19, 2024
1 parent a6f0102 commit 3675dd6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 27 deletions.
2 changes: 1 addition & 1 deletion config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 7 additions & 22 deletions flows.json
Original file line number Diff line number Diff line change
Expand Up @@ -3400,31 +3400,16 @@
"t": "set",
"p": "local_registries",
"pt": "msg",
"to": "[\t [\t msg.images.RepoTags[0]\t ~> $filter(function($item) {(\t $fragments := $split($item, '/' );\t $count($fragments) > 1 and $contains($fragments[0], /([.:]|localhost)/) \t )})\t ~> $map(function($item){\t {\t \"image\": $item,\t \"registry\": $split($item, '/' )[0]\t }\t })\t ]{\t registry: {\t \"name\": $distinct(registry),\t \"serveraddress\": \"https://\" & $distinct(registry) & \"/v2/\",\t \"images\": [image]\t }\t } ~> $each(function ($k, $v) { $k })\t]",
"to": "(\t $local_registries := (\t $getRepo := function($repo) {(\t $fragments := $split($repo, '/' );\t $count($fragments) > 1 and $contains($fragments[0], /([.:]|localhost)/)\t ? {\t \"images\": [$repo],\t \"name\": $fragments[0]\t }\t : {\t \"images\": [$repo],\t \"name\": \"dockerhub\"\t }\t )};\t [\t msg.images ~> $map(function($image) {\t $count($image.RepoDigests) = 0 and $count($image.RepoTags) = 0\t ? {\t \"images\": [$image.Id],\t \"name\": \"dockerhub\"\t }\t : [(\t $count($image.RepoDigests) > 0 and $count($image.RepoTags) = 0\t ? $map($image.RepoDigests, function($digest) { $getRepo($digest) })\t : $map($image.RepoTags, function($tag) { $getRepo($tag) })\t )] {\t name: {\t \"images\": [images],\t \"name\": $distinct(name)\t }\t } ~> $each(function ($k, $v) { $k })\t })\t ]\t ) {\t name: {\t \"images\": [images],\t \"name\": $distinct(name),\t \"serveraddress\": \"https://\" & $distinct(name) & \"/v2/\"\t }\t } ~> $each(function ($k, $v) { $k });\t \t $map(msg.payload.results, function($item) {\t $local_registries ~> | $[name = $item.name] | { \"id\": $item.id, \"serveraddress\": $item.serveraddress } |\t })\t)",
"tot": "jsonata"
},
{
"t": "set",
"p": "local_registries",
"pt": "msg",
"to": "$append(msg.local_registries, [\t [\t msg.images.RepoTags[0]\t ~> $filter(function($item) {(\t $fragments := $split($item, '/' );\t $count($fragments) <= 1 or $not($contains($fragments[0], /([.:]|localhost)/)) \t )})\t ~> $map(function($item){\t {\t \"image\": $item,\t \"registry\": \"dockerhub\"\t }\t })\t ]{\t registry: {\t \"name\": \"dockerhub\",\t \"images\": [image]\t }\t } ~> $each(function ($k, $v) { $k })\t])",
"tot": "jsonata"
},
{
"t": "set",
"p": "local_registries",
"pt": "msg",
"to": "$map(msg.payload.results, function($item) {\t msg.local_registries ~> | $[name = $item.name] | { \"id\": $item.id, \"serveraddress\": $item.serveraddress } |\t})",
"tot": "jsonata",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2920,
"x": 2940,
"y": 580,
"wires": [
[
Expand All @@ -3448,7 +3433,7 @@
"authType": "",
"senderr": false,
"headers": [],
"x": 3570,
"x": 3610,
"y": 540,
"wires": [
[
Expand All @@ -3474,7 +3459,7 @@
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 3130,
"x": 3170,
"y": 580,
"wires": [
[
Expand Down Expand Up @@ -3518,7 +3503,7 @@
"from": "",
"to": "",
"reg": false,
"x": 3340,
"x": 3380,
"y": 540,
"wires": [
[
Expand Down Expand Up @@ -3573,7 +3558,7 @@
"from": "",
"to": "",
"reg": false,
"x": 3600,
"x": 3640,
"y": 620,
"wires": [
[
Expand All @@ -3600,7 +3585,7 @@
"from": "",
"to": "",
"reg": false,
"x": 3340,
"x": 3380,
"y": 620,
"wires": [
[
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "netbox-docker-agent",
"version": "1.5.1",
"version": "1.5.2",
"description": "Saashup agent for netbox manager",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion registries.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3675dd6

Please sign in to comment.