Browse Source

Update readme

master
Luciano Silva 8 years ago
parent
commit
224b75b584
  1. 8
      README.md
  2. 15
      pipeline.yml

8
README.md

@ -1,6 +1,6 @@
# File URL Resource # File URL Resource
Downloads and tracks the update of a single URL-addressable file.
Tracks the update of a single URL-addressable file.
This is a useful resource for pipeline development time, while a required artifact is temporarily available from a URL-addressable location, until it is moved to a more robust file management repository such as [git](https://github.com/concourse/git-resource) or [S3](https://github.com/concourse/s3-resource). This is a useful resource for pipeline development time, while a required artifact is temporarily available from a URL-addressable location, until it is moved to a more robust file management repository such as [git](https://github.com/concourse/git-resource) or [S3](https://github.com/concourse/s3-resource).
## Source Configuration ## Source Configuration
@ -36,9 +36,13 @@ resources:
### `check`: Check for the latest version of the file. ### `check`: Check for the latest version of the file.
The resource uses `curl` under-the-covers to post a GET request and retrieve the HTTP header info for the file URL provided. The resource uses `curl` under-the-covers to post a GET request and retrieve the HTTP header info for the file URL provided.
If field `Last-Modified` is returned as part of the HTTP response header, then the resource will use that to build a version number timestamp with format "YYYYMMDDHHMMSS".
If field `Last-Modified` is returned as part of the HTTP response header, then the resource will use that to build a version number timestamp with format "YYYYMMDDHHMMSS".
Otherwise, the timestamp string will be built using the request's current time, which will result in a new version being returned every time `check` is executed for that file. Otherwise, the timestamp string will be built using the request's current time, which will result in a new version being returned every time `check` is executed for that file.
To verify if a file URL returns the `Last-Modified` information in its HTTP response header, issue the `curl` command below and search for field "Last-Modified" in its output.
```curl -I <file-url>```
### `in`: Download the latest version of the file. ### `in`: Download the latest version of the file.
Downloads the latest version of the file issuing a `curl` command under-the-covers. Downloads the latest version of the file issuing a `curl` command under-the-covers.

15
pipeline.yml

@ -6,16 +6,22 @@ resource_types:
tag: latest tag: latest
resources: resources:
- name: my-file
- name: my-file-with-last-modified-info
type: file-url
source:
url: https://s3-us-west-1.amazonaws.com/lsilva-bpws/PCF_usage/pcf-sandbox-usage-from-2016-09-01-to-2016-09-30_1475771124.json
filename: pcf-sandbox-usage.json
- name: my-file-without-last-modified-info
type: file-url type: file-url
source: source:
url: https://raw.githubusercontent.com/pivotalservices/concourse-curl-resource/master/test/data/pivotal-1.0.0.txt url: https://raw.githubusercontent.com/pivotalservices/concourse-curl-resource/master/test/data/pivotal-1.0.0.txt
filename: pivotal-1.0.0.txt filename: pivotal-1.0.0.txt
jobs: jobs:
- name: run-and-get-file
- name: run-and-get-files
plan: plan:
- get: my-file
- get: my-file-with-last-modified-info
- get: my-file-without-last-modified-info
- task: run-and-get-file - task: run-and-get-file
config: config:
platform: linux platform: linux
@ -25,7 +31,8 @@ jobs:
repository: ubuntu repository: ubuntu
tag: "latest" tag: "latest"
inputs: inputs:
- name: my-file
- name: my-file-with-last-modified-info
- name: my-file-without-last-modified-info
run: run:
path: sh path: sh
args: args:

Loading…
Cancel
Save