Self hosted Github runner does not load env variables from .zshrc - github-actions

When I'm trying to run an action via Github with my self hosted runner it is not possible to load the environment variables from my .zshrc file (e.g. the PATH)
When I'm executing "printenv" I will get e.g for PATH:
PATH=/usr/bin:/bin:/usr/sbin:/sbin
but it should be:
PATH=/Users/jenkins/.rbenv/shims:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/jenkins/.rbenv/shims:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/bin:/bin:/usr/sbin:/sbin
It is only possible when I call source ~/.zshrc before the printenv.
Is it possible to open the shell directly with the zshrc env variables without sourcing it manually?

Related

How can I copy a "Microsoft.Web/sites/slots" appsettings values into a file?

Using an ARM template, I populate new and existing secrets from a keyvault (and a few environment specific settings) into the appsettings for a staging slot.
As part of the release pipeline I overwrite some of the appsettings on a slot with test values using the az webapp config appsettings set command.
After this, I need to revert the appsettings back to the original values from the ARM template prior to swapping my slot with the production slot.
Can I directly copy the slot's appsettings to a file in the pipeline, or create an additional file in the ARM template?
This would allow me to reapply the production settings after I run my tests.
Can I directly copy the slot's appsettings to a file in the pipeline, or create an additional file in the ARM template?
Of courseļ¼Œ you can achieve it.
You could try to use the following command to output the appsettings to the Json file.
$result=az webapp config appsettings list --name WebAppName -g ResourceGroupName --slot slotname
$result | Out-File "$(System.DefaultWorkingDirectory)\file.json"
Then the appsettings will be output to the json file.
For example:
After running the test, you could run the following command to revert the appsettings back to the original values.
az webapp config appsettings set -g ResourceGroupName -n WebAppName --slot slotname --settings "#$(System.DefaultWorkingDirectory)\file.json"
Here is the doc about az web app config settings.

Setting multiple environment variables in vercel build step

I am setting a couple of env variables on build time when deploying on vercel using "amondnet/vercel-action#v19.0.1+3" github action.
Everything works fine when I set just one variable, but when I set multiple variables as described in Vercel's documenation here: https://vercel.com/docs/cli#commands/overview/unique-options/build-env, I get the following error when running the action:
Error! The specified file or directory "PR_NUMBER=423]" does not exist.
The command the action is trying to run is as follows:
/usr/local/bin/npx vercel --build-env [NODE_ENV=pr PR_NUMBER=423] -t *** -m
It should be:
/usr/local/bin/npx vercel --build-env NODE_ENV=pr --build-env PR_NUMBER=423 -b KEY=value

az webapp deployment source config choose solution file

I am trying to deploy an app using the following:
az webapp deployment source config --branch master --manual-integration --name myapp --repo-url https://$GITUSERNAME:$GITUSERPASSWORD#dev.azure.com/<Company>/Project/_git/<repo> --resource-group my-windows-resources --repository-type git
The git repo contains 2 .sln solution files and this causes an error when attempting to deploy. Is there any way I can specify which solution file to use? I can seem to find a way in the docs but wondered if there might be a workaround.
I found a solution where you create a .deployment file in the root of the solution with these contents
[config]
project = <PATHTOPROJECT>
command = deploy.cmd
Then a deploy.cmd
nuget.exe restore "<PATHTOSOLUTION>" -MSBuildPath "%MSBUILD_15_DIR%"
The -MSBuildPath may be optional for you

How to setup multiple environments (dev\stage\production) with elastic beanstalk?

I need to do the following
Change environment variables according to the published env. Set Set up cron jobs according to the dev. I I would like to run just 1 command line "eb deploy dev" or something similar.
Use setenv
You can set environment variables with setenv. These will then be remembered for that environment.
More details: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-setenv.html
Example
For example, suppose you have created an EB environment called 'staging' and you want to set the variable DB to 'localhost', you can use:
eb setenv DB=localhost -e staging
Crons
Now that you have a different environment variables, you can check them in a script etc. to decide if the cron should be set up.
Note that the crons may not actually have access to your environment variables so you need to set those again for the cron while setting up the cron.
This is my solution to the problem, it took some time to setup but now i can do all the changes with 1 command line.
Make your own folder with all the files for all the environments.
In .ebextensions folder setup empty config files for eb.
npm runs a script named "deploy.js" together with the flag of the specific env.
The script will do the following
copy the requested env data to the empty files according to the env
git stash the changes of .ebextensions folder (eb deploys using git)
eb use env
eb deploy
So now i can tun npm run deploy:dev and everything runs

Using mysql from Perl in an Azure web app

I am using Azure to host a site which uses Perl and MySql. I have placed all my Strawberry perl files in the bin folder. I connect to Perl by adding a handler to the Perl executable which is located on my web app in d:\home\site\wwwroot\bin\perl\bin\perl.exe.
I can run simple Perl programs ok. However when I try to run a Perl script which connects to a MySql database I get the following error:
install_driver(mysql) failed: Can't load 'D:/home/site/wwwroot/bin/perl/vendor/lib/auto/DBD/mysql/mysql.xs.dll' for module DBD::mysql: load_file:The specified module could not be found at D:/home/site/wwwroot/bin/perl/lib/DynaLoader.pm line 193.
However mysql.xs.dll exists in that location. I have also copied into the same folder as mysql.xs.dll the file libmysql_.dll which I read somewhere was a dependency of mysql.xs.dll.
The datasource I am trying to get to looks like this:
my $data_source = "DBI:mysql:$database:$hostname";
I am using the same code and binary files as handlers for Perl in my local IIS so I think all the files needed are there in my bin folder.
What else can I try?