Skip to content

Instantly share code, notes, and snippets.

@goneri
Created April 4, 2018 17:33
Show Gist options
  • Save goneri/11998202a48bb4bc06e7230912075090 to your computer and use it in GitHub Desktop.
Save goneri/11998202a48bb4bc06e7230912075090 to your computer and use it in GitHub Desktop.
DCI: Fetch the last component for a given topic
#!/bin/bash
if [ -z $1 ]; then
echo "Usag: $0 tag_name"
exit 1
fi
tag_name=$1
tag_id=$(dcictl --format json topic-list --where name:${tag_name}|jq -r '.topics[0].id')
component_id=$(dcictl --format json component-list --topic-id ${tag_id} --limit 1|jq -r .components[0].id)
component_name=$(dcictl --format json component-list --topic-id ${tag_id} --limit 1|jq -r .components[0].name)
component_file_id=$(dcictl --format json component-file-list $component_id|jq -r .component_files[0].id)
echo "component_name $component_name"
echo "component_id $component_id"
echo "component_file_id $component_file_id"
mkdir ~/tmp
dcictl component-file-download $component_id --file-id $component_file_id --target ~/tmp/toto.tar
#tar tf ~/tmp/toto.tar|grep container_images.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment