Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
21d2aeb7
Unverified
Commit
21d2aeb7
authored
4 years ago
by
Sergei Zharinov
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
refactor(terraform): Use util function for cache dir creation (#10588)
parent
11f89147
Loading
Loading
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/manager/terraform/lockfile/hash.ts
+3
-2
3 additions, 2 deletions
lib/manager/terraform/lockfile/hash.ts
lib/manager/terraform/lockfile/util.ts
+1
-11
1 addition, 11 deletions
lib/manager/terraform/lockfile/util.ts
with
4 additions
and
13 deletions
lib/manager/terraform/lockfile/hash.ts
+
3
−
2
View file @
21d2aeb7
...
...
@@ -10,8 +10,9 @@ import type {
import
{
logger
}
from
'
../../../logger
'
;
import
*
as
packageCache
from
'
../../../util/cache/package
'
;
import
*
as
fs
from
'
../../../util/fs
'
;
import
{
ensureCacheDir
}
from
'
../../../util/fs
'
;
import
{
Http
}
from
'
../../../util/http
'
;
import
{
getCacheDir
,
repositoryRegex
}
from
'
./util
'
;
import
{
repositoryRegex
}
from
'
./util
'
;
const
http
=
new
Http
(
TerraformProviderDatasource
.
id
);
const
hashCacheTTL
=
10080
;
// in seconds == 1 week
...
...
@@ -75,7 +76,7 @@ async function getReleaseBackendIndex(
export
async
function
calculateHashes
(
builds
:
TerraformBuild
[]
):
Promise
<
string
[]
>
{
const
cacheDir
=
await
get
CacheDir
();
const
cacheDir
=
await
ensure
CacheDir
(
'
./others/terraform
'
);
// for each build download ZIP, extract content and generate hash for all containing files
const
hashes
=
await
pMap
(
...
...
This diff is collapsed.
Click to expand it.
lib/manager/terraform/lockfile/util.ts
+
1
−
11
View file @
21d2aeb7
import
{
join
}
from
'
upath
'
;
import
{
getAdminConfig
}
from
'
../../../config/admin
'
;
import
{
logger
}
from
'
../../../logger
'
;
import
{
ensureDir
,
getSiblingFileName
,
readLocalFile
}
from
'
../../../util/fs
'
;
import
{
getSiblingFileName
,
readLocalFile
}
from
'
../../../util/fs
'
;
import
{
get
as
getVersioning
}
from
'
../../../versioning
'
;
import
type
{
UpdateArtifactsResult
}
from
'
../../types
'
;
import
type
{
...
...
@@ -210,10 +207,3 @@ export function writeLockUpdates(
},
};
}
export
async
function
getCacheDir
():
Promise
<
string
>
{
const
cacheDir
=
join
(
getAdminConfig
().
cacheDir
,
'
./others/terraform
'
);
await
ensureDir
(
cacheDir
);
logger
.
debug
(
`Using terraform cache:
${
cacheDir
}
`
);
return
cacheDir
;
}
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