Code Monkey home page Code Monkey logo

authenticated-scripts's Introduction

authenticated-scripts's People

Contributors

dependabot[bot] avatar joshuathemiller avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

authenticated-scripts's Issues

please leverage tag/releases

i can only adopt a task that has a changelog per policy, i'd probably make use of this if i could sync the rss of github releases to our system

Passing environment variables to authenticated script

I'm trying to figure out how to pass in environment variables in a similar fashion to the official pwsh/bash tasks available in Azure DevOps. For example:

- pwsh: Write-Host $env:SOMEVAR
  env:
    SOMEVAR: example

I was looking at the task.json of the official tasks and they don't explicitly have an input for the environment variable mapping, there's simply "showEnvironmentVariables": true, which is what this repo appears to use as well.

I tried to do this with the authenticated scripts task and got the "mapping was not expected error" where I tried to define the env mapping.

- task: AuthenticatedPowerShell@1  
  inputs:
    serviceConnection: generic-service-connection
    targetType: inline
    script: |
      Write-Host $env:SOMEVAR
    env:
      SOMEVAR: example

My use case here is that I'm trying to use the AuthenticatedPowerShell task in a YAML template that would be consumed by many pipelines, but I'd like to have a parameter available in the template that would allow pipelines to pass in custom environment variables for the script on an as-needed basis. I might be able to parse the parameter and set environment vars within the pwsh script it self, but though this would be cleaner and easier.

I'd be happy to make a PR but I can't quite figure out what is needed. Any thoughts? Love the extension otherwise, thanks for putting it together ❤️

Does this duplicate the existing script tasks?

Does this extension make use of the existing Azure DevOps script tasks or does it duplicate the code?

I really like this extension and think it would be very useful. My only concern is if it is duplicating the existing Azure DevOps tasks.
If the existing Azure DevOps PowerShell and Script tasks get updated will this extension get those updates or will we have to wait for this extension to update it's code to match what the Azure DevOps tasks are?

Execute Powershell script with powershell instead of pwsh

While playing around with my fork, I noticed that the task for Powershell scripts executes them with Powershell 7 (pwsh.exe) on a Windows runner.

The following implicates that this should only happen when the pwsh parameter is true.

{
"name": "pwsh",
"type": "boolean",
"label": "Use PowerShell Core",
"required": false,
"defaultValue": "false",
"helpMarkDown": "If this is true, then on Windows the task will use pwsh.exe from your PATH instead of powershell.exe.",
"groupName": "advanced"
},

I believe this is a bug that was copied over from https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/PowerShellV2/powershell.ts, since both that logic and https://github.com/cloudpups/authenticated-scripts/blob/main/tasks/powershell/execute-cli.ts do not make use of the pwsh parameter. The Microsoft task is not affected by that bug, because it uses https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/PowerShellV2/powershell.ps1 when the task is executed on a Windows runner. That script considers the pwsh parameter.

I made a change on my fork to address that issue, but it would require some additional work to bring it over to this repo (mainly to add logic to check if the task is running on Windows or not).

If there is interest for that, I can try creating a pull request.

Do these tasks actually require a dependency on NPM?

I have found this task extremely useful - thanks so much for developing it!

I did have a question though. As I am using on-prem build agents, not all of the servers have NPM installed. This causes the task to fail on those servers. I was wondering if NPM is actually necessary demand for this task to execute? I'm definitely no expert, but thought it might be more of a design time thing as don't these sorts of tasks ultimately produced javascript at the end of the day?

Anyway, it would be great if the NPM dependency could be removed from the following powershell task (and I spose from the bash task as well):
https://github.com/cloudpups/authenticated-scripts/blob/main/tasks/powershell/task.json#:~:text=%22-,npm,-%22

"No results found" in Service Connection select input

Hi there,

I've just installed this extension (Azure DevOps Services), and when using both "Authenticated Powershell" and "Authenticated Bash", the Service Connection select input is empty ("No results found"). I've tried refreshing the input, and can confirm that other tasks in the job are able to access the list of Service Connections from their equivalent menus. Am I doing something wrong here?
image

Thanks!

Chris.

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.