2

I am not able to locate the path to my repo (that is cloned) in travis. When I perform ls, there is no output. I have tried ls ~/username/repo and ls ~/repo but get no such file or directory

Some background: I am integrating my android app with travis-ci. I want to create a new .java file, before build in travis. Since this file is private and added to .gitignore and is on build machines only. I intend to add content to this file by using encrypted environment variable feature.

Any custom command doesn't show the output. Not even echo. There is an environment variable $TRAVIS_BUILD_DIR but not sure how to use it

thegreyd
  • 66
  • 5
  • `~/username` doesn't make sense... Try using `find / -name repo` – OneCricketeer Mar 05 '17 at 18:27
  • Possible duplicate of [How can I find a file/directory that could be anywhere on linux command line?](http://stackoverflow.com/questions/24655436/how-can-i-find-a-file-directory-that-could-be-anywhere-on-linux-command-line) – OneCricketeer Mar 05 '17 at 18:29
  • Whenever i execute a custom command i do not see its output. not even `echo`. So this wouldn't work. I've tried looking [here](https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings) with the variable $TRAVIS_BUILD_DIR , but still failing. – thegreyd Mar 05 '17 at 19:07
  • Sounds like a Linux issue, not a Travis issue – OneCricketeer Mar 05 '17 at 19:08
  • He is trying to execute a bash command from a yaml file and asking for a specific path for a specific vendor, it's not a duplicated in my opinion. – albodelu Mar 11 '17 at 13:02

1 Answers1

4

I guess it's a syntax issue, be sure you use it like here, it normally works:

TRAVIS_BUILD_DIR: The absolute path to the directory where the repository being built has been copied on the worker.

- ${TRAVIS_BUILD_DIR}/gradle/caches/

- ls ${TRAVIS_BUILD_DIR}/gradle/caches/

Also check the lines below from here that links to this build and travis.yml (it works as shown here):

env:
  global:
    - ANDROID_HOME=${TRAVIS_BUILD_DIR}/android-sdk
    - PATH=${ANDROID_HOME}/:${ANDROID_HOME}/tools/:${ANDROID_HOME}/platform-tools/:${PATH}

before_install:
  - cp -R /usr/local/android-sdk-23.0.2 ./android-sdk

... You could create a ${TRAVIS_BUILD_DIR}/.travis-ci folder and save there all the stuff so we can custom it.

  # Comment out the lines below to show system image properties
  - 'echo ${ANDROID_HOME}/system-images/${AVD_TARGET_DIR}/${AVD_TAG}/${AVD_ABI}'
  - 'ls ${ANDROID_HOME}/system-images/${AVD_TARGET_DIR}/${AVD_TAG}/${AVD_ABI} -al || true'
  - 'cat ${ANDROID_HOME}/system-images/${AVD_TARGET_DIR}/${AVD_TAG}/${AVD_ABI}/build.prop || true'

  - echo 'DEFAULT SCRIPTS'
  # Comment out the lines below to check default android scripts and PATH
  - echo "$PATH"
  - ls /usr/local/bin -Al
  - cat /usr/local/bin/android-accept-licenses
  - cat /usr/local/bin/android-update-sdk
  - cat /usr/local/bin/android-wait-for-emulator
albodelu
  • 7,931
  • 7
  • 41
  • 84