Azure DevOps: 'Replace Tokens task' having problem setting variable files from JSON - azure-devops

I'm trying to setup a 'Replace Tokens Task' for my build pipeline from a JSON file that will hold environmental variables as follow:
And then my JSON environment file:
The JavaScript target file to replace the tokens in:
Unfortunately, I'm getting the following error:
What am I missing here?

What am I missing here?
I can reproduce same issue on my side, and I think it only indicates there's something wrong with your Variable files(JSON) input:
Please make sure the variables are successfully loaded from the variable json file.
1.Make sure your env-config.json file has content below:
{
"alambda.endpoint":"ForTest"
}
2.Check carefully about the path of your env-config.json file! (In my opinion, your issue is more like a path issue~) If the task can't find and load the file, it also throws variable not found. For this:
Make sure the relative path is correct.
Try cut the long path, I'm not sure if the issue results from the too long path. Try using **/env-config.json instead of the very long path.
If above tips can't work, I suggest you can move the env-config.json file to root folder $(System.DefaultWorkingDirectory) with Copy Task or what. (About System.DefaultWorkingDirectory see here). Then try it again with **/env-config.json.

Related

Azure Data Factory SFTP Source Please check if the path exists. If the path you configured does not start

Hi I'm getting the following error....
GET METADATA works fine if I do WildCard like ASN to find list of files when I do for loop and pass each file name in the COPY Activity (Source)
ErrorCode=SftpPathNotFound,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Can't find SFTP path '/Receive/INX_XXXXXXXX_ASN_20210728012200817116546932367669276.xml'. Please check if the path exists. If the path you configured does not start with '/', note it is a relative path under the given user's default folder ''.,Source=Microsoft.DataTransfer.ClientLibrary.SftpConnector,''Type=Renci.SshNet.Common.SftpPathNotFoundException,Message=/opt/apps/uprd1bpn1/bpfs2/2021/July/0209/04/22/25565817aec33de9cnode2_WF128489406.dat (No such file or directory),Source=Renci.SshNet,'
Any ideas?
I was facing the same issue described above, the only difference was the type of my source file, .txt.
In my case the error message was misleading, the actual error message was getting hidden by the 'chunking' option. If you pay attention to the source tab of the copy activity, by default it is set to use 'chunking', which transfers your data at an increased speed.
By disabling chunking, I could notice the error was actually in a particular line of the file, then fixing the file, fixed the problem.
1. Check if "Copy behavior" on the sink side is marked as "None".
2. Check if you have permissions for uploading the files.
3. For wildcardFileName Dynamic content of fileName should be replaced with asterisk (*).
E.g. If 20210728012200817116546932367669276 is dynamic content in your filename
then wildcardFileName for INX_XXXXXXXX_ASN_20210728012200817116546932367669276.xml should be INX_XXXXXXXX_ASN_*.xml
Refer - SFTP as sink - getting can't find SFTP path error

AzCopy ignore if source file is older

Is there an option to handle the next situation:
I have a pipeline and Copy Files task implemented in it, it is used to upload some static html file from git to blob. Everything works perfect. But sometimes I need this file to be changed in the blob storage (using hosted application tools). So, the question is: can I "detect" if my git file is older than target blob file and ignore this file for the copy task to leave it untouched. My initial idea was to use Azure file copy and use an "Optional Arguments" textbox. However, I couldn't find required option in the documentation. Does it allow such things? Or should this case be handled some other way?
I think you're looking for the isSourceNewer value for the --overwrite option.
--overwrite string Overwrite the conflicting files and blobs at the destination if this flag is set to true. (default true) Possible values include true, false, prompt, and ifSourceNewer.
More info: azcopy copy - Options
Agree with ickvdbosch. The isSourceNewer value for the --overwrite option could meet your requirements.
error: couldn't parse "ifSourceNewer" into a "OverwriteOption"
Based on my test, I could reproduce this issue in Azure file copy task.
It seems that the isSourceNewer value couldn't be set to Overwrite option in Azure File copy task.
Workaround: you could use PowerShell task to run the azcopy script to upload the files with --overwrite=ifSourceNewer
For example:
azcopy copy "filepath" "BlobURLwithSASToken" --overwrite=ifSourceNewer --recursive
For more detailed info, you could refer to this doc.
For the issue about the Azure File copy task, I suggest that you could submit a feedback ticket in the following link: Report task issues.

accessing variables exported in a shell in the recepe file

