Travis-CI allow_failures when multiple environment variables are set - travis-ci

I'm trying to set allow_failures for a complex build process, but unfortunately it isn't working.
The problem is that in my env I am setting multiple environment variables, and cannot get Travis to recognise that I want on of these rows to be allowed to fail.
The documentation on allow_failures shows how to allow a single env to fail, along with another configuration option, but doesn't cover how to allow a multiple enviroment variable setup to fail.
The troublesome sections of the .travis.yml file are below:
env:
- DJANGO_VERSION='1.8,<1.9' DB=sqlitefile SEARCH=whoosh
- DJANGO_VERSION='1.8,<1.9' DB=postgres SEARCH=whoosh
- DJANGO_VERSION='1.8,<1.9' DB=mysql SEARCH=whoosh
- DJANGO_VERSION='1.8,<1.9' DB=sqlitefile SEARCH=elasticsearch
- DJANGO_VERSION='1.8,<1.9' DB=postgres SEARCH=elasticsearch
- DJANGO_VERSION='1.8,<1.9' DB=mysql SEARCH=elasticsearch
matrix:
allow_failures:
- env: DJANGO_VERSION='1.8,<1.9' DB=mysql SEARCH=elasticsearch
- env: DJANGO_VERSION='1.8,<1.9' DB=mysql SEARCH=whoosh
How can I do this?

Fixed!
Travis allow_failure options must be identical down to the whitespace!
So this won't work:
env:
- FOO='one' BAR='two'
- FOO='three' BAR='four'
matrix:
allow_failures:
- env: FOO='one' BAR='two'
But this will:
env:
- FOO='one' BAR='two'
- FOO='three' BAR='four'
matrix:
allow_failures:
- env: FOO='one' BAR='two'

Related

How to use a circleci orb

I am new to circleci so not sure how to use an orb. Couldn't find a good example documetation. The orb in question is this https://circleci.com/developer/orbs/orb/ganezasan/auto-cancel-workflow
The idea is that circleci should be able to cancel other josb whose tests are failed. Instead of re-inventing the wheel, i found this orb but couldn't find a sample config.yml file.
How can i use this orb in my existing config.yml file?
The orb page you linked provides a usage example:
jobs:
failed-job:
docker:
- image: 'cimg/base:stable'
steps:
- run: sleep 30 && exit 1
success-job-1:
docker:
- image: 'cimg/base:stable'
steps:
- run: sleep 60
success-job-2:
docker:
- image: 'cimg/base:stable'
steps:
- run: sleep 60
orbs:
auto-cancel: ganezasan/auto-cancel-workflow#0.0.7
version: 2.1
workflows:
cancel-workflow:
jobs:
- success-job-1
- success-job-2
- failed-job
- auto-cancel/auto-cancel:
api_token: CIRCLE_TOKEN
interval_seconds: 10
But basically. You need to add the orb to your config.yml using this code block
orbs:
auto-cancel: ganezasan/auto-cancel-workflow#0.0.7
and then you need to add this job to your workflow
- auto-cancel/auto-cancel:
api_token: CIRCLE_TOKEN
interval_seconds: 10
and then you need to make sure you have an environment variable added to your project called CIRCLE_TOKEN with the value set to a CircleCI API token that you can generate under User Settings > Personal API Tokens.
But rather than using this orb you may want to look at running your jobs in series using requires. In the workflow below if test1 fails both test2 and deploy will be skipped. If test 1 is successful, test2 will run. If test2 fails then deploy will be skipped.
workflows:
version: 2
build-test-and-deploy:
jobs:
- build
- test1:
requires:
- build
- test2:
requires:
- test1
- deploy:
requires:
- test2

Getting an error when creating virtual env

Solving environment: failed
ResolvePackageNotFound:
- sphinxcontrib==1.0=py35_0
- requests==2.14.2=py35_0
- rope==0.9.4=py35_1
- pytorch==0.1.12=py35_0.1.12cu80
- pylint==1.7.2=py35_0
- nbconvert==5.2.1=py35_0
- vc==14=0
- libpng==1.6.30=vc14_1
- numpy==1.13.1=py35_0
- jsonschema==2.6.0=py35_0
- alabaster==0.7.10=py35_0
- simplegeneric==0.8.1=py35_1
- entrypoints==0.2.3=py35_0
- isort==4.2.15=py35_0
- qt==5.6.2=vc14_6
- setuptools==36.4.0=py35_1
- mkl==2017.0.3=0
- path.py==10.3.1=py35_0
- babel==2.5.0=py35_0
- icu==57.1=vc14_0
- vs2015_runtime==14.0.25420=0
- jedi==0.10.2=py35_2
- jpeg==9b=vc14_0
its actually an error you can fix it by: conda update --all then conda env export --no-builds > env.yml and then with regular installation via: conda env create -f env.yml
after this fix works you might also encounter an error with output: 'CondaValueError: prefix already exists: /home/user/anaconda3'
for this error you just need to open your .yml file and make sure the environment name is not 'base' or any other existing env name. THAT'S IT! I hope this works !

