Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Helper scripts #24

wants to merge 5 commits into from

Conversation

scrungus
Copy link
Contributor

@scrungus scrungus commented Sep 3, 2024

No description provided.

@github-advanced-security
Copy link

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"
Copy link
Member

@JohnGarbutt JohnGarbutt Sep 23, 2024

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"
Copy link
Member

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:"
Copy link
Member

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
Copy link
Member

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"
Copy link
Member

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.

Copy link
Member

@JohnGarbutt JohnGarbutt left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants