Dpl: Upload to gh-pages on Windows leads to "failed to deploy"

Created on 21 Sep 2019  Â·  14Comments  Â·  Source: travis-ci/dpl

I am using both Linux and Windows build and want to upload the build artifacts to gh-pages. It works on Linux, but not on Windows.

Maybe refs https://github.com/travis-ci/dpl/issues/990.

Linux output

Deploying application
cd /tmp/d20190921-7771-1mayyff/work
commit 97cf8e2281e1900fee3628b4173f771b1c7a9424
Author: Deployment Bot (from Travis CI) <[email protected]>
Date:   Sat Sep 21 10:10:05 2019 +0000

    Deploy adr/adr-j to github.com/adr/adr-j.git:gh-pages

 adr-j-3.1.0-SNAPSHOT-fat.jar | Bin 3646185 -> 3646185 bytes
 adr-j-3.1.0-SNAPSHOT.jar     | Bin 34788 -> 34788 bytes
 2 files changed, 0 insertions(+), 0 deletions(-)
cd -

Job: https://travis-ci.org/adr/adr-j/jobs/587801259

Windows output

failed to deploy
The system cannot find the path specified.
The system cannot find the path specified.
Logged in as @koppor (Oliver Kopp)
The system cannot find the path specified.
C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/dpl-pages-1.10.12/lib/dpl/provider/pages.rb:141:in `mkdir': File exists @ dir_s_mkdir - C:/Users/travis/AppData/Local/Temp/d20190921-3448-1om9jol/work (Errno::EEXIST)
    from C:/tools/ruby25/lib/ruby/gems/2.5.0/gems/dpl-pages-1.10.12/lib/dpl/provider/pages.rb:141:in `github_pull_or_init'

Job: https://travis-ci.org/adr/adr-j/jobs/587801260

Background

Build file: https://github.com/adr/adr-j/blob/b16307e33e67c4ede1a3f16b652abcff626b5cfb/.travis.yml

deploy:
  provider: pages
  skip_cleanup: true
  github_token: $GITHUB_TOKEN  # Set in the settings page of your repository, as a secure variable
  keep_history: true
  local_dir: build/libs
  on:
    branch: enable-native-image-using-gradle-plugin
stale

All 14 comments

I switched to edge and added gem install bundler as manual step. Now, the output is:

