How to change the default setting '-DskipTests=true' during Heroku deployment? - testing

I am trying to deploy a Java project from Beanstalk using Heroku. But during the deployment process, the tests are skipped by default. I am aware that the default settings for Dskiptests is true. Is it possible to run tests using Heroku? Where do I change the settings to overwrite the default settings.
Here is how the build is started by default:
output -----> Java app detected
output -----> Installing OpenJDK 1.8... done
output -----> Executing: mvn -B -DskipTests=true clean install

Run this command:
$ heroku config:set MAVEN_CUSTOM_OPTS=""
For more information see:
https://github.com/heroku/heroku-buildpack-java#customize-maven

Mine was working perfectly with out any change, suddenly stopped. Tried bellow and worked
heroku config:set MAVEN_CUSTOM_OPTS="-DskipTests=false"
btw I tried to set empty string as the value of MAVEN_CUSTOM_OPTS did not worked.
In case you want to know current value of all variable try:
heroku run printenv

You can also configure MAVEN_CUSTOM_OPTS in the Heroku Dashboard.

Related

AppCenter Yarn 1.19 error Incorrect integrity when fetching from the cache

I have a React Native app hosted on Microsoft App center. The builds (both iOS and android) are failing because of yarn 1.19 (error Incorrect integrity when fetching from the cache)
I tried to remove the package-lock.json but it didn't help.
I would like to downgrade yarn or execute the cache clean command but don't know where to execute it.
I have installed the appcenter cli version 2.2.1 and successfully connected to it.
Where could I execute yarn cache clean for example?
I've read I could also create a script but I have no idea where to place it and how it should look like. Should it be both in the ios and android directory? Or in the root? Thank you
I actually noticed that I had a yarn.lock back from the initial commit, even though we are using npm in the team.
In the build logs, there is this line:
/bin/sh -c if [ -f yarn.lock ]; then { yarn install && yarn list --depth=0; } else npm install; fi
So I deleted the yarn.lock file and now it builds successfully using npm!
Not sure whether you build your React app with Azure Devops pipeline. If yes, you can use Command line task to achieve the things you want to do.
If the agent you used is hosted agent during the build, since each build will use a completely new VM, you need to install the AppCenter cli once per build.
Use follow command to install the AppCenter cli:
sudo npm install -g appcenter-cli
Then logging in it:
appcenter login --token {Token}
Here, you need first generate the token with this doc described: Go and login to https://appcenter.ms/ -> Click Self Avatar -> Choose Account Settings -> Click on API Tokens -> Click New API token then select the corresponding the scope for this token.
Copy and use it in this pipeline task. Note: Recommend you store
this token with secret variable for security.
Now, you can execute the clean command: yarn cache clean.
Where to place it and how it should look like?
According to your description, you need place this command line task into the first step, then it could clean the Yarn cache firstly.
Also, because of the image configuration that the hosted agent is using, its installed node.js version is 6.7.0, this does not match the runtime environment for AppCenter cli. You need also run Node.js tool installer task to install node.js v10.0.0.
All of them should look like this:
Should it be both in the ios and android directory?
As I mentioned previously, for Hosted agent, each build will use a completely new VM. So yes, you must execute these two steps firstly in every build.
If what you used is your private agent, since you have installed the AppCenter cli locally, the agent will automatically call the local configuration when running the command line task. At this time, you just need to skip the install command in the command task:
We fixed it by adding a "yarn cache clean" in appcenter-post-clone.sh, you can add this shell script in root of project.
See this docs for details.

NPM not available when running installation script

I have an interesting issue, I have a setup or rails project and the deployment/upgrades works absolutely fine when running as a dedicated user (deploy) who is used to setup everything.
I am using codeDeploy to manage the deployments and it uses root user to do the deployment on AWS, but during the deployment it fails on running the same script because it's not able to find npm command
cd client && npm run build:client
sh: 1: npm: not found
rake aborted!
Command failed with status (127): [cd client && npm run build:client...]
If i run it manually to check that i also get nothing
root#ip-172-31-4-141:/home/ubuntu# su deploy -c "which npm"
root#ip-172-31-4-141:/home/ubuntu#
NPM is available via the deploy user but I am struggling to understand why it's not available via the root user
deploy#ip-172-31-4-141:/home/ubuntu$ which npm
/home/deploy/.nvm/versions/node/v7.8.0/bin/npm
Any help to get this resolved would be great.
Thanks,
The issue here was that AWS CodeDeploy when starts deployment loads only a minimum env; to load all the env variables I have exported the env and then in the deploy phase source that file, which resolves my issue

How to run build in local machine with drone.io

Does the build have to run on the drone.io server? Can I run the build locally? Since developers need to pass the build first before pushing code to github, I am looking for a way to run the build on developer local machine. Below is my .drone.yml file:
pipeline:
build:
image: node:latest
commands:
- npm install
- npm test
- npm run eslint
integration:
image: mongo-test
commands:
- mvn test
It includes two docker containers. How to run the build against this file in drone? I looked at the drone cli but it doesn't work in my expected way.
#BradRydzewski comment is the right answer.
To run builds locally you use drone exec. You can check the docs.
Extending on his answer, you must execute the command in the root of your local repo, exactly where your .drone.yml file is. If your build relies on secrets, you need to feed these secrets through the command line using the --secret or --secrets-file option.
When running a local build, there is no cloning step. Drone will use your local git workspace and mount it in the step containers. So, if you checkout some other commit/branch/whatever during the execution of the local build, you will mess things up because Drone will see those changes. So don't update you local repo while the build is running.

Installing CloudBees SDK and running bees command first time - errors downloading plugins

I have installed the cloudbees SDK and am now running the bees command the first time..
I see this:
Installing plugin: org.cloudbees.sdk.plugins:ant-plugin:LATEST
You have not created a CloudBees configuration profile, let's create one now...
Enter your CloudBees account email address: XXX
Enter your CloudBees account password:
ERROR: Failed to install org.cloudbees.sdk.plugins:ant-plugin:LATEST
And thus, an unable to use it
In most cases if you just run the bees command again, it will download the plugins again (plugins are only fetched the first time they are needed). If you are on a VPN this can cause some temporary issues as well.
You can also add the -v flag to get more verbose messages from the command line.

getting started (not) with Heroku: App not found

This should be simple, and I swear it was working an hour ago. I can log in to Heroku, but can't run any useful commands:
$ heroku login
Enter your Heroku credentials.
Email: xxx#whatever.com
Password:
$ heroku stack
App not found
$ heroku config
App not found
Perhaps this is the source of the problem?
$ git remote show heroku
! No such app as empty-samurai-345
fatal: The remote end hung up unexpectedly
empty-samuri-345 was an app I deleted earlier. All I really want to do is upload a new app using the bamboo-mri-1.9.2 stack.
Thanks in advance for suggestions...
You need to remove the heroku remote in git using this command:
git remote rm heroku
Then you can add a new remote using this one:
git remote add heroku git#heroku.com:your-app.git
Then try running your heroku commands.
Run the following
git config -l
The config key is easy to spot, remote.heroku.url.
Now if your comfortable editing the config directly, just:
git config -e
If not:
# Confirm you've got the right key
git config remote.heroku.url
# Substitute your_app_name appropriately
git config remote.heroku.url git#heroku.com:your_app_name.git
My answer is based off fearless_fool's comment, which lacks much detail.
FYI: The config file is located in /your_git_repo/.git/config
I just ran into this same problem by renaming my app from heroku online dashboard.
Then I tried running some command in cli from my local machine and it gave 'App not found'. I guess Cli doesn't know the change that I renamed my app.
So I again logged into heroku website and renamed the app with old name.
Then All commands worked from cli.
So Don't use online dashboard to rename your app, use CLI.
I hope it helps someone..!!