Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
applications
renovate
Commits
b277dfe7
Unverified
Commit
b277dfe7
authored
Jun 17, 2020
by
Rhys Arkins
Committed by
GitHub
Jun 17, 2020
Browse files
Options
Downloads
Patches
Plain Diff
fix(docker): caching of null lookup responses (#6534)
parent
cf508a3c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/datasource/docker/index.ts
+12
-13
12 additions, 13 deletions
lib/datasource/docker/index.ts
with
12 additions
and
13 deletions
lib/datasource/docker/index.ts
+
12
−
13
View file @
b277dfe7
...
...
@@ -336,12 +336,13 @@ export async function getDigest(
);
logger
.
debug
(
`getDigest(
${
registry
}
,
${
repository
}
,
${
newValue
}
)`
);
const
newTag
=
newValue
||
'
latest
'
;
try
{
const
cacheNamespace
=
'
datasource-docker-digest
'
;
const
cacheKey
=
`
${
registry
}
:
${
repository
}
:
${
newTag
}
`
;
let
digest
=
null
;
try
{
const
cachedResult
=
await
globalCache
.
get
(
cacheNamespace
,
cacheKey
);
// istanbul ignore if
if
(
cachedResult
)
{
if
(
cachedResult
!==
undefined
)
{
return
cachedResult
;
}
const
manifestResponse
=
await
getManifestResponse
(
...
...
@@ -349,14 +350,10 @@ export async function getDigest(
repository
,
newTag
);
if
(
!
manifestResponse
)
{
return
null
;
}
const
digest
=
extractDigestFromResponse
(
manifestResponse
);
if
(
manifestResponse
)
{
digest
=
extractDigestFromResponse
(
manifestResponse
)
||
null
;
logger
.
debug
({
digest
},
'
Got docker digest
'
);
const
cacheMinutes
=
30
;
await
globalCache
.
set
(
cacheNamespace
,
cacheKey
,
digest
,
cacheMinutes
);
return
digest
;
}
}
catch
(
err
)
/* istanbul ignore next */
{
if
(
err
instanceof
DatasourceError
)
{
throw
err
;
...
...
@@ -369,8 +366,10 @@ export async function getDigest(
},
'
Unknown Error looking up docker image digest
'
);
return
null
;
}
const
cacheMinutes
=
30
;
await
globalCache
.
set
(
cacheNamespace
,
cacheKey
,
null
,
cacheMinutes
);
return
digest
;
}
async
function
getTags
(
...
...
@@ -386,7 +385,7 @@ async function getTags(
cacheKey
);
// istanbul ignore if
if
(
cachedResult
)
{
if
(
cachedResult
!==
undefined
)
{
return
cachedResult
;
}
// AWS ECR limits the maximum number of results to 1000
...
...
@@ -486,7 +485,7 @@ async function getLabels(
cacheKey
);
// istanbul ignore if
if
(
cachedResult
)
{
if
(
cachedResult
!==
undefined
)
{
return
cachedResult
;
}
try
{
...
...
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
sign in
to comment