Scripts - jpvlsmv/cc-template-pack GitHub Wiki

Scripts provided by template-pack

cc-template-pack has some scripts that are useful for managing a custom pack via gitlab actions or gitlab-ci equivalents. They are not necessary for your custom pack, and can be deleted without affecting the functionality you deliver.

pull-pack.sh

$ .scripts/pull-pack.sh  -h
Usage: .scripts/pull-pack.sh [-g group] [-d deployname] <https://cribl-api-endpoint/>

Required inputs

  • The API endpoint for the cribl instance. Something like https://your-org-name.cribl.cloud/api/
  • Some authentication variables, expected to be created by the CI job via a protected secret. CRIBL_USER= and CRIBL_PASSWORD= Since that doesn't work for Cribl.cloud instances, you can alternatively get an authentication (Bearer) token that works for a limited time via the web UI under Settings, API Reference, running one of the authentication-required-API services, and copying the token from the displayed curl command.

Optional inputs

  • If your custom pack is deployed to a particular group under this API source, you can specify the name of that group with the -g option. The default is to pull from group default
  • If your custom pack is deployed with a different pack ID, such as if the pack ID includes version information, you can use the -d option to tell the script what pack to fetch. By default, the pack ID selected is the working directory where the script is run.

Output

After the script runs to completion, the working directory will have the changes from that cribl instance unpacked. You can compare the updated repo against what is already in git, and/or kick off a workflow of those changes.

Handling errors

The script will exit on any errors that I have anticipated including:

  • Give it -h help option
  • If the jq or git command is not available on the system. (CI image: alpine:latest are missing both of these)
  • If there is no authentication variable passed in
  • If no API URL is given
  • If the username+password authentication does not result in a token
  • If the download of the pack fails
  • If the extraction of the pack fails (bad data?)
⚠️ **GitHub.com Fallback** ⚠️