Skip to content

Commit

Permalink
Enables labs to run with a Builders Plan only team (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
crdant authored Jul 1, 2023
1 parent aef2f6c commit a8f015c
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,24 @@ source /etc/profile.d/header.sh
# and users like to copy/paste
api_token=$(get_api_token)
app_id=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" https://api.replicated.com/vendor/v3/apps | jq -r '.apps[0].id')
omozon_customer_id=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customers" | jq -r '.customers[0].id')
omozan_customer_id=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customers" | jq -r '.customers[0].id')

# set the customer email so the user doesn't have to do it, also make it a paid license for the optics
existing_email="${INSTRUQT_PARTICIPANT_ID}@omozan.io"
updated_existing_customer=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customer/${omozon_customer_id}" | \
updated_existing_customer=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customer/${omozan_customer_id}" | \
jq -c --arg appId "${app_id}" --arg email "${existing_email}" '.customer | {"app_id": $appId, "name": .name, "email": $email, "channel_id": .channels[0].id, "expires_at": .expiresAt, "type": "prod", "is_airgap_enabled": .airgap, "is_gitops_supported": .isGitopsSupported, "is_identity_service_supported": .isIdentityServiceSupported, "is_geoaxis_supported": .isGeoaxisSupported, "is_snapshot_supported": .isSnapshotSupported, "is_support_bundle_upload_enabled": .isSupportBundleUploadEnabled, "entitlementValues":[]}')

curl --location "https://api.replicated.com/vendor/v3/customer/${customer_id}" \
curl --location "https://api.replicated.com/vendor/v3/customer/${omozan_customer_id}" \
--request PUT --header 'Accept: application/json' --header "Authorization: ${api_token}" \
--header "Content-Type: application/json" \
--data "${updated_existing_customer}"

# toggle the app to builders mode
curl --location "https://api.replicated.com/vendor/v3/app/${app_id}" \
--request POST --header 'Accept: application/json' --header "Authorization: ${api_token}" \
--header "Content-Type: application/json" \
--data '{ "is_foundation": true }'

# email for the customer the user will create
new_customer_email=${INSTRUQT_PARTICIPANT_ID}@geeglo.io
# help the user out by telling them the expiration date for a 30-day trial
license_expiry=$(date -d "+30 days" "+%B %d, %Y")

agent variable set APP_ID ${app_id}
agent variable set CUSTOMER_ID ${customer_id}
agent variable set CUSTOMER_ID ${omozan_customer_id}
agent variable set LICENSE_EXPIRY "${license_expiry}"
agent variable set CUSTOMER_EMAIL "${new_customer_email}"
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ updated_customer=$(curl --header 'Accept: application/json' --header "Authorizat
# the `replicant` user

# get the registry password (which is the license id)
registry_password=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customer/${customer_id}/license-download" | \
yq .spec.licenseID)
registry_password=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customer/${customer_id}" | \
yq .customer.installationId)

### Assure the tmux session exists
#
Expand Down
2 changes: 1 addition & 1 deletion instruqt/avoiding-installation-pitfalls/track.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ lab_config:
overlay: false
width: 33
position: right
checksum: "7699580194730823768"
checksum: "6797294594329278640"
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ lab.
![Vendor Portal Landing Page with Release Channels](../assets/vendor-portal-landing.png)

Select the "Customers" link from the left navigation to go see a list of
customers.
customers.

![Customers Landing Page with Geeglo Showing an Unavailable Instance](../assets/customers-page.png)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ api_token=$(get_api_token)
customer_email="${INSTRUQT_PARTICIPANT_ID}@geeglo.io"

# get the registry password (which is the license id)
registry_password=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customer/${customer_id}/license-download" | \
yq .spec.licenseID)
registry_password=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customer/${customer_id}" | \
yq .customer.installationId)

agent variable set CUSTOMER_EMAIL ${customer_email}
agent variable set REGISTRY_PASSWORD ${registry_pasword}
2 changes: 1 addition & 1 deletion instruqt/closing-information-gap/track.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ lab_config:
overlay: false
width: 33
position: right
checksum: "6919267823612132499"
checksum: "18127403098525702637"
10 changes: 2 additions & 8 deletions instruqt/closing-information-gap/track_scripts/setup-shell
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ app_slug=$(curl --header 'Accept: application/json' --header "Authorization: ${a
export REPLICATED_API_TOKEN=${api_token}
export REPLICATED_APP=${app_slug}

## convert the application to the builders experience
curl --location "https://api.replicated.com/vendor/v3/app/${app_id}" \
--request POST --header 'Accept: application/json' --header "Authorization: ${api_token}" \
--header "Content-Type: application/json" \
--data '{ "is_foundation": true }'

## release the application with the Replicated SDK
cd /home/replicant
mkdir release
Expand Down Expand Up @@ -208,8 +202,8 @@ updated_customer=$(curl --header 'Accept: application/json' --header "Authorizat
# the `replicant` user

# get the registry password (which is the license id)
registry_password=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customer/${customer_id}/license-download" | \
yq .spec.licenseID)
registry_password=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customer/${customer_id}" | \
yq .customer.installationId)

## install the release so we have something to support

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ alongside your application and enables access to the Replicated
Platform. The SDK allows you to enforce your entitlements and
take advantage of the telemetry that Replicated provides to help
you better understand customer instances. It also allows you
to get information about your application and its releases,
to get information about your application and its releases,
including checking for updates and showing version history.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,8 @@ curl --location "https://api.replicated.com/vendor/v3/customer/${customer_id}" \
--data "${updated_customer}"

# get the registry password (which is the license id)
registry_password=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customer/${customer_id}/license-download" | \
yq .spec.licenseID)

# toggle the app to builders mode
curl --location "https://api.replicated.com/vendor/v3/app/${app_id}" \
--request POST --header 'Accept: application/json' --header "Authorization: ${api_token}" \
--header "Content-Type: application/json" \
--data '{ "is_foundation": true }'
registry_password=$(curl --header 'Accept: application/json' --header "Authorization: ${api_token}" "https://api.replicated.com/vendor/v3/app/${app_id}/customer/${customer_id}" | \
yq .customer.installationId)

agent variable set APP_ID ${app_id}
agent variable set CUSTOMER_ID ${customer_id}
Expand Down
2 changes: 1 addition & 1 deletion instruqt/distributing-with-replicated/track.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ lab_config:
overlay: false
width: 33
position: right
checksum: "6439401780382844245"
checksum: "1484816796465641413"

0 comments on commit a8f015c

Please sign in to comment.