Installing gem dependencies: octokit (~> 4.14.0), public_suffix (~> 3.0.3)
Support for deployments to GitHub Pages is in **alpha**. Please see [Maturity Levels](https://github.com/travis-ci/dpl/#maturity-levels) for details.


failed to deploy
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
Switched to a new branch 'gh-pages'

Issue can be reproduced on a Windows machine in git bash:

$ ruby --version
ruby 2.6.4p104 (2019-08-28 revision 67798) [x64-mingw32]
$ gem --version
3.0.3
$ gem install dpl --pre
Successfully installed regstry-1.0.14
Successfully installed cl-1.1.5
Successfully installed dpl-2.0.0.alpha.6
Parsing documentation for regstry-1.0.14
Installing ri documentation for regstry-1.0.14
Parsing documentation for cl-1.1.5
Installing ri documentation for cl-1.1.5
Parsing documentation for dpl-2.0.0.alpha.6
Installing ri documentation for dpl-2.0.0.alpha.6
Done installing documentation for regstry, cl, dpl after 9 seconds
3 gems installed
$ dpl pages git --repo adr/adr-j --token MYPRIVATETOKEN
Support for deployments to GitHub Pages is in **alpha**. Please see [Maturity Levels](https://github.com/travis-ci/dpl/#maturity-levels) for details.
Installing deployment dependencies
Installing gem dependencies: octokit (~> 4.14.0), public_suffix (~> 3.0.3)
Authenticated as koppor
Setting the build environment up for the deployment
Das System kann den angegebenen Pfad nicht finden.
Das System kann den angegebenen Pfad nicht finden.
The source dir for deployment is C:/git-repositories/adr.github.io/test
Configuring git committer to be Oliver Kopp <[email protected]>
Deploying branch gh-pages to github.com/adr/adr-j.git
The deployment is configured to preserve the target branch if it exists on remote.
Das System kann den angegebenen Pfad nicht finden.
Initializing local git repo
$ git init .
Initialized empty Git repository in C:/Users/olive/AppData/Local/Temp/d20190921-12564-1fcujjh/.git/
Checking out orphan branch gh-pages
$ git checkout --orphan "gh-pages"
Switched to a new branch 'gh-pages'
Copying C:/git-repositories/adr.github.io/test contents to C:/Users/olive/AppData/Local/Temp/d20190921-12564-1fcujjh
$ rsync -rl --exclude .git --delete "C:/git-repositories/adr.github.io/test/" .
Failed to copy C:/git-repositories/adr.github.io/test.

The reason is, because Cmd uses cmd.exe to execute, not bash:

grafik

grafik

@svenfuchs May I ask whether the fix for this issue can be merged? The same issue is happening in my project as described above.

sorry about the delay here. reviewing the PR i thought there were issues with the implementation and that we'd need a more fundamental change for this. i was pondering introducing Ctx::Windows but haven't had the time to investigate this any further.

@kripod may i ask, if you have a build matrix of several jobs, wouldn't it be sufficient if only one of them deploys? e.g. couldn't you use a condition to exclude the Windows jobs from deploying, or make an additional stage that deploys only once? i'm probably missing something obvious ...

@svenfuchs Sure, I just enabled conditional deployments, thanks for the quick reply!

For me, the Windows build job builds windows binaries. That is not possible
on Linux - due to GraalVM not able to cross-compile for native images.

I hope that we can get in my quick fix. Maybe, we can create an issue and
asking for a follow up using better code.

Sven Fuchs notifications@github.com schrieb am Fr., 1. Nov. 2019, 16:15:

sorry about the delay here. reviewing the PR i thought there were issues
with the implementation and that we'd need a more fundamental change for
this. i was pondering introducing Ctx::Windows but haven't had the time
to investigate this any further.

@kripod https://github.com/kripod may i ask, if you have a build matrix
of several jobs, wouldn't it be sufficient if only one of them deploys?
e.g. couldn't you use a condition to exclude the Windows jobs from
deploying, or make an additional stage that deploys only once? i'm probably
missing something obvious ...

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/travis-ci/dpl/issues/1105?email_source=notifications&email_token=AAKNU7WLLVDAJSYIBF5LIF3QRRBXTA5CNFSM4IY55BVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC3GYGI#issuecomment-548826137,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAKNU7QN6VZBVS4Q5M3HLMTQRRBXTANCNFSM4IY55BVA
.

I Agree that solving this issue would be very helpful for my project too where a Windows VM is used to build & deploy.

In the meantime @koppor, is there a way to "fix" this issue on the "user" side?

@kdesnos oh, if the PR's branch solves the issue at hand you can totally use it using:

deploy:
- provider: pages
  edge:
    source: koppor/dpl
    branch: pages-fix-windows

Meh.. unfortunately, this does not do the trick :(
I get the following log:

 ruby -S gem uninstall -aIx dpl
Gem 'dpl' is not installed
Building dpl gem locally with source koppor/dpl and branch pages-fix-windows
0.03s1.09s$ git clone https://github.com/koppor/dpl koppor/dpl
Cloning into 'koppor/dpl'...
0.03s0.13s$ git checkout pages-fix-windows
Branch 'pages-fix-windows' set up to track remote branch 'pages-fix-windows' from 'origin'.
0.07s$ git rev-parse HEAD
fa8074836115883183eabcaa3235ff8d26af449b
0.76s$ ruby -S gem build dpl.gemspec
Switched to a new branch 'pages-fix-windows'
  Successfully built RubyGem
  Name: dpl
  Version: 2.0.0.alpha.6
  File: dpl-2.0.0.alpha.6.gem
0.03s5.66s$ ruby -S gem install $TRAVIS_BUILD_DIR/dpl-*.gem --pre
Successfully installed regstry-1.0.14
Successfully installed cl-1.1.5
Successfully installed dpl-2.0.0.alpha.6
Parsing documentation for regstry-1.0.14
Installing ri documentation for regstry-1.0.14
Parsing documentation for cl-1.1.5
Installing ri documentation for cl-1.1.5
Parsing documentation for dpl-2.0.0.alpha.6
Installing ri documentation for dpl-2.0.0.alpha.6
Done installing documentation for regstry, cl, dpl after 2 seconds
3 gems installed
failed to deploy
C:/tools/ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- os (LoadError)
    from C:/tools/ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/dpl-2.0.0.alpha.6/lib/dpl/ctx/bash.rb:5:in `<top (required)>'
    from C:/tools/ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from C:/tools/ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/dpl-2.0.0.alpha.6/lib/dpl/ctx.rb:1:in `<top (required)>'
    from C:/tools/ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from C:/tools/ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/dpl-2.0.0.alpha.6/lib/dpl.rb:2:in `<top (required)>'
    from C:/tools/ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from C:/tools/ruby26/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/dpl-2.0.0.alpha.6/bin/dpl:7:in `<top (required)>'
    from C:/tools/ruby26/bin/dpl:23:in `load'
    from C:/tools/ruby26/bin/dpl:23:in `<main>'

I was able to go further by adding the following line to my before_deploy section:

before_deploy:
    - ./releng/myscript.sh
    - ruby -S gem install os

Now I fail for a different reason (but Travis is fine with it and does not detect the failure)..

Installing deployment dependencies
Installing gem dependencies: octokit (~> 4.14.0), public_suffix (~> 3.0.3)
Support for deployments to GitHub Pages is in **alpha**. Please see [Maturity Levels](https://github.com/travis-ci/dpl/#maturity-levels) for details.
dpl.2
0.00sAuthenticate deployment
Authenticated as kdesnos
dpl.3
0.00sSetup deployment
Setting the build environment up for the deployment
The source dir for deployment is C:/Users/travis/build/gegelati/gegelati/neutral_builds
dpl.4
0.00sPrepare deployment
Deploying branch gh-pages to github.com/gegelati/neutral-builds.git
The deployment is configured to preserve the target branch if it exists on remote.
Using temporary work directory C:/Users/travis/AppData/Local/Temp/d20191108-4728-mvqfim
dpl.5
4.00sRun deployment
$ git ls-remote --exit-code https://<...>@github.com/gegelati/neutral-builds.git gh-pages > /dev/null 2>&1
Cloning the branch gh-pages from the remote repo
Configuring git committer to be (via Travis CI) <>
Copying C:/Users/travis/build/gegelati/gegelati/neutral_builds contents to C:/Users/travis/AppData/Local/Temp/d20191108-4728-mvqfim
$ rsync -rl --exclude .git --delete "C:/Users/travis/build/gegelati/gegelati/neutral_builds/" .
fatal: bad object 4c28e703e96c1c47ba81afdfb22f9fc9a3efaa1a
fatal: bad object 4c28e703e96c1c47ba81afdfb22f9fc9a3efaa1a
$ git ls-remote --exit-code https://<...>@github.com/gegelati/neutral-builds.git gh-pages > /dev/null 2>&1
$ git diff --quiet
There are no changes to commit, stopping.
Done. Your build exited with 0.
ssh: Could not resolve hostname c: Name or service not known
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(226) [Receiver=3.1.2]

Hi,

I got a similar error. However I'm using Linux. The deployment worked fine before with 2.0.0.alpha.11, but now with 2.0.0.alpha.12 it fails with this error message:

Missing arguments (given: 0, required: 1)
failed to deploy

I don't have the debug mode ready for this project so far, so that's all I got atm... I'm using this config

provider: pages
keep_history: true
deploy_key: github_deploy_key
cleanup: false
edge: true
repo: ...
target_branch: master
local_dir: "...."
verbose: true
on:
  branch: master

@spflueger thanks for the report! this is clearly a different issue though. let's move the conversation here: https://github.com/travis-ci/dpl/issues/1152

Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please do feel free to either reopen this issue or open a new one. We'll gladly take a look again! You can read more here: https://blog.travis-ci.com/2018-03-09-closing-old-issues

Was this page helpful?
0 / 5 - 0 ratings