Skipping a deployment with the script provider because this branch is not permitted: develop


#1
language: android
jdk: oraclejdk8
sudo: false

before_cache:
- rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
  directories:
  - $HOME/.gradle/caches/
  - $HOME/.gradle/wrapper/
  - $HOME/.android/build-cache

android:
  components:
    # Latest Tools
    - tools
    - platform-tools
    - tools

    # Gradle Tools
    - android-28
    - build-tools-28.0.3

    # Other Dependencies
    - extra-google-m2repository
    - extra-android-m2repository
    - extra-google-android-support
    - extra-google-google_play_services
    - addon-google_apis-google-28

    # Simulator Image
    # - sys-img-${ANDROID_ABI}-${ANDROID_TARGET}

  licenses:
     - 'android-sdk-preview-license-52d11cd2'
     - 'android-sdk-license-.+'
     - 'google-gdk-license-.+'

before_install:
  - yes | sdkmanager "platforms;android-28"
  - mkdir -p "$ANDROID_HOME/licenses"
  - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
  - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
  - chmod +x gradlew
  - ./gradlew dependencies || true
  - gem update --system
  - gem install fastlane --no-document --quiet
  - touch local.properties

script:
  - android list targets
  - ./gradlew --stacktrace jacocoTestCiUnitTestReport

after_success:
  - bash <(curl -s https://codecov.io/bash) -t afaad3fa-936a-4c8e-836e-850c52e3388d

deploy:
  - provider: script
    script: touch local.properties
            ./gradlew fastlaneDeployAlpha
    on:
      branches:
        only:
        - develop
  - provider: script
    script: touch local.properties
            ./gradlew fastlaneDeployRelease
    on:
      branches:
        only:
        - master

This my .travis.yml, My builds are succeeding but not deploying.
In the logs i am getting this warning twice in a row.

Skipping a deployment with the script provider because this branch is not permitted: develop

Thanks in advance for your help


#2

Your configuration defines 2 deployments—one for develop and one for master. There will be a deployment and a warning message if the build runs on either of these branches. All other branches will have 2 warning messages about skipping.

If you believe this is not the case, please point to a build log URL to show it.


#3

So my problem is that on develop and master, i receive those warnings and my deployment does not happen.
The repo i am working on is private.
https://travis-ci.com/Glovo/glovo-courier-android/builds/99616978


#4

In your configuration, you have a superfluous only key, which invalidates the condition (so the default rule "only on the master" applies).

It should look like:

deploy:
  - provider: script
    script: touch local.properties
            ./gradlew fastlaneDeployAlpha
    on:
      branches: develop

Please review https://docs.travis-ci.com/user/deployment/#conditional-releases-with-on.

Thanks.


#5
deploy:
  - provider: script
    script: touch local.properties
            ./gradlew fastlaneDeployAlpha
    on:
      branches: develop
  - provider: script
    script: touch local.properties
            ./gradlew fastlaneDeployRelease
    on:
      branches: master

So this is my updated travis file and i am still facing the exact same problem. Successful builds without deployments. Thanks in advance


#6

Ooops. It is branch:, not branches: to add the condition.

on:
  branch: develop

#7

I applied your fix, but still the same result. This time just a single warning not 2.


#8

In build #1324, you should see the deployment for the deploy one:

⋮
Installing deploy dependencies
Successfully installed dpl-script-1.10.6
Parsing documentation for dpl-script-1.10.6
Installing ri documentation for dpl-script-1.10.6
Done installing documentation for dpl-script after 0 seconds
1 gem installed

Preparing deploy
Cleaning up git repository with `git stash --all`. If you need build artifacts for deployment, set `deploy.skip_cleanup: true`. See https://docs.travis-ci.com/user/deployment#Uploading-Files-and-skip_cleanup.
Saved working directory and index state WIP on (no branch): cc2ff02 one more trial to fix the deployment step

Deploying application
⋮

as well as the skip message for the master one:

Skipping a deployment with the script provider because this branch is not permitted: develop

Done. Your build exited with 0.

#9

Thats correct, but the problem is that i didnt find the artefact deployed. That script was working fine when it was just one deployment on develop, once i added the master its not working anymore


#10

Do note that your script value is defined with:

script: touch local.properties
        ./gradlew fastlaneDeployAlpha

which is equivalent to

script: touch local.properties ./gradlew fastlaneDeployAlpha

I don’t think this is what you want.


#11

i want to create a file named “local.properties” before the deploy happens, because without creating it the build fails. So how can i have both commands to run sequentially ? Thanks


#12

i fixed it

deploy:
  - provider: script
    script: ./gradlew fastlaneDeployAlpha
    skip_cleanup: true
    on:
      branch: develop
  - provider: script
    script: ./gradlew fastlaneDeployRelease
    skip_cleanup: true
    on:
      branch: master