now respoecting registryrepo maps
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import * as plugins from './mod.plugins'
|
||||
import * as paths from '../npmci.paths'
|
||||
import * as NpmciEnv from '../npmci.env'
|
||||
import * as NpmciConfig from '../npmci.config'
|
||||
import { bash } from '../npmci.bash'
|
||||
|
||||
import { Dockerfile } from './mod.classes.dockerfile'
|
||||
@ -130,13 +131,25 @@ export let dockerBaseImage = function (dockerfileContentArg: string) {
|
||||
/**
|
||||
* returns the docker tag
|
||||
*/
|
||||
export let getDockerTagString = function (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string): string {
|
||||
// determine wether the suffix is needed
|
||||
export let getDockerTagString = (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string): string => {
|
||||
|
||||
// determine wether the repo should be mapped accordingly to the registry
|
||||
let mappedRepo = NpmciConfig.configObject.dockerRegistryRepoMap[registryArg]
|
||||
let repo = (() => {
|
||||
if (mappedRepo) {
|
||||
return mappedRepo
|
||||
} else {
|
||||
return repoArg
|
||||
}
|
||||
})()
|
||||
|
||||
// determine wether the version contais a suffix
|
||||
let version = versionArg
|
||||
if (suffixArg) {
|
||||
version = versionArg + '_' + suffixArg
|
||||
}
|
||||
let tagString = `${registryArg}/${repoArg}:${version}`
|
||||
|
||||
let tagString = `${registryArg}/${repo}:${version}`
|
||||
return tagString
|
||||
}
|
||||
|
||||
|
@ -15,12 +15,14 @@ export interface INpmciOptions {
|
||||
// instantiate a kvStorage for the current directory
|
||||
export let kvStorage = new KeyValueStore('custom', `${repo.user}_${repo.repo}`)
|
||||
|
||||
export let getConfig = async (): Promise<INpmciOptions> => {
|
||||
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
|
||||
let defaultConfig: INpmciOptions = {
|
||||
npmGlobalTools: [],
|
||||
dockerRegistryRepoMap: {}
|
||||
}
|
||||
let npmciConfig = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig)
|
||||
return npmciConfig
|
||||
// handle config retrival
|
||||
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
|
||||
let defaultConfig: INpmciOptions = {
|
||||
npmGlobalTools: [],
|
||||
dockerRegistryRepoMap: {}
|
||||
}
|
||||
export let configObject = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig)
|
||||
|
||||
export let getConfig = async (): Promise<INpmciOptions> => {
|
||||
return configObject
|
||||
}
|
||||
|
Reference in New Issue
Block a user