speculative

https://github.com/borkdude/speculative
borkdude 2018-11-12T11:06:03.000200Z

https://github.com/slipset/speculative/issues/105

borkdude 2018-11-12T13:03:07.001200Z

https://github.com/slipset/speculative/pull/106

borkdude 2018-11-12T14:36:05.001500Z

any objections against this PR?

borkdude 2018-11-12T14:36:19.001800Z

from my perspective: we lose nothing, but only gain something (performance)

borkdude 2018-11-12T15:07:52.002200Z

merged (after approval of slipset)

borkdude 2018-11-12T16:20:45.003300Z

@slipset it seems like circleci also pushes snapshots to clojars when it builds PRs: https://circleci.com/gh/slipset/speculative/328#tests/containers/0

borkdude 2018-11-12T16:20:59.003600Z

so maybe we could add something like ‘if PR, don’t push to clojars’

borkdude 2018-11-12T16:22:54.004100Z

as you can see in this history: https://circleci.com/gh/slipset/speculative the latest two runs both produce a snapshot push to clojars

borkdude 2018-11-12T16:59:40.005500Z

I think that script was fundamentally broken. it did a deploy for each CircleCI build:

Skipped command Created /home/circleci/repo/target/speculative-0.2.1-SNAPSHOT.jar

borkdude 2018-11-12T17:00:04.006Z

because lein deploy clojars was written between backticks, it would evaluate that regardless

borkdude 2018-11-12T17:00:51.006500Z

I’m not sure how we can prevent users from deploying to clojars by sending a PR, because they can mess with the script.

borkdude 2018-11-12T17:03:10.007Z

so maybe deploying from circle is not such a good idea

borkdude 2018-11-12T17:08:29.007500Z

or maybe circleci / github has some solution for this

borkdude 2018-11-12T17:11:45.008Z

@slipset improved two things now: PR doesn’t deploy and if any of us merge a PR, it is deployed from master.

slipset 2018-11-12T17:12:25.008800Z

Nice! Thanks for fixing that. Most probably my fault.

borkdude 2018-11-12T17:12:45.009300Z

no problem. but there is still this security flaw

slipset 2018-11-12T17:25:38.009500Z

Oh, but they cant

slipset 2018-11-12T17:25:45.009700Z

They need my credentials 🙂

borkdude 2018-11-12T17:26:13.010500Z

all they need to do is change the script and call lein clojars deploy I think?

slipset 2018-11-12T17:26:18.010700Z

Nope

slipset 2018-11-12T17:26:28.011Z

It will then prompt for username/password

borkdude 2018-11-12T17:26:41.011400Z

how come all these PRs were pushing to clojars?

slipset 2018-11-12T17:26:49.011700Z

and only I and you have access to that repo

slipset 2018-11-12T17:27:05.012Z

sorry, not repo, I meant org.

slipset 2018-11-12T17:28:03.012100Z

slipset 2018-11-12T17:28:31.012900Z

Hrmf. I wanted to upload a picture of the circle-ci settings page

slipset 2018-11-12T17:28:43.013300Z

No space left on clojurians organization

slipset 2018-11-12T17:29:13.013800Z

Import Variables

Add Variable
Add environment variables to the job. You can add sensitive data (e.g. API keys) here, rather than placing them in the repository.

Name	Value	Remove
CLOJARS_PASSWORD	xxxx	
CLOJARS_USERNAME	xxxx	

borkdude 2018-11-12T17:29:18.013900Z

I see, this PR from bbr wasn’t pushed: https://circleci.com/gh/slipset/speculative/236

borkdude 2018-11-12T17:29:54.014400Z

because you gave me authorization on circle, this works?

slipset 2018-11-12T17:30:31.015Z

hmm.

slipset 2018-11-12T17:31:32.016200Z

I haven’t looked at the code, but any code that is built from my circle account can in theory be pushed to clojars, since I have set up the uname/password there.

slipset 2018-11-12T17:32:29.017300Z

So, as long as the PR is built by “me”, then it should be published to clojars, unless we have a check that checks only for builds on master.

borkdude 2018-11-12T17:33:01.017800Z

All PRs by me were built and published to clojars, but not the one by bbr. I’m a bit puzzled.

slipset 2018-11-12T17:34:37.018Z

I think I see why

slipset 2018-11-12T17:34:49.018300Z

You make your prs off your master branch?

borkdude 2018-11-12T17:35:04.018900Z

not all the time no

slipset 2018-11-12T17:35:08.019100Z

Whereas bbr made his off a branch.

borkdude 2018-11-12T17:35:40.019500Z

I think because my PR came from a branch in the slipset/speculative repo

borkdude 2018-11-12T17:35:54.019800Z

and not from a different personal account

slipset 2018-11-12T17:35:57.020Z

Yeah, that might just be.

slipset 2018-11-12T17:37:17.021300Z

But still, I think that if [ "$CIRCLE_BRANCH" = "master" ] && [ "$CIRCLE_USERNAME" = "slipset" ] should have handled that

borkdude 2018-11-12T17:37:25.021800Z

I think we’re good then. As of now, only master branch will push to clojars, not PR branches in the same repo. This is needed, because the git commit sha must be attached to the POM that is pushed to clojars.

slipset 2018-11-12T17:37:27.021900Z

ie, we should only publish to clojars on master.

borkdude 2018-11-12T17:37:49.022400Z

no, that didn’t work, because CIRCLE_BRANCH was master even if the PR came from branch_xxx

borkdude 2018-11-12T17:38:01.022700Z

it’s the name of the branch the PR is going to

borkdude 2018-11-12T17:38:40.023200Z

so also if we deploy locally, first make the change to the master branch, sync it locally and then do the deploy

borkdude 2018-11-12T17:38:49.023500Z

this will have impact on http://cljdoc.org

borkdude 2018-11-12T17:39:13.023900Z

(I tested the CIRCLE_BRANCH with an echo in a certain commit in a different branch)

slipset 2018-11-12T17:39:29.024100Z

ah, ok.

borkdude 2018-11-12T17:39:53.024300Z

all clear then 🙂