-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Helper scripts #24
base: main
Are you sure you want to change the base?
Helper scripts #24
Conversation
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
# Set up some variables | ||
CONTENT_TYPE="Content-Type: application/json" | ||
|
||
TOKEN="CHANGE THIS AFTER REDEPLOY" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change these to required params for the script please? Or maybe just a required env variable, in the case of the token?
AUTH_HEADER="Authorization: Bearer $TOKEN" | ||
|
||
# rcp-azimuth-cloud-portal-dev | ||
PROJECT_ID="79b2c7925276436091fa9301c4b05fd2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, lets make this a script parameter.
|
||
PROVIDER_ID="$SITE/resource_provider/1/" | ||
|
||
echo "Adding a resource provider account:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this script fails when the account already exists, I think we need to make the script idempotent, ideally.
DISK_ID=$(curl -s -X POST -H "$AUTH_HEADER" -H "$CONTENT_TYPE" -d '{"name": "DISK_GB"}' $SITE/resource_class/ | jq -r '.id') | ||
echo "Resource Class IDs: VCPU=$VCPU_ID, MEMORY_MB=$MEMORY_ID, DISK_GB=$DISK_ID" | ||
|
||
# 3. Add an account |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we drop these bits from this script, and leave that to the other script that adds credits for a given account?
|
||
SITE=https://credits.apps.staging.hpc.cam.ac.uk | ||
|
||
TEST_PASSWORD="testpassword" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we probably need a separate script that prompts the user for a password, then generates the token. I guess that is what the above script should be depending on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need three scripts here, so its a bit more general please:
- get token, prompt for password
- bootstrap provider
- update credits for a project, creating account/allocation when required
No description provided.