Code Monkey home page Code Monkey logo

vsts-json-to-variable's People

Contributors

jeffpriz avatar lturmel avatar mxclyde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vsts-json-to-variable's Issues

Question on use of the variables

Hi,

I am wondering how I can reference the variables in a subsequent task.
I put the variable name in as reference name in the Output Variables section of the Json to Variable task - see attached screen shot.
image

I get this message however when trying to save:
The pipeline is not valid. Job Phase_1: Step json.paths.zippedPackage has an invalid name. Valid names may only contain alphanumeric characters and '_' and may not start with a number.

I tried both putting in "json.paths.zippedPackage" and "$(json.paths.zippedPackage) and get the same result.

Please advise.

Regards
Leif

PowerShell access

I can access the set variable via inline PowerShell without issue (e.g. $(json.myVariable) but I cannot access them from within a PowerShell script (either via $(json.myVariable) or $env:json.myVariable).

Most likely I am doing something wrong, but I thought I'd run this by you either way to see what you think. Thanks.

Missing "dist" folder in new version (1.0.12)

I now get the following error when using the latest version of JSON to Variable (1.0.12). When browsing the file system on my build machine, it appears that the "dist" folder is missing. The "dist" folder, however, does exist for version 1.0.11. Let me know if there are any workarounds I can do. Thanks

File not found: '/home/noesis/azure-devops-agent/_work/_tasks/oneLuckiDevJson2Variable_6f9cdff3-a6b9-47e1-90a8-6590ba11e157/1.0.12/./dist/json2variable.js'

SyntaxError: Unexpected token } in JSON

Hi,
I got an issue when using your task for a release pipeline on Azure Devops.

I try to parse a swagger.json file that I made. I know the json is correct because I use it everywhere else.

But on your task, I get that error :

screenshot 2018-10-31 at 15 41 59

I know it looks like a wrongly formated json, But I assure you, it is completly correct.

Thanks for your help :)

Make the prefix optional

Hey,

Could the prefix be optional?
I need to load a json with a f**ckton of configuration variables which are then substituted in config files (not just json files) for the app im deploying and I wouldn't want to have to rename all of them from PREFIX.{appvar} to {appvar}. I've tried simply leaving the prefix field empty but then it adds the default 'json' prefix.

Many thx,

Null values exception

If a value is null then the task stops creating variables
....
....
Creating variable : PanasoftCommonUtilities.versions1.views1.type | implicit
(node:10812) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'toString' of null
##[section]Finishing: JSON to Variable

Warnings about this task using Node 6 execution handler

Hi there. Firstly, thanks for the useful task!

We've noticed the following warnings appearing during builds:

[warning]This task uses Node 6 execution handler, which will be removed March 31st 2022. If you are the developer of the task - please consider the migration guideline to Node 10 handler - https://aka.ms/migrateTaskNode10 (check this page also if you would like to disable Node 6 deprecation warnings). If you are the user - feel free to reach out to the owners of this task to proceed on migration.

Are you likely to update to the Node 10 handler? It would be good to know in advance if you decide not to so that we can start looking for alternatives, but hopefully you will be updating because this is such a useful build task!

Thanks in advance!

appsettings.json with array not being transformed correctly.

I have an issue where I'm using your task to read my appsettings.{env}.json transform file as part of a yaml pipeline, I can see the settings get loaded into the variables, but then it isn't applying to the end file for arrays. Everything else seems to work as expected.
appsettings.{env}.json

  "SQS": {
    "RunWindows": [
      {
        "Start": "04:00:00",
        "End": "21:30:00",
        "TimeZone": "UTC"
      }
    ]
  },

appsettings.json

"SQS": {
  "RunWindows": [
    {
      "Start": "10:00:00",
      "End": "20:00:00",
      "TimeZone": "UTC"
    }
  ]
}

I can see the output in the pipeline is coming out as SQS.RunWindows1.Start, SQS.RunWindows1.End, SQS.RunWindows1.TimeZone
I believe this should be SQS.RunWindows.1.Start, SQS.RunWindows.1.End, sqs.runwindows.1.TimeZone based on the
JSON variable substitution notes on Microsoft's FileTransform.

Am I misunderstanding something here or has this issue just not come up?

I believe the issue is in this line of code and the fix would be just to add the period before adding the number
prfx = thisDataItem.PrefixChain + (arrayNDX + 1).toString();

Json files with depth >3 not being expanded

If you have a json file with a depth >3 it won't be correctly expanded. The keys in the 4th level will be put into a single variable e.g. the below

"depth1":{
     "key1":"value1"
     "depth2":{
          "key2":"value2
          "depth3":{
                "depth4key1":"value1",
                "depth4key2":"value2",
                "depth4key3":"value3"
           }
      }
 }

Will correctly create variables depth1.key1=value1 and depth1.depth2.key2=value2 but it will then create a variable with name depth1.depth2.depth3=@{depth1.depth2.depth3.depth4key1=value1 ; depth1.depth2.depth3.depth4key2=value2 ; depth1.depth2.depth3.depth4key3=value3}

Incorrect handling of null value

Great task! I am receiving the following error when using this task on a json file that contains a null value:

(node:3418) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'toString' of null

PS. I have no experience with developing Azure DevOps tasks and TypeScript, but I will try to file a PR if I can in the coming days.

Accessing the created variable

this extension looks like it is exactly what i need.

But i am stuck in how to access the variable that is created?

I have a JSON file:
{
"IncludeAllSolutions": true
}
in my Build Pipeline, I created and agent that uses the Json to Variables Step.
the variable is created:
Creating variable : json.IncludeAllSolutions

the second agent then has a condition:
eq(variables['json.IncludeAllSolutions'] , true)

but it expands to: eq(Null, True) Result:False

it seems not to find the new variable. I also tried creating a library variable (with the JSON prefix disabled) and also a local variable, but they never seem to be found.

What am I doing wrong?

File not found on Linux

When trying to use it on a Linux agent, I got this error:
2018-04-16T02:59:15.0297019Z ##[section]Starting: JSON to Variable 2018-04-16T02:59:15.0353449Z ============================================================================== 2018-04-16T02:59:15.0366886Z Task : Json 2 Variable 2018-04-16T02:59:15.0380248Z Description : Task that will read a JSON file and create build and/or release variables available to other tasks for the data in the JSON 2018-04-16T02:59:15.0394682Z Version : 1.0.3 2018-04-16T02:59:15.0407722Z Author : Jeff Przylucki 2018-04-16T02:59:15.0420937Z Help : 2018-04-16T02:59:15.0434745Z ============================================================================== 2018-04-16T02:59:15.3692313Z ##[error]File not found: '/home/vsts_agent2/_work/_tasks/oneLuckiDevJson2Variable_6f9cdff3-a6b9-47e1-90a8-6590ba11e157/1.0.3/./dist/Json2Variable.js' 2018-04-16T02:59:15.3751431Z ##[section]Finishing: JSON to Variable

Probably about path naming or packaging?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.