"File exists @ dir_s_mkdir " ruby exception when the deploy branch doesn't exist

It seems like there are some wrong with dpl-pages instead of my config.

Job: https://travis-ci.org/joshuaavalon/cloudflare-ddns/jobs/461701889
Log:

/home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.6/lib/dpl/provider/pages.rb:141:in `mkdir': File exists @ dir_s_mkdir - /tmp/d20181130-3845-gyh65z/work (Errno::EEXIST)
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.6/lib/dpl/provider/pages.rb:141:in `github_pull_or_init'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.6/lib/dpl/provider/pages.rb:195:in `block in push_app'
	from /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/tmpdir.rb:89:in `mktmpdir'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.6/lib/dpl/provider/pages.rb:190:in `push_app'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.6/lib/dpl/provider.rb:199:in `block in deploy'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.6/lib/dpl/cli.rb:41:in `fold'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.6/lib/dpl/provider.rb:199:in `deploy'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.6/lib/dpl/cli.rb:32:in `run'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.6/lib/dpl/cli.rb:7:in `run'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.6/bin/dpl:5:in `<top (required)>'
	from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `load'
	from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `<main>'

config

dist: xenial
language: python
python: 3.7
stages:
  - test
  - build
jobs:
  include:
    - stage: test
      name: flake8
      install:
        - travis_retry pip install -r requirements.txt
        - travis_retry pip install -U flake8
      script:
        - flake8 --version
        - flake8 cloudflare_ddns
        - flake8 run.py
    - stage: test
      name: pylint
      before_install:
        - deactivate
        - /opt/python/3.7.1/bin/python -m venv ~/venv
        - source ~/venv/bin/activate
      install:
        - travis_retry pip install -r requirements.txt
        - travis_retry pip install -U pylint
      script:
        - pylint --version
        - pylint cloudflare_ddns
        - pylint run.py
    - stage: build
      name: mkdocs
      if: branch = master
      install:
        - travis_retry pip install -U mkdocs mkdocs-material
      script:
        - mkdocs build
      deploy:
        provider: pages
        skip-cleanup: true
        github-token: $GITHUB_TOKEN
        keep-history: true
        local-dir: site
        on:
          branch: master
1 Like

Apparently, it only fail in Xenial. Switch to Trusty on deploy fixes the issue.

I have exactly the same error with gh-pages deployment after switching from Trusty to Xenial.
The issue arises when github repo does not yet have a target branch (e.g. gh-pages).

1 Like

So is there a better fix than switching back to Trusty?

Hello, there. Does it still happen with dpl 1.10.10? If so, please provide a relevant URL. Thanks.

Not sure of which version of dpl is being used but here is the logs links:
https://travis-ci.org/AppImage/libappimage/jobs/541477197#L890

Please let me know if you need something else.

The error is here

I think there is a logical failure; when git clone fails, it usually fails with the destination directory created and half populated. This results in the exception.

hey!

so what with that issue? can we fix it on dist: xenial?

Installing deploy dependencies
Successfully installed multipart-post-2.1.1
Successfully installed faraday-0.15.4
Successfully installed public_suffix-3.0.3
Successfully installed addressable-2.6.0
Successfully installed sawyer-0.8.2
Successfully installed octokit-4.6.2
Successfully installed dpl-pages-1.10.11
7 gems installed
Logged in as @daggerok (Maksim Kostromin)

Preparing deploy

Deploying application
/home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.11/lib/dpl/provider/pages.rb:141:in `mkdir': File exists @ dir_s_mkdir - /tmp/d20190616-8171-g9thkk/work (Errno::EEXIST)
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.11/lib/dpl/provider/pages.rb:141:in `github_pull_or_init'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.11/lib/dpl/provider/pages.rb:195:in `block in push_app'
	from /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/tmpdir.rb:89:in `mktmpdir'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.11/lib/dpl/provider/pages.rb:190:in `push_app'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.11/lib/dpl/provider.rb:199:in `block in deploy'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.11/lib/dpl/cli.rb:41:in `fold'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.11/lib/dpl/provider.rb:199:in `deploy'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.11/lib/dpl/cli.rb:32:in `run'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.11/lib/dpl/cli.rb:7:in `run'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.11/bin/dpl:5:in `<top (required)>'
	from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `load'
	from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `<main>'
failed to deploy

see https://travis-ci.org/daggerok/sbt-examples/builds/546408881#L987

