Installing ChromeDriver on self-hosted Azure DevOps Agent - azure

I recently created a self-hosted Azure DevOps Agent and installed with Google Crome as well. Is it possible to install Chrome Driver on this server and can I select a specific version to be used?
I'd like for Chrome Driver 2.42.0.1 to be used by this Self-hosted Agent.
Any help will be much appreciated. Thanks!

One more solution to use Microsoft-hosted agents with already installed Chrome browser chrome driver.
Agents already contain environment variable with ChromeWebDriver location on Agent (It works for "windows-2019" and "vs2017-win2016"
Microsoft-hosted agents).
Also firefox and IE drivers exists on Agents (https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md).
C# code:
ChromeOptions chromeOptions = new ChromeOptions();
var driverPath = Path.Combine(Directory.GetCurrentDirectory());
var envChromeWebDriver = Environment.GetEnvironmentVariable("ChromeWebDriver");
if(!string.IsNullOrEmpty(envChromeWebDriver) &&
File.Exists(Path.Combine(envChromeWebDriver, "chromedriver.exe")))
{
driverPath = envChromeWebDriver;
}
ChromeDriverService defaultService = ChromeDriverService.CreateDefaultService(driverPath);
defaultService.HideCommandPromptWindow = true;
var driver = (IWebDriver) new ChromeDriver(defaultService, chromeOptions);

Installation I found using npm install here: :)
https://www.npmjs.com/package/chromedriver

This may be a late post but to help out the forum, which has helped me since almost a decade, here is how we sorted it out.
By default the "Azure Pipelines Hosted VS2017 image" (Or in Classic Editor Agent Specification its called vs2017-win2016) already has Google Chrome (Version 77.0.3865.90 as on 3rd December 2019) and ChromeDriver (77.0.3865.40 as on 3rd December 2019) pre-installed (More info here - https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2017-Server2016-Readme.md)
But we still faced the issue of "selenium-side-runner" not able to find the ChromeDriver due to the missing PATH in the System Variables of Environment variable in Windows.
Image - Chrome Driver Not found
So we tried digging in a bit deeper and found that we could achieve this by uploading the ChromeDriver through the Build process and then copying that into the NodeJs folder within C:Program Files..! Sweet?
Lets walk through the steps briefly to see how this is achieved.
We first have to visit https://chromedriver.chromium.org/downloads
and search for the version of the driver matching the version on
Chrome installed on the Hosted Agent (Version 77 in our case as on
date)
Next we create a folder in our Azure Repos and push both the
Chromedriver.exe and our Sample.side file in that folder (Side file
can be named per your preference, and this is generated from the
Selenium IDE)
Adding ChromeDriver.exe and sample.side file in the Repo
Now we create the Build process to just zip the contents of this
folder and create an Artifact from this to be consumed in the
Release Pipeline.
Build Pipeline explained
Next we build the Release Pipeline and ensure that the
vs2017-win2016 Agent is taken
The steps assigned to the Agent include:
Extracting of the zip file
Installing the Selenium Side Runner by using NPM and custom
Command - "install -g selenium-side-runner"
We then have to copy the ChromeDriver.exe from the extracted files
to "C:\Program Files\nodejs" folder using command prompt -
copy "chromedriver.exe" "C:\Program Files\nodejs"
The final step would be to run the "selenium-side-runner"
command - selenium-side-runner sample.side
We would see the test result at the end of the task by checking the log file for the task.
Hope this helps..!

Related

Azure self-hosted build agent: ##[error]Version spec 3.10 for architecture x64 did not match any version in Agent.ToolsDirectory

