Luciano Silva
8 years ago
6 changed files with 50 additions and 209 deletions
-
2assets/check
-
55assets/in
-
60assets/out
-
57pipeline.yml
-
7test/test-check.sh
-
76test/test-in.sh
@ -1,67 +1,27 @@ |
|||
#!/bin/bash |
|||
|
|||
set -e |
|||
|
|||
source $(dirname $0)/helpers.sh |
|||
|
|||
it_can_get_version_from_artifactory() { |
|||
|
|||
# local local_ip=$(find_docker_host_ip) |
|||
#local_ip="localhost" |
|||
|
|||
artifactory_ip=$ART_IP |
|||
TMPDIR=/tmp |
|||
|
|||
local src=$(mktemp -d $TMPDIR/in-src.XXXXXX) |
|||
local endpoint="http://${artifactory_ip}:8081/artifactory" |
|||
local regex="ecd-front-(?<version>.*).tar.gz" |
|||
local folder="/generic/ecd-front" |
|||
local version="20161109222826" |
|||
|
|||
in_without_credentials_with_version $endpoint $regex $folder $version $src |
|||
|
|||
export src=$(mktemp -d /tmp/in-src.XXXXXX) |
|||
|
|||
# set FILE_URL_WITH_LAST_MODIFIED_INFO with a URL of a file whose HTTP HEADER info provides a Last-Modified entry |
|||
# to check it do "curl -I -R <url>" |
|||
export FILE_URL_WITH_LAST_MODIFIED_INFO=https://s3-us-west-1.amazonaws.com/lsilva-bpws/PCF_usage/pcf-sandbox-usage-from-2016-09-01-to-2016-09-30_1475771124.json |
|||
export FILE_NAME_1=pcf-sandbox.json |
|||
# set FILE_URL_WITHOUT_LAST_MODIFIED_INFO with a URL of a file whose HTTP HEADER info DOES NOT provide a Last-Modified entry |
|||
# to check it do "curl -I -R <url>" |
|||
export FILE_URL_WITHOUT_LAST_MODIFIED_INFO=https://raw.githubusercontent.com/pivotalservices/concourse-curl-resource/master/test/data/pivotal-1.0.0.txt |
|||
export FILE_NAME_2=ivotal-1.0.0.txt |
|||
|
|||
it_can_get_file_with_date_info() { |
|||
jq -n "{ |
|||
source: { |
|||
url: $(echo $FILE_URL_WITH_LAST_MODIFIED_INFO | jq -R .), |
|||
filename: $(echo $FILE_NAME_1 | jq -R .) |
|||
} |
|||
|
|||
it_cant_get_version_from_artifactory() { |
|||
|
|||
# local local_ip=$(find_docker_host_ip) |
|||
#local_ip="localhost" |
|||
|
|||
artifactory_ip=$ART_IP |
|||
TMPDIR=/tmp |
|||
|
|||
local src=$(mktemp -d $TMPDIR/in-src.XXXXXX) |
|||
local endpoint="http://${artifactory_ip}:8081/artifactory" |
|||
local regex="ecd-front-(?<version>.*).tar.gz" |
|||
local folder="/generic/ecd-front" |
|||
local version="NONE" |
|||
|
|||
in_without_credentials_with_version $endpoint $regex $folder $version $src |
|||
}" | $resource_dir/in "$src" | tee /dev/stderr |
|||
|
|||
} |
|||
|
|||
it_can_get_version_from_artifactory_with_credentials() { |
|||
|
|||
# local local_ip=$(find_docker_host_ip) |
|||
#local_ip="localhost" |
|||
|
|||
artifactory_ip=$ART_IP |
|||
TMPDIR=/tmp |
|||
|
|||
local src=$(mktemp -d $TMPDIR/in-src.XXXXXX) |
|||
local endpoint="http://${artifactory_ip}:8081/artifactory" |
|||
local regex="ecd-front-(?<version>.*).tar.gz" |
|||
local folder="/generic/ecd-front" |
|||
local version="20161109222826" |
|||
local username="${ART_USER}" |
|||
local password="${ART_PWD}" |
|||
|
|||
in_with_credentials_with_version $endpoint $regex $folder $version $src $username $password |
|||
|
|||
} |
|||
|
|||
#run it_can_get_version_from_artifactory |
|||
run it_can_get_version_from_artifactory_with_credentials |
|||
|
|||
# check for exit code > 0 |
|||
#run it_cant_get_version_from_artifactory |
|||
run it_can_get_file_with_date_info |
Write
Preview
Loading…
Cancel
Save
Reference in new issue