To use staging APIs locally you can add the following lines to an .env.local file:
DEVICEGW_URL=https://api.staging.snapcraft.io/
SNAPSTORE_DASHBOARD_API_URL=https://dashboard.staging.snapcraft.io/
LOGIN_URL=https://login.staging.ubuntu.com
CANDID_API_URL=https://api.staging.jujucharms.com/identity/To use this functionality, you need to set up test accounts with GitHub and Launchpad to test.
Go and register a new OAuth application in your GitHub account. You can fill in the form however you want, and the only important detail is that you set the "Authorization callback URL" to http://localhost:8004/github/auth/verify.
Once you've created the application, you should be given the client id and the client secret. Update your .env.local file with your secrets:
GITHUB_CLIENT_ID=<Your client id>
GITHUB_CLIENT_SECRET=<Your client secret>When you run the project locally, you probably want to link GitHub repos with your local environment; otherwise GitHub won't be able to reach your localhost. You can use a tool like ngrok to proxy to your machine and update the following variable in your .env.local file:
GITHUB_WEBHOOK_HOST_URL=https://hash-id.ngrok.io/To connect to Launchpad, you need to set up a username, a consumer key and obtain an API token and an API token secret:
Download this Python script.
Run:
$ pip install launchpadlib
$ python3 ./scripts/create-launchpad-credentials.pyIt will print the details needed. If you need complete instructions for obtaining these details, they can be found here.
Update your .env.local file:
LP_API_USERNAME=<Your Launchpad username>
LP_API_TOKEN=<Your Launchpad API token>
LP_API_TOKEN_SECRET=<Your Launchpad API secret>For development purposes, visit https://sentry.io/signup/, signup and setup a project. By then you will have a sentry DSN string like:
https://<user>:<secret>@sentry.io/<project_id>
Create or update your .env.local file:
SENTRY_DSN=<DSN_FROM_ABOVE>
The application will be reporting errors to your sentry.io project from now on.
Install dotrun, then run
dotrun testThe licenses that we use are based on the SPDX Specification. In order to have all the products supporting the same set of licenses, the list needs to be synchronised between snapcraft.io, snapd and the snap store.
In case you need to update the license list:
- all the teams need to agree on the version of the list
- once agreed you can copy the list in the file: ./webapp/licenses.json
- Make sure the function
get_licenses()in the ./webapp/helpers.py is still working
We are supporting some custom licenses (like the Proprietary license). On update of the list, make sure that they have not been included since. This will avoid having duplicate licenses.
When the app is run locally, a GitHub personal access token is required to fetch the CVE data. Make sure you have access to the canonicalwebteam.snap-cves repository. After creating a GitHub classic personal access token, follow the steps described in GitHub's documentation. Then, add this token to the .env.local file with the key GITHUB_SNAPCRAFT_BOT_USER_TOKEN.
This project relies on Vite for processing and bundling TypeScript and SCSS source files; referencing these files and the resulting bundles in templates is done through a vite_import template function provided by the Canonical Webteam Flask-Vite integration package. The extension is configured via VITE_* variables that get loaded into the Flask app.config object where the extension reads them from.
Files referenced via vite_import are automatically detected and added as entry points in the Vite config when running the build command.