Skip to content

Commit

Permalink
days ago
Browse files Browse the repository at this point in the history
  • Loading branch information
vdesabou committed Jan 27, 2024
1 parent 29ac050 commit 310459b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
22 changes: 20 additions & 2 deletions scripts/cli/playground
Original file line number Diff line number Diff line change
Expand Up @@ -18302,14 +18302,31 @@ playground_connector_plugin_versions_command() {
exit 1
fi

if [[ "$(uname)" == "Darwin" ]]; then
# macOS
current_date=$(date -j -f "%Y-%m-%d" "$(date "+%Y-%m-%d")" "+%s")
else
# Linux
current_date=$(date +%s)
fi
while IFS= read -r row; do
IFS=$'\n'
arr=($(echo "$row" | jq -r '.version, .manifest_url, .release_date'))
version="${arr[0]}"
#manifest_url="${arr[1]}"
release_date="${arr[2]}"
if [[ "$(uname)" == "Darwin" ]]; then
# macOS
release_date_sec=$(date -j -f "%Y-%m-%d" "$release_date" "+%s")
else
# Linux
release_date_sec=$(date -d "$release_date" "+%s")
fi

# Calculate the difference in days
diff=$(( (current_date - release_date_sec) / 60 / 60 / 24 ))

echo "🔢 v$version - 📅 release date: $release_date" >> $filename
echo "🔢 v$version - 📅 release date: $release_date ($diff days ago)" >> $filename
done <<< "$(echo "$curl_output" | jq -c '.[]')"
else
logerror "❌ curl request failed with error code $ret!"
Expand Down Expand Up @@ -18562,6 +18579,7 @@ playground_connector_versions_command() {

# latest
latest=$(playground connector-plugin versions --connector-plugin $owner/$name --last 1)
latest_to_compare=$(echo "$latest" | sed 's/ ([0-9]* days ago)//')

manifest_file="$root_folder/confluent-hub/$full_connector_name/manifest.json"
if [ -f $manifest_file ]
Expand All @@ -18574,7 +18592,7 @@ playground_connector_versions_command() {
fi

current="🔢 v$version - 📅 release date: $release_date"
if [ "$current" == "$latest" ]
if [ "$current" == "$latest_to_compare" ]
then
log "👻 Version currently used for $owner/$name is latest"
echo "$current"
Expand Down
19 changes: 18 additions & 1 deletion scripts/cli/src/commands/connector-plugin/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,31 @@ then
exit 1
fi

if [[ "$(uname)" == "Darwin" ]]; then
# macOS
current_date=$(date -j -f "%Y-%m-%d" "$(date "+%Y-%m-%d")" "+%s")
else
# Linux
current_date=$(date +%s)
fi
while IFS= read -r row; do
IFS=$'\n'
arr=($(echo "$row" | jq -r '.version, .manifest_url, .release_date'))
version="${arr[0]}"
#manifest_url="${arr[1]}"
release_date="${arr[2]}"
if [[ "$(uname)" == "Darwin" ]]; then
# macOS
release_date_sec=$(date -j -f "%Y-%m-%d" "$release_date" "+%s")
else
# Linux
release_date_sec=$(date -d "$release_date" "+%s")
fi

# Calculate the difference in days
diff=$(( (current_date - release_date_sec) / 60 / 60 / 24 ))

echo "🔢 v$version - 📅 release date: $release_date" >> $filename
echo "🔢 v$version - 📅 release date: $release_date ($diff days ago)" >> $filename
done <<< "$(echo "$curl_output" | jq -c '.[]')"
else
logerror "❌ curl request failed with error code $ret!"
Expand Down
3 changes: 2 additions & 1 deletion scripts/cli/src/commands/connector/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ else

# latest
latest=$(playground connector-plugin versions --connector-plugin $owner/$name --last 1)
latest_to_compare=$(echo "$latest" | sed 's/ ([0-9]* days ago)//')

## current version
manifest_file="$root_folder/confluent-hub/$full_connector_name/manifest.json"
Expand All @@ -57,7 +58,7 @@ else
fi

current="🔢 v$version - 📅 release date: $release_date"
if [ "$current" == "$latest" ]
if [ "$current" == "$latest_to_compare" ]
then
log "👻 Version currently used for $owner/$name is latest"
echo "$current"
Expand Down
3 changes: 2 additions & 1 deletion scripts/tests-ignored.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ redshift-jdbc-sink.sh
snowflake-sink-snowpipe-streaming.sh

# no need to test in CI
azure-cognitive-search-sink-proxy.sh
azure-cognitive-search-sink-proxy.sh
s3-sink-with-short-lived-creds.sh

0 comments on commit 310459b

Please sign in to comment.