Change a package from public to private in the depot


#1
curl -v \
-X PATCH \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $HAB_AUTH_TOKEN" \
https://bldr.habitat.sh/v1/depot/pkgs/<origin>/<package_name>/<version>/<timestamp>/private

Should we move artifacts to private after merge into core-plans?
#2

Related to this, if you have many releases of a package that you need to make private at once, you can use a script like this:

#!/bin/bash
# fetch and delete all releases of a version of a package

ORIGIN='chef-server'
PACKAGE='automate-nginx'
VERSION='1.7.0-dev'

RELEASES=$(curl -s https://bldr.habitat.sh/v1/depot/pkgs/${ORIGIN}/${PACKAGE}/${VERSION}?range=0 | jq -r '.data | .[] | .["release"]')

for release in $RELEASES; do
  echo "privating: https://bldr.habitat.sh/v1/depot/pkgs/${ORIGIN}/${PACKAGE}/${VERSION}/${release}/private"
  curl -s \
  -X PATCH \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $HAB_AUTH_TOKEN" \
  "https://bldr.habitat.sh/v1/depot/pkgs/${ORIGIN}/${PACKAGE}/${VERSION}/${release}/private"
done

Thanks to @irvingpop for sharing this info!