I followed the Microsoft guidance on installing a self-hosted build agent for Windows on my local machine. The agent is running and responsive and can successfully execute all task steps preceding point of failure.
The failing task is UsePythonVersion#0 task which is defined as such below:
- task: UsePythonVersion#0
inputs:
versionSpec: '3.10'
addToPath: true
architecture: 'x64'
The error raised when build is executed:
##[error]Version spec 3.10 for architecture x64 did not match any version in Agent.ToolsDirectory.
I configured the agent to run this task as per the steps detailed in the URL. This can be seen in the provided screenshots.
I added user-defined capabilities as per Microsoft guidance which were not picked automatically due to being environment variables
The Python environment target is a virtual one and was installed in place. The Python environment was not on the path so I added it and restarted the Azure Pipelines Agent service. I don't think it needs to be on the path, but I might be incorrect.
Another user had a GitHub issue open and the recommendation was to not specify the Python subversion. I tried this and set versionSpec: '3', this did not resolve the error and the message did not change.
I tried restarting the Azure Pipelines Agent service after making changes to the tools_ directory.
Also note that I have not overridden $AGENT_TOOLSDIRECTORY/.
I referenced this Q/A and tried moving files from the script directory one level up. This did not resolve my issue. I also reinstalled python precompiled into this directory as per the recommendation. That did not resolve the problem either.
I also reinstalled Python 3.10 for all users precompiled C:\Program Files\Python310 and updated the path. I restarted the service and was able to see the new location added to the path in the agent capabilities. I ran the CI pipe again and the same error was returned.
I have removed the step for now and added a user capability to the agent which references the Python installation that I want to use. It seems to be using that installation. This is not satisfactory though.
I don't know what I have missed.

Getting error trying to make Terraform work with IBM Cloud

I am using the following instructions:
https://console.bluemix.net/docs/terraform/setup_cli.html#setup_cli
When I run terraform init
I get the following error:
Provider "ibm" not available for installation.
A provider named "ibm" could not be found in the official repository.
This may result from mistyping the provider name, or the given provider may
be a third-party provider that cannot be installed automatically.
In the latter case, the plugin must be installed manually by locating and
downloading a suitable distribution package and placing the plugin's executable
file in the following directory:
terraform.d/plugins/windows_amd64
Terraform detects necessary plugins by inspecting the configuration and state.
To view the provider versions requested by each module, run
"terraform providers".
I am on windows 10 pc, I tried placing following executable under:
$HOME/terraform.d/plugins/windows_amd64/terraform-provider-ibm_v0.14.1.exe
Can anyone point why this is not working?
I think there is a bug in instructions of IBM Cloud. But when I put the executable file under the following path it works:
$HOME\terraform.d\plugins\terraform-provider-ibm_v0.14.1.exe
Hope this answer will help save someone some time.
There are clear steps on how to configure the IBM Cloud Provider for Terraform in this solution tutorial on both Windows and non-windows operating systems.
On Windows, the file needs to be placed in terraform.d/plugins beneath your user's "Application Data" directory.
Run the below commands on a command prompt Provider Configuration
MD %USERPROFILE%\AppData\terraform.d\plugins
MOVE PATH_TO_UNZIPPED_PROVIDER_FILE\terraform-provider-ibm.exe %USERPROFILE%\AppData\terraform.d\plugins
Launch Windows Powershell (Start + R > Powershell) and run the below command to create terraform.rc file
echo > $env:APPDATA\terraform.rc
At the first prompt, enter the below content
# ~/.terraformrc
providers {
ibm = "PATH_TO_YOUR_APPDATA_PLUGINS/terraform-provider-ibm.exe"
}
The file terraform.rc should be saved with Encoding ANSI and you have to be sure of not having weird characters.

Running Unity CLI on Headless Linux to build open source project - license issue

How can I run Unity CLI on Linux to build my project without getting the dreaded "Failed to activate/update license" error. Why do I need a license to do a build from the command line? This works fine for Unity CLI on macOS and Windows.
Launching Unity from the UI and signing in once is not an option as I am trying to do this on Travis CI.
Here's my .travis.yml file and related install + build scripts and here's the failing build
The doc Command line arguments mentions serial, username and password. But they seem not in your build scripts.
Also try the lastest build of Unity3D for linux.
There is a fix in the lastest release (5.6.0b10):
Fix "Manage License" UI regression
UPDATE
Just found a post about your problem. Hope it helps.
1) Network issue - Some education users will have internal network and lack of internet access (can you verify if you can ping to https://core.cloud.unity3d.com/api/login on command line?).
2) To verify if it is a CACerts.pem issue, can you follow this code:
https://github.com/justin-zheng/travisbuildtest
CACerts.pem is included in the repository
Add the CACerts.pem to the Unity license folder (in the user's .local directory: ~/.local/share/unity3d/Certificates/)
You can create and use a license file following next steps.
Create license file:
/opt/unity-editor-2018.3.0f2/Editor/Unity -batchmode -createManualActivationFile -logfile -nographics
Go to https://license.unity3d.com/manual and upload ulf generated file
Use downloaded ulf file:
/opt/unity-editor-2018.3.0f2/Editor/Unity -batchmode -manualLicenseFile Unity_v2018.x.ulf -logfile -nographics
That's all

Google Cloud SDK - Is there a way to manually install google cloud sdk on Linux without internet access?

I am trying to install Google Cloud SDK on a Linux machine without any Internet access.
I am following the instructions at: https://cloud.google.com/sdk/?hl=en
I downloaded the tar file on my local machine and transferred it to the Linux machine using scp. I then ran the install.sh file and got the following error:
[me#user google-cloud-sdk]$ ./install.sh
Welcome to the Google Cloud SDK!
To help improve the quality of this product, we collect anonymized data on how
the SDK is used. You may choose to opt out of this collection now (by choosing
'N' at the below prompt), or at any time in the future by running the following
command:
gcloud config set --scope=user disable_usage_reporting true
Do you want to help improve the Google Cloud SDK (Y/n)? n
This will install all the core command line tools necessary for working with
the Google Cloud Platform.
/home/me/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py:661: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
exc_message = getattr(exc, 'message', None)
/home/me/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py:664: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
msg = u'({0}) {1}'.format(command_path_string, exc.message)
ERROR: (gcloud.components.update) Failed to fetch component listing from server. Check your network settings and try again.
I have a proxy server that I can use to access the internet from this Linux machine. I tried running install.sh as 'sh install.sh --proxy host:port' but obviously, there is no input parameter called proxy to install.sh.
How can I work around this problem?
Thanks in advance.
Exported my proxy details as "export https_proxy='...'" before running the install.sh file.
This worked for me.
Go to Advanced System settings and create a variable HTTPS_PROXY,
restart CMD.
echo %HTTPS_PROXY%
To make sure it has taken the changes into account.
Launch the install.bat

How to install InfluxDB in Windows

I am new to InfluxDB. I could not find any details about installing InfluxDB on Windows. Is there any way to install it on a Windows machine or do I need to use a Linux server for development purposes?
The current 0.9 branch of influxdb is pure go and can be compiled on Windows with the following commands:
cd %GOPATH%/src/github.com/influxdb
go get -u -f ./...
go build ./...
Of course you will need go (>1.4), git and hg.
If you do not want to compile your own version, you can also find here my own Windows x86 binaries for v0.9.0-rc11:
https://github.com/adriencarbonne/influxdb/releases/download/v0.9.0-rc11/influxdb_v0.9.0-rc11.zip
To run InfluxDB, type: influxd.exe.
Or even better, create the following config file, save it as influxdb.conf and run influxd --config influxdb.conf:
reporting-disabled = true
#[logging]
#level = "debug"
#file = "influxdb.log"
[admin]
enabled = true
port = 8083
[api]
port = 8086
[data]
dir = "data"
[broker]
dir = "broker"
I struggled quite a lot with this issue, so I'll post the full process step by step. This will hopefully help other people that lands on this post.
Table of contents:
Edit: WARNING, this doesn't work if Go and projects folder are installed to a custom path (not c:\go). In this case go get breaks with cryptic messages about unrecognized import paths (thanks to user626528 for the info)
PREVIOUS DOWNLOADS
COMPILATION
EXECUTION
1. PREVIOUS DOWNLOADS
Go for Windows (get the .msi):
https://golang.org/dl/
GIT for Windows:
http://git-scm.com/download/win
2. COMPILATION
cd to C:\Go
Create our $GOPATH in "C:\Go\projects" (anywhere but C:\Go\src, which is the $GOROOT).
> mkdir projects
Set to $GOPATH variable to this new directory:
> set GOPATH=C:\Go\projects
Pull the influxdb code from github into our $GOPATH:
> go get github.com/influxdata/influxdb
cd to C:\Go\projects\github.com\influxdata\influxdb
Pull the project dependencies:
> go get -u -f ./...
Finally, build the code:
> go build ./...
...this will create 3 executables under C:\Go\projects\bin:
influx.exe
influxd.exe
urlgen.exe
3. EXECUTION
To start the service:
influxd -config influxdb.conf
For that, you first need to create a influxdb.conf file with the following text:
reporting-disabled = true
#[logging]
#level = "debug"
#file = "influxdb.log"
#write-tracing = false
[admin]
enabled = true
port = 8083
[api]
port = 8086
[data]
dir = "data"
[broker]
dir = "broker"
Once the service is started, you can execute Chrome and go to http://localhost:8083, and start playing with InfluxDb.
Default values for username and password are:
username: root
password: root
Few updates to Xavier Peña solution to build latest influxdb. Notice the difference in github URL and the path.
C:\Go\projects>go get github.com/influxdata/influxdb
C:\Go\projects>go get github.com/sparrc/gdm
C:\Go\projects>cd C:\Go\projects\src\github.com\influxdata\influxdb
C:\Go\projects\src\github.com\influxdata\influxdb>go get -u -f ./...
C:\Go\projects\src\github.com\influxdata\influxdb>c:\Go\projects\bin\gdm.exe restore
C:\Go\projects\src\github.com\influxdata\influxdb>go build ./...
C:\Go\projects\src\github.com\influxdata\influxdb>go install ./...
C:\Go\projects\bin>influxd config > influxdb.generated.conf
C:\Go\projects\bin>influxd -config influxdb.generated.conf
Windows if officially supported. Go to https://portal.influxdata.com/downloads and download it from there.
The current 0.9 branch of influxdb is pure go and can be compiled on Windows. The main prerequisites are go 1.4, git (e.g. tortoisegit together with msysgit), hg (e.g. tortoisehg).
Using this setup I've successfully compiled and run influxdb on Win7 x64.
There wasn't an influxdb Windows version at Sep 30 '14, there were are only Linux and OSX versions.
Update: Current 0.9 version at present 04/09/2015 have a win version.
The "nightlies" build actually has windows executables now. The release version does not (there is an open issue for that).
Alternatively, downloading the released version and adding the .exe extension to the file names should work as well. You would have to generate the config file using the command:
influxd config >influxdb.conf
Update 2020 - InfluxDB is NOT recommended on windows
After going through countless of articles, it is generally NOT recommended to install InfluxDB directly on Windows. There are many issues. In terms of performance and stability. Official InfluxDB too does not support windows and has no plans for it in the future. This is further proven as the latest InfluxDB 2.0 does not include any windows binaries.
InfluxDB 2.0 does not include windows binaries
so?
Work Around? => DOCKERS for WINDOWS, Try it, it's easy and free
Dockers are free. If you intend to install docker on Windows Server, it's also free for Windows Server 2016 and above (Microsoft made a special deal with docker to provide them for free)
For those who are still in the VM world:
Dockers are NOT like Virtual Machines. It interacts directly with the host's file system via a windows service
Check the link below for a step by step guide:
https://www.open-plant.com/knowledge-base/how-to-install-influxdb-docker-for-windows-10/
We don't officially support Windows at this time. However, you should now be able to build from master. See this issue to track it closely and the comments at the bottom have a link to where you can get a compiled binary:
https://github.com/influxdata/influxdb/issues/5359
For create influxdb configuration file we can also use the below command
influxd config > influxdb.generated.conf
If you don't want to compile it yourself, the build is done by influxdata and can be found at URLs like : https://dl.influxdata.com/influxdb/releases/influxdb-1.0.0-beta2_windows_amd64.zip (just change the version number to have another (recent) version)
However, as mentionned by Paul Dix, Windows is not officially supported for the moment.
Go to influxdata.com click downloads
https://portal.influxdata.com/downloads/
Select version 1.7 because currently there are no binaries for 2.0.
Download Windows binary

Resources