Drillster / drone-volume-cache

Drone plugin for caching to a locally mounted volume
MIT License
108 stars 41 forks source link

Figure out replacement for DRONE_JOB_NUMBER for Drone 1.0.0 #23

Open jhasse opened 5 years ago

jhasse commented 5 years ago

Now that Drone 1.0.0 is released I've tried to port my 0.8 configs to it. I've noticed that DRONE_JOB_NUMBER is no longer available. I think a good replacement would be DRONE_STAGE_NAME or DRONE_STAGE_NUMBER (see https://github.com/drone/drone/blob/master/operator/runner/env.go#L65). But when I'm using that via

    cache_key: [ DRONE_REPO_OWNER, DRONE_REPO_NAME, DRONE_STAGE_NAME ]

I'm getting:

Warning! Environment variable 'DRONE_STAGE_NAME' does not contain a value, it will be ignored! 

Any idea why that variable doesn't get passed to the plugin?

mjwwit commented 5 years ago

The message you see is only printed when the given variable does not contain a value, so it may be that DRONE_STAGE_NAME is not a good variable to use by default. The removal of DRONE_JOB_NUMBER does warrant an update to this plugin though. When I migrate my projects to Drone 1.0 I'll take a look at the options. Meanwhile I'm open to other suggestions if anyone has them.

jhasse commented 5 years ago

It was a Drone bug (see referenced issue), now fixed in 1.0.1! DRONE_STAGE_NUMBER is the equivalent replacement and works :)

mjwwit commented 5 years ago

So it now works when using cache_key: [ DRONE_REPO_OWNER, DRONE_REPO_NAME, DRONE_STAGE_NUMBER ]?

I think we can eventually start using this as the default cache_key, but I'd like to wait for 1.0 to settle properly before I break all the 0.8 installations.

jhasse commented 5 years ago

Yes :)

ptman commented 5 years ago

Is drone-volume-cache compatible with drone 1.0+? How would one use it instead of travis caching like https://evilmartians.com/chronicles/speeding-up-go-modules-for-docker-and-ci ?