Closed SimenB closed 6 years ago
BTW, have you tried emailing Travis about getting access to an enterprise instance for testing? I haven't mailed them before, but I'm hopeful they'd be positive towards helping with an integration for semantic-release.
https://docs.travis-ci.com/user/enterprise/#Trials-and-Licensing
Anyways, I can test on Travis Enterprise as we use it at work. Ay ideas on where to start? I have no idea from where the call which fails even comes from.
(and I don't think I can remotely debug either, so it'll be push and see what happnes...)
The problem is actually in https://github.com/semantic-release/travis-deploy-once which use https://github.com/pwmckenna/node-travis-ci. Unfortunately pwmckenna/node-travis-ci doesn't support Travis Enterprise. See lib/travis-http.js#L5.
In condition-travis
we need to:
travisUrl
that can be configured via a plugin option or an environment variable. See githubUrl
in https://github.com/semantic-release/github for an example.Then semantic-release/travis-deploy-once
will have to make API calls with this url. There is multiple approach to achieve (by order of preference):
travisUrl
parameter (that should be fairly easy to do, so I strongly favor this options)pwmckenna/node-travis-ci
by another lib that supports Travis Enterprisesemantic-release/travis-deploy-once
with an http library like https://github.com/sindresorhus/gotWe would gladly accept PRs on all that!
For now you can also set the environment variable BUILD_LEADER_ID
to select on which job number semantic-release
should run. By doing so the call to semantic-release/travis-deploy-once
will be skipped and no API call will be made. See an example here (The build stage part is not required).
There is https://github.com/pwmckenna/node-travis-ci/issues/21
Which was opened up by a colleague of mine, so I should probably sync with him!
👍 It seems a PR would be welcomed to solve pwmckenna/node-travis-ci#21 :)
PR sent. Not sure if it'll be released right away, though: https://github.com/pwmckenna/node-travis-ci/pull/19#issuecomment-346230739
I'll try the workaround!
BUILD_LEADER_ID
seems ignored - all 3 of my builds (node 8, 6, and 9) try to run semantic-release, and they all fail with the api error towards travis.
Setting environment variables from .travis.yml
...
$ export BUILD_LEADER_ID=1
That's quite surprising....The Node 6 job should exit right away due to https://github.com/semantic-release/semantic-release/blob/caribou/bin/semantic-release.js#L9
What value did you set for BUILD_LEADER_ID
?
Not if Travis allow to export variables like that. Can you set it in your travis.yml
like that:
env:
- BUILD_LEADER_ID=1
Oh sorry, I lied. Node 6 is not ran! Both node 8 and node 9 is, though
Relevant part of my .travis.yml:
env:
global:
- GITHUB_URL=https://github.schibsted.io
- GITHUB_PREFIX=/api/v3
- NPM_USERNAME=$ARTIFACTORY_USER
- NPM_PASSWORD=$ARTIFACTORY_NPM_SECRET
- NPM_EMAIL=$ARTIFACTORY_USER
- BUILD_LEADER_ID=1
- secure: some token
With output on travis being:
Setting environment variables from .travis.yml
$ export GITHUB_URL=https://github.schibsted.io
$ export GITHUB_PREFIX=/api/v3
$ export NPM_USERNAME=$ARTIFACTORY_USER
$ export NPM_PASSWORD=$ARTIFACTORY_NPM_SECRET
$ export NPM_EMAIL=$ARTIFACTORY_USER
$ export BUILD_LEADER_ID=1
$ export GH_TOKEN=[secure]
From what I can see in the code, the auth request to travis is always sent: https://github.com/semantic-release/travis-deploy-once/blob/ad21dc45a20f9029d3f14758e9ca7d58d4bc2eae/lib/travis-deploy-once.js#L31
Looking at the code more in detail the workaround will not work... The API is called no matter what...Sorry for the confusion.
I looked into sending a PR, but because of waitForOtherJobs
there's no way to avoid the API calls (unless I use build stages, I suppose, but those are not available on the version of Travis we're on)
Yes, we test if there is other jobs and if they are completed, even with Build stages enabled.
Ok. Will give pwmckenna/node-travis-ci#22 a couple of days then, before I start thinking about replacing it in semantic-release/travis-deploy-once
🙂
Will send a PR to this repo tomorrow anyways, it's getting late
If we had to to re-implment the calls with an http library it would be great to do so with the API v3. As v2 is deprecated.
See https://github.com/semantic-release/semantic-release/issues/540
I'd be happy to provide a PR for this 🙂