Hello,
I don’t know if it’s related, but I have a similar probleme with ruby with deploying. I’m using ubuntu xenial too
Here the log:

    dpl_0

    1.71s$ rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install dpl

    Successfully installed dpl-1.10.12

    1 gem installed

    dpl.1

    Installing deploy dependencies

    Successfully installed multipart-post-2.1.1

    Successfully installed faraday-0.15.4

    Successfully installed public_suffix-3.0.3

    Successfully installed addressable-2.6.0

    Successfully installed sawyer-0.8.2

    Successfully installed octokit-4.6.2

    Successfully installed dpl-pages-1.10.12

    7 gems installed

    /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/net/http.rb:906:in `rescue in block in connect': Failed to open TCP connection to http:443 (getaddrinfo: Name or service not known) (Faraday::ConnectionFailed)

    from /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/net/http.rb:903:in `block in connect'

    from /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/timeout.rb:93:in `block in timeout'

    from /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/timeout.rb:103:in `timeout'

    from /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/net/http.rb:902:in `connect'

    from /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/net/http.rb:887:in `do_start'

    from /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/net/http.rb:876:in `start'

    from /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/net/http.rb:1407:in `request'

    from /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/net/http.rb:1165:in `get'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:85:in `perform_request'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:43:in `block in call'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:92:in `with_net_http_connection'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/adapter/net_http.rb:38:in `call'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/response.rb:8:in `call'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/response.rb:8:in `call'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/octokit-4.6.2/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/octokit-4.6.2/lib/octokit/middleware/follow_redirects.rb:61:in `call'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/rack_builder.rb:143:in `build_response'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/connection.rb:387:in `run_request'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/faraday-0.15.4/lib/faraday/connection.rb:138:in `get'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/sawyer-0.8.2/lib/sawyer/agent.rb:94:in `call'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/octokit-4.6.2/lib/octokit/connection.rb:154:in `request'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/octokit-4.6.2/lib/octokit/connection.rb:19:in `get'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/octokit-4.6.2/lib/octokit/client/users.rb:34:in `user'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.12/lib/dpl/provider/pages.rb:104:in `user'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.12/lib/dpl/provider/pages.rb:108:in `setup_auth'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.12/lib/dpl/provider/pages.rb:112:in `check_auth'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.12/lib/dpl/provider.rb:187:in `block in deploy'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.12/lib/dpl/cli.rb:41:in `fold'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.12/lib/dpl/provider.rb:186:in `deploy'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.12/lib/dpl/cli.rb:32:in `run'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.12/lib/dpl/cli.rb:7:in `run'

    from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.12/bin/dpl:5:in `<top (required)>'

    from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `load'

from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `<main>'

This looks like GitHub responding with an error. You might want to retry.

Deploying application
/home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.12/lib/dpl/provider/pages.rb:141:in `mkdir': File exists @ dir_s_mkdir - /tmp/d20190718-6849-1q9rxlk/work (Errno::EEXIST)
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.12/lib/dpl/provider/pages.rb:141:in `github_pull_or_init'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.12/lib/dpl/provider/pages.rb:195:in `block in push_app'
	from /home/travis/.rvm/rubies/ruby-2.4.5/lib/ruby/2.4.0/tmpdir.rb:89:in `mktmpdir'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-pages-1.10.12/lib/dpl/provider/pages.rb:190:in `push_app'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.12/lib/dpl/provider.rb:199:in `block in deploy'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.12/lib/dpl/cli.rb:41:in `fold'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.12/lib/dpl/provider.rb:199:in `deploy'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.12/lib/dpl/cli.rb:32:in `run'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.12/lib/dpl/cli.rb:7:in `run'
	from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.12/bin/dpl:5:in `<top (required)>'
	from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `load'
	from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `<main>'

dpl 1.10.12 also occur error

Maybe user should checkout a gh-pages branch first, the ci deploy will success.
For me, it works after i pushed gh-pages to my repo

1 Like

I encountered the same problem with this ruby error. But create a gh-page to solve the problem wasn’t viable in my case.

I’ve looked at the documentation and saw there is an option target_branch which is set to gh-pages by default. Setting it to master solved the problem for me.

Hope it helps !

That is exactly what I need!

target_branch must be available on the remote.

This would work but after the fix, it should work even without this.
If it still fails for someone, please report the new error.

Just want to second that creating an empty gh-pages branch (using these instructions) and pushing it worked for me. I hope the developers can create better error messages in the future, or even better, automatically create the branch for us.

Thanks for the help!!
the target_branch that you have specified in .travis.yml must be there in the remote.