Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vmware-archive/cron-resource
https://github.com/vmware-archive/cron-resource
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/vmware-archive/cron-resource
- Owner: vmware-archive
- License: apache-2.0
- Archived: true
- Created: 2015-07-14T15:46:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-02-29T01:06:48.000Z (over 4 years ago)
- Last Synced: 2024-08-01T03:19:45.260Z (3 months ago)
- Language: Go
- Size: 10.2 MB
- Stars: 17
- Watchers: 59
- Forks: 9
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- stars - vmware-archive/cron-resource
README
# Crontab Resource
Implements a resource that reports new versions when the current time
matches the crontab expression---
## Update your pipelineUpdate your pipeline to include this new declaration of resource types. See the example pipeline yml snippet below or the Concourse docs for more details [here](https://concourse.ci/configuring-resource-types.html).
```
---
resource_types:
- name: cron-resource
type: docker-image
source:
repository: cftoolsmiths/cron-resourceresources:
- name: 10-min-trigger
type: cron-resource
source:
expression: "*/10 * * * *"
location: "America/New_York"
fire_immediately: true
```## Source Configuration
* `expression`: *Required.* The crontab expression:
|field | allowed values |
|-------------|----------------|
|minute | 0-59 |
|hour | 0-23 |
|day of month | 1-31 |
|month | 1-12 (or names, see below) |
|day of week | 0-7 (0 or 7 is Sun, or use names) |e.g.
`0 23 * * 1-5` # Run at 11:00pm from Monday to Friday
* `location`: *Optional.* Defaults to UTC. Accepts any timezone that
can be parsed by https://godoc.org/time#LoadLocatione.g.
`America/New_York`
`America/Vancouver`
* `fire_immediately`: *Optional.* Defaults to false. Immediately triggers the resource the first time it is checked.
## Behavior
### `check`: Report the current time.
Returns `time.Now()` as the version only if a minute since we last
fired matches the crontab expression. The first time the script runs
it will fire if a minute in the last hour matches the crontab
expression.#### Parameters
*None.*
### `in`: Report the given time
If triggered by `check`, returns the original version as the resulting
version.#### Parameters
1. *Output directory.* The directory where the in script will store
the requested version### `out`: Not supported.
## Developer Notes
You can test the behavior by simulating Concourse's invocations. For example:
```
$ echo '{"source":{"expression":"* * * * *","location":"America/New_York"}}' \
| go run ./check
[{"time":"2016-08-19T10:15:27.183011117-04:00"}]
```