-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
- Install Tampermonkey if you don't already have it.
- If you're using Chrome, follow these additional instructions to configure Tampermonkey.
- Install Speedrun
- Reload this page
Since Speedrun is different than anything out there, to wrap your head around its capabilities, try the live demo. You don't even need an AWS account, it uses ours!
Speedrun is enabled per repository. Enable it on repositories you trust by using the sword slider.
Each Speedrun block starts with a template which tells Speedrun what to do. The simplest template is the #copy
template which copies something to the clipboard, but there are others including ones to federate into the AWS console, invoke Lambdas and Step Functions. To get Speedrun to find and wire up your block, wrap your content with code fences (```
), put the #template
you want to use on a new line and enter any content below that.
Tip
Click the Code tab to see the underlying Markdown for an entry. Click the icon to copy the underlying Markdown to the clipboard.
This will use the #copy
template to copy something to the clipboard. Click the
#copy
This was copied by ${user}
Read more about templates, the different template types, built-in templates for running things like CloudWatch queries and how to build your own here.
To prompt the user, wrap the prompt name with 3 tildes (~~~
) on each side. Speedrun will replace it with what the user enters.
#copy
This is ${user}'s favorite color: ~~~Favorite Color~~~
Further you can use prompts to set variables. The syntax is: ~~~variable=Prompt Text~~~
You can reference a variable before and after it is defined.
#copy
This is ${user}'s favorite loud color ${color.toUpperCase()}
This is ${user}'s favorite color: ~~~color=Favorite Color~~~
Read more about prompts, changing the prompt type, adding validation, labels, default values and transforming inputs here.
To use JavaScript wrap content with ${}
.
Tip
Click the Debug tab to see the variables Speedrun exposes for the current page context.
Here ${user.toUpperCase()}
is used to get the current GitHub username in uppercase.
#copy
This is ${user.toUpperCase()}'s favorite color: ~~~Favorite Color~~~
Read more about using JavaScript, the built-in helper functions and defining your own functions here.
Find out how to use the toolbar and the interface here: User Interface Documentation
Speedrun configuration is used to define what appears in the toolbar and to set the corresponding context for the page. You can set the optional AWS account and role used during federation and any configuration you want associated with your environments, stages or blocks (i.e. the CloudWatch log group name). You can see the current context variables by clicking the Debug
tab of any Speedrun block. To configure all the AWS accounts and configuration your team uses read configuring Speedrun for your environment
First decide which credentials broker is most suitable for your needs.
- Speedrun: Allows you to use GitHub authorization to grant access to roles, but requires one time registration of your accounts and roles, and roles must trust the Speedrun account in their trust policy. Follow the Create Speedrun Roles steps below.
- IAM Identity Center: Allows you to use your existing Identity Center configuration by specifying your start url. Follow the Identity Center cookbook
- Granted: Allows you to use Granted to get credentials. Follow the Granted cookbook.
Follow this wiki to create the necessary Speedrun roles and to register your AWS accounts
srinit
is a command line tool that authenticates you with GitHub so you can assume the Speedrun roles you have access to
#copy
python3 -m pip install --extra-index-url https://speedrun.nobackspacecrew.com/packages srinit
Now run srinit
to authenticate so you can run AWS CLI commands.
Note
srinit
needs to be run once every 24 hours.
#copy
srinit
If you've added your account and role/permSet to the settings, you can now use them to federate into the AWS console using the #federate
template.
#federate
If you have the AWS CLI installed, you can run commands with credentials using the #copy.withCreds
template like this.
#copy.withCreds
aws sts get-caller-identity
- Join the Discord for help
- Read the cookbook for some examples of configuration
- Read this blog and interact with it here.
- Learn how it works below
Speedrun takes a template that defines what you want it to do, sets the variables from the context set by the toolbar and evaluates the JavaScript locally in the browser. It can use any of the following to do what you need to do.
-
Markdown content referenced by
${content}
in templates is what you put in your code fences. It can be any text content including things like json, a url, a command line or JavaScript code. - Prompts prompt the user for input. By default, they are set to what was entered last time the user was prompted for the same thing.
-
Credentials Speedrun operates as a credentials broker, if the authenticated GitHub user is authorized to assume the role (specified by the
role
variable) in the account (specified by theaccount
variable), it can vend credentials to federate into the AWS Console or provide credentials for the command line. - Configuration defines things like what AWS accounts and roles to use, what your services are called and any configuration you want to associate with your services such as the log groups or the stage.
- JavaScript to manipulate inputs, reference configuration and set default values.
Speedrun does the following when you load a markdown page.
- Finds all the configuration for current page and uses it to build the toolbar
- Looks for code fences that use a defined template, adds buttons to them and renders a preview.
- When the do it button is clicked; prompts for any inputs, resolve any variables, and run all JavaScript code to process the template.
- Depending on the template type, copy the result to the clipboard, open a link, federate into the AWS Console, invoke a lambda or step function or download the result as a file.