qetza / vsts-replacetokens-task

[ARCHIVED] Visual Studio Team Services Build and Release extension that replace tokens in files with variable values.. Project moved to https://github.com/qetza/replacetokens-task
MIT License
164 stars 56 forks source link

Tokens not being replaced. Variables not found #54

Closed mmisztal1980 closed 6 years ago

mmisztal1980 commented 6 years ago

I have a release definition that looks like this:

image

The 2nd replace task fails, while the 1st one succeeds. Here's an overview of my variables:

image

Here's the file that is being processed by the extension:

apiVersion: v1
kind: Secret
metadata:
  name: os-smog-api.secrets
  namespace: os-smog-api
data:
  measurementsDatabase: #{Secret.MeasurementsDb}#
  devicesDatabase: #{Secret.DevicesDb}#
  azureStorage: #{Secret.AzureStorage}#
  azureWebJobStorage: #{Secret.AzureWebJobStorage}#

Here's what happens in the release:

2017-11-28T23:26:14.1432824Z ##[debug]Evaluating condition for step: '[replace-tokens] os-smog-api/**/*.yaml'
2017-11-28T23:26:14.1432824Z ##[debug]Evaluating: succeeded()
2017-11-28T23:26:14.1432824Z ##[debug]Evaluating succeeded:
2017-11-28T23:26:14.1442495Z ##[debug]=> (Boolean) True
2017-11-28T23:26:14.1442495Z ##[debug]Expanded: True
2017-11-28T23:26:14.1442495Z ##[debug]Result: True
2017-11-28T23:26:14.1442495Z ##[section]Starting: [replace-tokens] os-smog-api/**/*.yaml
2017-11-28T23:26:14.1442495Z ==============================================================================
2017-11-28T23:26:14.1442495Z Task         : Replace Tokens
2017-11-28T23:26:14.1442495Z Description  : Replace tokens in files
2017-11-28T23:26:14.1442495Z Version      : 2.2.1
2017-11-28T23:26:14.1442495Z Author       : Guillaume Rouchon
2017-11-28T23:26:14.1442495Z Help         : v2.2.1 - [More Information](https://github.com/qetza/vsts-replacetokens-task#readme)
2017-11-28T23:26:14.1442495Z ==============================================================================
2017-11-28T23:26:14.3092867Z ##[debug]agent.TempDirectory=D:\Agents\OpenSmog01\w\_temp
2017-11-28T23:26:14.3152914Z ##[debug]loading inputs and endpoints
2017-11-28T23:26:14.3152914Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2017-11-28T23:26:14.3162534Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2017-11-28T23:26:14.3162534Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2017-11-28T23:26:14.3162534Z ##[debug]loading INPUT_ACTIONONMISSING
2017-11-28T23:26:14.3172533Z ##[debug]loading INPUT_EMPTYVALUE
2017-11-28T23:26:14.3172533Z ##[debug]loading INPUT_ENCODING
2017-11-28T23:26:14.3172533Z ##[debug]loading INPUT_KEEPTOKEN
2017-11-28T23:26:14.3172533Z ##[debug]loading INPUT_ROOTDIRECTORY
2017-11-28T23:26:14.3172533Z ##[debug]loading INPUT_TARGETFILES
2017-11-28T23:26:14.3172533Z ##[debug]loading INPUT_TOKENPREFIX
2017-11-28T23:26:14.3172533Z ##[debug]loading INPUT_TOKENSUFFIX
2017-11-28T23:26:14.3172533Z ##[debug]loading INPUT_WRITEBOM
2017-11-28T23:26:14.3182536Z ##[debug]loading SECRET_AZURESTORAGE
2017-11-28T23:26:14.3182536Z ##[debug]loading SECRET_AZUREWEBJOBSTORAGE
2017-11-28T23:26:14.3182536Z ##[debug]loading SECRET_DEVICESDB
2017-11-28T23:26:14.3182536Z ##[debug]loading SECRET_MEASUREMENTSDB
2017-11-28T23:26:14.3182536Z ##[debug]loaded 16
2017-11-28T23:26:14.3202779Z ##[debug]Agent.ProxyUrl=undefined
2017-11-28T23:26:14.3202779Z ##[debug]Agent.CAInfo=undefined
2017-11-28T23:26:14.3202779Z ##[debug]Agent.ClientCert=undefined
2017-11-28T23:26:14.3252910Z ##[debug]rootDirectory=D:\Agents\OpenSmog01\w\r2\a\os-smog-api
2017-11-28T23:26:14.3262553Z ##[debug]check path : D:\Agents\OpenSmog01\w\r2\a\os-smog-api
2017-11-28T23:26:14.3262553Z ##[debug]encoding=auto
2017-11-28T23:26:14.3262553Z ##[debug]tokenPrefix=#{
2017-11-28T23:26:14.3262553Z ##[debug]tokenSuffix=}#
2017-11-28T23:26:14.3272537Z ##[debug]keepToken=false
2017-11-28T23:26:14.3272537Z ##[debug]actionOnMissing=fail
2017-11-28T23:26:14.3272537Z ##[debug]writeBOM=true
2017-11-28T23:26:14.3272537Z ##[debug]emptyValue=(empty)
2017-11-28T23:26:14.3272537Z ##[debug]targetFiles=**/*.yaml
2017-11-28T23:26:14.3272537Z ##[debug]pattern: #\{((?:(?!\}#).)*)\}#
2017-11-28T23:26:14.3283002Z ##[debug]defaultRoot: 'D:\Agents\OpenSmog01\w\r2\a\os-smog-api'
2017-11-28T23:26:14.3283002Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2017-11-28T23:26:14.3283002Z ##[debug]findOptions.followSymbolicLinks: 'true'
2017-11-28T23:26:14.3283002Z ##[debug]matchOptions.debug: 'false'
2017-11-28T23:26:14.3283002Z ##[debug]matchOptions.nobrace: 'true'
2017-11-28T23:26:14.3283002Z ##[debug]matchOptions.noglobstar: 'false'
2017-11-28T23:26:14.3283002Z ##[debug]matchOptions.dot: 'true'
2017-11-28T23:26:14.3283002Z ##[debug]matchOptions.noext: 'false'
2017-11-28T23:26:14.3283002Z ##[debug]matchOptions.nocase: 'true'
2017-11-28T23:26:14.3283002Z ##[debug]matchOptions.nonull: 'false'
2017-11-28T23:26:14.3283002Z ##[debug]matchOptions.matchBase: 'false'
2017-11-28T23:26:14.3283002Z ##[debug]matchOptions.nocomment: 'false'
2017-11-28T23:26:14.3283002Z ##[debug]matchOptions.nonegate: 'false'
2017-11-28T23:26:14.3283002Z ##[debug]matchOptions.flipNegate: 'false'
2017-11-28T23:26:14.3283002Z ##[debug]pattern: '**/*.yaml'
2017-11-28T23:26:14.3312525Z ##[debug]findPath: 'D:\Agents\OpenSmog01\w\r2\a\os-smog-api'
2017-11-28T23:26:14.3312525Z ##[debug]statOnly: 'false'
2017-11-28T23:26:14.3312525Z ##[debug]findPath: 'D:\Agents\OpenSmog01\w\r2\a\os-smog-api'
2017-11-28T23:26:14.3312525Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
2017-11-28T23:26:14.3312525Z ##[debug]findOptions.followSymbolicLinks: 'true'
2017-11-28T23:26:14.3322540Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api (directory)
2017-11-28T23:26:14.3322540Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts (directory)
2017-11-28T23:26:14.3332856Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps (directory)
2017-11-28T23:26:14.3332856Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api (directory)
2017-11-28T23:26:14.3342562Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\appsettings.Development.json (file)
2017-11-28T23:26:14.3342562Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\appsettings.json (file)
2017-11-28T23:26:14.3342562Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\appSettings.Production.json (file)
2017-11-28T23:26:14.3342562Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\appSettings.test.json (file)
2017-11-28T23:26:14.3342562Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Baseline.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\FastExpressionCompiler.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Marten.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\MediatR.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Microsoft.WindowsAzure.Storage.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Newtonsoft.Json.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Npgsql.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Core.Api.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Core.Queues.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Data.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Dto.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Events.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Smog.Api.deps.json (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Smog.Api.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Smog.Api.pdb (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Smog.Api.PrecompiledViews.dll (file)
2017-11-28T23:26:14.3352522Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Smog.Api.PrecompiledViews.pdb (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Smog.Api.runtimeconfig.json (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Smog.Api.xml (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Smog.Validation.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\OS.Smog.Validation.pdb (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Serilog.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Serilog.Enrichers.Context.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Serilog.Enrichers.Environment.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Serilog.Enrichers.Thread.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Serilog.Extensions.Logging.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Serilog.Settings.Configuration.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Serilog.Sinks.Console.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Serilog.Sinks.Literate.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Serilog.Sinks.Logentries.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Serilog.Sinks.PeriodicBatching.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Swashbuckle.Swagger.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Swashbuckle.SwaggerGen.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\Swashbuckle.SwaggerUi.dll (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\apps\OS.Smog.Api\web.config (file)
2017-11-28T23:26:14.3362517Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\k8s (directory)
2017-11-28T23:26:14.3372920Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\k8s\os-smog-api.deployment.yaml (file)
2017-11-28T23:26:14.3372920Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\k8s\os-smog-api.secret.yaml (file)
2017-11-28T23:26:14.3372920Z ##[debug]  D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\k8s\os-smog-api.service.yaml (file)
2017-11-28T23:26:14.3372920Z ##[debug]47 results
2017-11-28T23:26:14.3372920Z ##[debug]found 47 paths
2017-11-28T23:26:14.3372920Z ##[debug]applying include pattern
2017-11-28T23:26:14.3372920Z ##[debug]adjustedPattern: 'D:\Agents\OpenSmog01\w\r2\a\os-smog-api\**/*.yaml'
2017-11-28T23:26:14.3382863Z ##[debug]3 matches
2017-11-28T23:26:14.3392515Z ##[debug]3 final results
2017-11-28T23:26:14.3402878Z replacing tokens in: D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\k8s\os-smog-api.deployment.yaml
2017-11-28T23:26:14.3412537Z ##[debug]BOM no found: default to ascii.
2017-11-28T23:26:14.3412537Z ##[debug]encoding: ascii
2017-11-28T23:26:14.3522876Z ##[debug]Release.ReleaseId=117
2017-11-28T23:26:14.3562537Z replacing tokens in: D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\k8s\os-smog-api.secret.yaml
2017-11-28T23:26:14.3562537Z ##[debug]BOM no found: default to ascii.
2017-11-28T23:26:14.3562537Z ##[debug]encoding: ascii
2017-11-28T23:26:14.3562537Z ##[debug]Secret.MeasurementsDb=undefined
2017-11-28T23:26:14.3572520Z ##[debug]task result: Failed
2017-11-28T23:26:14.3622532Z ##[error]variable not found: Secret.MeasurementsDb
2017-11-28T23:26:14.3622532Z ##[debug]Processed: ##vso[task.issue type=error;]variable not found: Secret.MeasurementsDb
2017-11-28T23:26:14.3632535Z ##[debug]Processed: ##vso[task.complete result=Failed;]variable not found: Secret.MeasurementsDb
2017-11-28T23:26:14.3632535Z ##[debug]Secret.DevicesDb=undefined
2017-11-28T23:26:14.3632535Z ##[debug]task result: Failed
2017-11-28T23:26:14.3632535Z ##[error]variable not found: Secret.DevicesDb
2017-11-28T23:26:14.3632535Z ##[debug]Processed: ##vso[task.issue type=error;]variable not found: Secret.DevicesDb
2017-11-28T23:26:14.3632535Z ##[debug]Processed: ##vso[task.complete result=Failed;]variable not found: Secret.DevicesDb
2017-11-28T23:26:14.3632535Z ##[debug]Secret.AzureStorage=undefined
2017-11-28T23:26:14.3632535Z ##[debug]task result: Failed
2017-11-28T23:26:14.3632535Z ##[error]variable not found: Secret.AzureStorage
2017-11-28T23:26:14.3632535Z ##[debug]Processed: ##vso[task.issue type=error;]variable not found: Secret.AzureStorage
2017-11-28T23:26:14.3632535Z ##[debug]Processed: ##vso[task.complete result=Failed;]variable not found: Secret.AzureStorage
2017-11-28T23:26:14.3632535Z ##[debug]Secret.AzureWebJobStorage=undefined
2017-11-28T23:26:14.3632535Z ##[debug]task result: Failed
2017-11-28T23:26:14.3632535Z ##[error]variable not found: Secret.AzureWebJobStorage
2017-11-28T23:26:14.3632535Z ##[debug]Processed: ##vso[task.issue type=error;]variable not found: Secret.AzureWebJobStorage
2017-11-28T23:26:14.3632535Z ##[debug]Processed: ##vso[task.complete result=Failed;]variable not found: Secret.AzureWebJobStorage
2017-11-28T23:26:14.3642526Z replacing tokens in: D:\Agents\OpenSmog01\w\r2\a\os-smog-api\artifacts\k8s\os-smog-api.service.yaml
2017-11-28T23:26:14.3642526Z ##[debug]BOM no found: default to ascii.
2017-11-28T23:26:14.3642526Z ##[debug]encoding: ascii
2017-11-28T23:26:14.3672528Z ##[section]Finishing: [replace-tokens] os-smog-api/**/*.yaml

Can anyone explain why are the variables not being detected?

mmisztal1980 commented 6 years ago

Interestingly, having replaced the "Secret" prefix with something else, made the variables visible to the release-tokens task.