I am using travis-ci to test my project Smoke (https://github.com/phmLabs/Smoke). When the test ran I want to report the result to a different system via webhook. The problem is that the webhook url contains a secret key I don't want to put inside my travis.yml file. So I tried using an environment var:
notifications:
webhooks: http://monitor.koalamon.com/webhook/travis/?api_key=$KOALAMON_API_KEY
unfortunateli the environment variable gets escaped and I can see
127.0.0.1 - - [26/May/2016:21:28:25 +0200] "POST /webhook/travis/?api_key=%24KOALAMON_API_KEY HTTP/1.1" 200 278 "-" "Faraday v0.9.2"
in my apache logs. Does anybody know how to solve this problem?
A workaround could be using a custom script in the after_script section. Those get executed in both fail and success cases of the script section. Ofc you'd need a way to re-discover the results of your test.
Environment variable is not supported in notifications. There is a bug in github:
https://github.com/travis-ci/travis-ci/issues/6387
Devs are saying that it is not in their roadmap.
Related
I'm using Next.js with Vercel. This is my .env.local file:
# Created by Vercel CLI
VERCEL="1"
VERCEL_ENV="development"
VERCEL_URL=""
VERCEL_GIT_PROVIDER=""
VERCEL_GIT_REPO_SLUG=""
VERCEL_GIT_REPO_OWNER=""
VERCEL_GIT_REPO_ID=""
VERCEL_GIT_COMMIT_REF=""
VERCEL_GIT_COMMIT_SHA=""
VERCEL_GIT_COMMIT_MESSAGE=""
VERCEL_GIT_COMMIT_AUTHOR_LOGIN=""
VERCEL_GIT_COMMIT_AUTHOR_NAME=""
I have a component that is trying to access: process.env.NEXT_PUBLIC_VERCEL_ENV to make sure it is on development environment.
This is what I'm getting when running npm run dev.
Logs from the server:
The logs above make perfect sense. Since it's running on the local server to render the pages.
But when my client code tries to do the same, I'm getting:
This is how I'm trying to acess it:
console.log(`process.env.NEXT_PUBLIC_VERCEL_ENV: ${JSON.stringify(process.env.NEXT_PUBLIC_VERCEL_ENV)}`);
console.log(`process.env.VERCEL_ENV: ${JSON.stringify(process.env.VERCEL_ENV)}`);
On client, the VERCEL_ENV should be undefined, but NEXT_PUBLIC_VERCEL_ENV should be development, right?
What could be happening?
UPDATE
I even tried to add NEXT_PUBLIC_VERCEL_ENV="development" to the .env.local file. But so far, the result is the same.
NEXT_PUBLIC_VERCEL_ENV="development"
You will have access to this everywhere (in the browser and Server).
VERCEL_ENV="development"
You only have access to this in the server, in the browser it will show undefined.
Please note after you add or make any changes in the .env.local file you have to restart your server otherwise it will show undefined if you console.log the variables.
Make sure Automatically expose System Environment Variables is checked in your Project Settings.
System Environment Variables
More info in docs
I want to fetch some data in Bazel over HTTP. There's a http_file method that looks like what I want. The remote server I'm fetching from uses authentication, so I've written it as
load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
http_file(
name = "data_file",
urls = ["https://example.com/data.0.1.2"],
sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
downloaded_file_path = "data_file",
)
When I try the build, I get
WARNING: Download from https://example.com/data.0.1.2 failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 401 Unauthorized
Followed by fatal errors because the file doesn't exist.
The error makes me think that I'm not authenticating correctly. I have a .netrc file and curl is able to use it to fetch the file.
Is there a way for me to debug? If it was curl, I would pass -v and see the auth header being sent with the request. I'm not sure if bazel is failing to send any authentication or if it's incorrect.
Running Bazel 3.2.0 on Mac OS (Darwin 19.6.0) and on Linux (Ubuntu 18.04).
HTTP 401 indeed sounds like incorrectly or not at all authenticated. .netrc should be supported and recognized. If not explicitly specified with netrc attribute, ${HOME}/.netrc would be tried if HOME is in the environment and bazel runs on non-Windows host (this has been the case since bazel 1.1; and shortly in 0.29) or %USERPROFILE%/.netrc if the variable is in the environment and running on Windows (this has been the case since 3.1). At the risk of stating the obvious, the .netrc should be owned by the same UID under which the process using it runs and its permbits should be 0600. If authentication methods other then http basic are needed, auth_patterns attribute needs to be used to configure that.
I am not aware of there being any ready made repository rule debugging facility such as CLI flag, but in this case it should be viable to copy the implementation of of the rule and functions it uses from tools/build_defs/repo, instrument it to get debugging info from it and use that for the purpose. For starters perhaps just print(auth) of what auth = _get_auth(ctx, all_urls) yielded to see if the that rule got the right idea about how to talk to host in question. It should be a dict with type, login, password information for each individual urls entries. The magic itself happens in use_netrc.
Can't figure out how to solve my issue with international (Russian, in this case) characters, returned from xUnit-tests project in my solution (ASP.NET Core 2, a test project in the solution).
Question is : How to make them readable?
I'm using build-machine based on Ubuntu 16.04, above you may see the result of Assert that fail. There are 2 strings that should be compared and I can't even understand what strings do i have there. So what I want is to see real text instead of these ��� .
I suppose that also it could be a reason of a test fail as locally, on my laptop everything is fine and I don't have the failed test. But there I can see that some additional character - what is that? Can't understand...
Here is a section that runs tests on Azure Pipeline (from azure-pipelines.yml)^
- task: DotNetCoreCLI#2
displayName: 'dotnet test $(buildConfiguration)'
name: testsRun
continueOnError: true
inputs:
command: test
projects: '*Test.*/*.csproj'
arguments: '--configuration $(buildConfiguration) --collect:"Code coverage" --no-build --no-restore'
testRunTitle: 'run all tests'
publishTestResults: true
Thanks in advance!
PS - It was a long time ago when I asked a question here last time :)
May i know following questions?
Which encoding of the *.cs file in test project did you use? You can use an editor tool to view the encoding format. It should be UTF-8. This topic may be helpful for you.
Character encoding errors with .NET Core on Linux
Is agent pool (Ubuntu 16.04) you run the pipeline a local ubuntu machine or vm, or the host is selected from the Agent Pool list in Azure DevOps? If it is local machine or VM, you need to check if the OS supports Russian laguage.
I can not reproduce this issue. The text displays as readable. The test project was created by VS 2017. And the agent pool is Hosted Ubuntu 1604 listed in DevOps.
Assert.Equal("здравствуй, мир!", "здравствуй, мир11!");
Please see the result.Azure PipeLine Test
Not sure how to ask this question but would like to put it here and want to hear some suggestions.
So far, I use "DB_LINK" variable that has mongo database url in my config.json file. My Node app uses this variable to connect to the Mongo. But this DB_LINK also gets checked into git, which we dont want this to happen because we dont want to check in the passwords into git.
in my local development, I use local.json file that has all these configs and not check that file into git (in .gitignore entry). So it is fine making it work in my local dev environment, but the challenge is when Jenkins try to push the code to TEST, it has to pass testcases (it has to run test cases, so that time the DB_LINK value is needed) before deployment happens. so this is when I need this DB_LINK variable be passed from Jenkins.
Here is what I did so far ..
in Jenkins configurations, at the 'predefined parameters' I added DB_LINK=myMongoLink to parameters list.
but this value is not being handed over to my node app. Any suggestions on how to achieve what I am trying to achieve?
Ok. I figured this out. before the change, I used to pass a command from Jenkins to run my test cases like this
npm run test
but now,
DBLink=myDB npm run test
so the DBLink variable from here being handed over to the node app and was able to run the test cases. Before this change,
I used to pass this DBLink=myDB from a config file
I am using ANT (build tool) to run jmeter functional scripts. I want to get the hostname or website name where all my jmeter scripts are running.
I have checked the jmeter.properties file to do some changes but no luck but no luck.
I fixed and I want to share solution.
I have uncommented the configuration in jmeter.properties.
jmeter.save.saveservice.hostname=true
so that the hostname will be written to the jtl file and from the jtl file, i got it by xpath as below,
/testResults/httpSample/#Host
Thats it, you can use this as xsl variable for reporting or for any purpose.
You can use below inbuilt functions in JMeter.
${__machineName} - to get the machine name
${__machineIP} - to get the IP address