I have a yocto recipe file.
However I want to set a value to the variable, by exporting a variable.
For example
I modified I added a variable in oe-init-build-env, (which calls 'svn_util')
export REPO_BRANCH_ROOT=${REPO_BRANCH_ROOT}
The REPO_BRANCH_ROOT variable is set by running a utility 'svn_util', by looking at by current branch.
Now in my recepie.bb file
SRC_URI = "\
svn://${REPO_ROOT_NO_URI}/${REPO_BRANCH_ROOT}/sample module=mymodule;protocol=protocol=http;rev=HEAD \
"
However do_fetch: fails as follows.
Fetcher failure for URL: 'svn://${REPO_ROOT_NO_URI}/${REPO_BRANCH_ROOT}/sample;module=mymodule;protocol=http;rev=HEAD'. Unable to fetch URL from any source.
How do I make .bb file to be aware of my current branch and repository uri? I do not want to hard code it in the .bb file, or local.conf file Because if the .bb file is checked in to a different branch it should work correctly across all branch.
Or to rephrase the question, How a shell exported variable be accessed in the recipe file?
Got my answer, from another post.
https://www.yoctoproject.org/docs/3.1/bitbake-user-manual/bitbake-user-manual.html#var-bb-BB_ENV_EXTRAWHITE
In this case i have to add
export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE REPO_SVNREV REPO_ROOT_NO_URI REPO_BRANCH_ROOT"
In the oe-init-build-env

Is there a way to specify the output path of .coverage?

I'm looking for a way to specify the output path of the generated .coverage file. I've checked coverage help and did some research but still no luck so far. The reason is that I would like it to be specified into our tmp directory.
You can create a .coveragerc and specify the path for .coverage using the data_file attribute under the [run] section.
This is the link to the current documentation.
You can use the [run] data_file setting (https://coverage.readthedocs.io/en/latest/config.html#run), or the COVERAGE_FILE environment variable (https://coverage.readthedocs.io/en/latest/cmd.html#data-file).

'findstr' is not recognized as an internal or external command,

I got the following error while starting JBoss from a command line prompt today:
'findstr' is not recognized as an internal or external command
Please google it, you can find a lot of answers. But do as below to fix it. Add the following value to Right Click My Compuer -> Advanced -> Environment Variables -> System Variables -> Select Path variable -> append the below value.
C:\WINDOWS\system32
It should work with that change.
As others pointed, issue is in wrong settings of PATH variable in Windows.
According to article this is most probably because some stupid installer wrongly modified PATH variable in Windows registry. Registry has 2 different string value types - REG_SZ and REG_EXPAND_SZ. Only the second one allows for expansion of %SystemRoot%.
So check your path by typing set path in command prompt. If you see unexpanded %SystemRoot% and other variables in Path, you are affected (PATH should show only plain directory names, not variables).
You need to edit Path variable in registry: HKEY_CURRENT_USER\Environment and HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment. As it is not possible to change the type of key, save the path value somewhere, delete the key and re-create it with type REG_EXPAND_SZ. You need to logout for changes to take effect.
for me it works when I've coped findstr(from windows/system32) to wildfly/bin
Please go throught the simplest steps:-
go to C:\Windows\system32\ and copy findstr.exe file.
paste this file into the location C:\Program Files\Java\jdk1.6.0_24\bin
Run your jboss again you will get out of this.....
Check to see if you %SystemRoot% is evaluating (type set path into a command prompt, you should not see %SystemRoot%, but instead that actual path). If your path variable's (user, or systems) first entry begins with an %(an environment variable) this can cause an issue.
To resolve this, simply swap this first entry with anything else in your path that does not lead with an environment variable.
You can also hard code the directory by replacing 'findstr' with 'C:\Windows\system32\findstr'. This is useful when using systems with restricted user permissions.
I have try to work with play framework but stuck with to run activator.bat file but solution is the same just copy file from windows/system32/findsr and past it to under stuck folder then run the respective file again.
thanks to andrewsiand Suryaprakash
Please beware that current Windows systems use a Capital "S" for the System directory, so:
C:\WINDOWS\System32
%SystemRoot%\System32
Omitting the capital S will result in a neglect of the line in the %PATH%
In my case (not JBoss related) the following helped to fixed this error.
Instead of:
SET path="%path%;C:\some\additional\path"
I used:
SET "path=%path%;C:\some\additional\path"
For IBM ACE solution for
'findstr' is not recognized as an internal or external command,
Go to the path C:\Windows\System32
Find the findstr.exe, copy it and then find the path where you bin file of your application is found. eg C:\Program Files\IBM\ACE\11.0.0.12\server\bin then past it inside the bin file
cancel the console of ace and re-open it.
Then run ACE toolkit command on ace console.
Then press enter, now it can open.