Travis allow_failures AND condition

I have a travis build file that looks like as described below (retracted). With allow_failures I would like to select rows from build matrix to meet condition
go=tip AND JOB=check
However travis evaluates it as
go=tip OR JOB=check
Is there a way to achieve the AND condition for my specific case?
go:
- 1.8
- 1.9
- tip
env:
global:
- GOARCH=amd64
matrix:
- JOB=docker
- JOB=deb
- JOB=rpm
- JOB=check
matrix:
allow_failures:
- go: tip
- env: JOB=check
Solution received here
matrix:
allow_failures:
- go: tip
env: JOB=check
https://github.com/travis-ci/travis-ci/issues/10114

Can't run UI test for iOS on Bitrise

I'm following this tutorial using their own sample repository that I forked from GitHub: https://discuss.bitrise.io/t/how-to-do-calabash-uitesting-on-bitrise/361 I'm not doing anything special or anything different than the tutorial.
I managed to get the APK and Android UI test working using calabash. But for some reason the APP for iOS is not in the artifacts despite it says it built it and the UI tests (also with calabash) are failing.
Cucumber Features
1 scenario (1 failed)
4 steps (4 skipped)
Finished in 6m22.928s seconds
Expand All
Collapse All
Feature: Sample Feature
features/sample.feature:3
Scenario: Sample Scenario
Could not connect to the DeviceAgent service.
device: #<Simulator: iPhone 6 (11.4) FDAAB45E-52F1-4133-A02D-632AA6A9A369 x86_64>
url: http://127.0.0.1:27753/
To diagnose the problem tail the launcher log file:
$ tail -1000 -F /Users/vagrant/.calabash/iOSDeviceManager/logs/current.log
./features/support/01_launch.rb:27:in `Before'
25 }
26
27 launcher.relaunch(options)
28end
29
30# gem install syntax to get syntax highlighting
Given the app has launched
features/steps/sample_steps.rb:1
And I have done a specific thing
features/steps/sample_steps.rb:7
When I do something
features/steps/sample_steps.rb:32
Then something should happen
features/steps/sample_steps.rb:41
Here is the bitrise.yml:
---
format_version: '5'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: xamarin
trigger_map:
- push_branch: "*"
workflow: primary
- pull_request_source_branch: "*"
workflow: primary
workflows:
primary:
steps:
- activate-ssh-key#3.1.1:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone#4.0.11: {}
- script#1.1.5:
title: Do anything with Script step
- certificate-and-profile-installer#1.9.3: {}
- nuget-restore#1.0.7: {}
- xamarin-archive#1.5.0:
inputs:
- xamarin_solution: "$BITRISE_PROJECT_PATH"
- xamarin_configuration: "$BITRISE_XAMARIN_CONFIGURATION"
- xamarin_platform: "$BITRISE_XAMARIN_PLATFORM"
- calabash-ios-uitest#1.3.1:
inputs:
- work_dir: "./iOS"
- deploy-to-bitrise-io#1.3.12: {}
- create-android-emulator#1.1.5:
inputs:
- name: FOO
- start-android-emulator#1.3.2: {}
- calabash-android-uitest#1.2.1:
inputs:
- work_dir: "./Droid"
app:
envs:
- opts:
is_expand: false
BITRISE_PROJECT_PATH: Multiplatform.sln
- opts:
is_expand: false
BITRISE_XAMARIN_CONFIGURATION: calabash
- opts:
is_expand: false
BITRISE_XAMARIN_PLATFORM: Any CPU
I asked the people from Bitrise and apparently calabsh-ios support Xcode 6 and 7 which are old and Bitrise doesn't provide a stack for that version.
https://github.com/calabash/calabash-ios

How to properly define multiple env variables for all jobs on .travis.yml

The documentation says:
When you define multiple variables per line in the env array (matrix variables), one build is triggered per item.
rvm:
- 1.9.3
- rbx
env:
- FOO=foo BAR=bar
- FOO=bar BAR=foo
But what if I define only 1 per line? I'm doing the following:
env:
- FOO=1
- BAR=2
- BAZ=3
But it's triggering 3 builds? I expected it to trigger 1 build, with those 3 env variables. Do I have to defined them like this?
env:
- FOO=1 BAR=2 BAZ=3 QUX=4 ........ =10
Or am I missing something here?
You need to define them as global variables:
env:
global:
- FOO=1
- BAR=2
- BAZ=3
See Global variables documentation for more info.

Resources