Posted on Leave a comment

Parameters and variables – GitHub workflows

Variables and parameters can be used on GitHub workflows in order to provide input and store temporary values that should be passed on tasks. When you need to ask for user input one should use the parameters and when that is not necessary variables is the preferred way to go.

We will now examine how we can use both in a github workflow.

You can define an input parameter using the inputs keyword. Using the code below you can run a workflow manually. The input that is requested is a string and the description is the message that will be shown to the user.

  # Allows you to run this workflow manually from the Actions tab
        description: "give me your username"
        default: "geralexgr"
        type: "string"

Then later in the workflow you can use the value of the input using inputs.username

The below job will show the input of the user:

    runs-on: ubuntu-latest
      - name: task inside job1
        run: |
          echo The username is ${{ inputs.username }}

Variables on the other hand can be used during runtime. Similar to using default environment variables, you can use custom environment variables in your workflow actions. To create a custom variable, you need to define it in your workflow file using the env context.

      - name: print variable
          NAME: "Gerasimos"
        run: |
          echo Variable name is: $NAME

During workflow run the variable will be printed on the output.

Youtube tutorial:

Posted on Leave a comment

Install azure cli using Powershell – silent mode

Az cli is a very important tool that one devops engineer may need to install on systems. You can perform a silent install on a windows machine using the powershell below:

$msiFilePath = "azure-cli.msi"
Invoke-WebRequest -OutFile $msiFilePath
$MSIArguments = @(
    ('"{0}"' -f $msiFilePath)
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow
Remove-Item -Path $msiFilePath  -Force

By running the powershell the download procedure will begin.

When the installation finishes you can locate it under installed programs:

Posted on Leave a comment

Build NodeJS applications using Azure devops and npm

In this article I will explain how you can build your nodeJS application on Azure Devops. For the purposes of this demo I have created a hello world javascript application and stored it under a folder called node inside my repository with the name project.

We will use the folder structure later on for the build tasks.

The node folder contains two files, index.js and package.json. 

The package.json file has been created automatically after initialization of a new project with

npm init

In order to build this project using npm you should define under the scripts section the commands that will be executed using a specific target. 

For example in order to compile application I will execute

npm run build

but the build instructions have to be configured under the package.json file. 

"name": "nodetest",
"version": "1.0.0",
"description": "Test project for AzureDevops using nodeJS",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "node index.js",
"build": "node index.js"
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.1"

As shown above, the build and dev targets have a simple node command that will start the application.

The index.js file is a console output javascript command.

console.log("Hello from node js app");

In order to build this node app using devops I will use the build in Npm@1 task. First I will execute the install command in order to install dependencies. Then I will run npm run with the target build. This will execute the node index.js command and will execute the node application.

- none
vmImage: ubuntu-latest
- task: Npm@1
displayName: npm install
command: 'install'
workingDir: '$(Build.SourcesDirectory)/node/'
- task: Npm@1
displayName: npm run build
command: 'custom'
workingDir: '$(Build.SourcesDirectory)/node/'
customCommand: 'run build'

After pipeline run the Hello world message will print on the output.

Find this guide on Youtube: