- 4 Minutes to read
- Print
- DarkLight
- PDF
Debugging Actions
- 4 Minutes to read
- Print
- DarkLight
- PDF
AllSpice CI/CD Debugging FAQs
Organizations must be enabled for Actions by joining our Beta.
Repositories must be enabled
Enable actions in your repository
Enable actions by visiting your repository->π§Settings, and clicking [X]
Enable Repository Actions
Scroll down to search (ctrl+f) for "Actions"
Ensure
Enable Repository Actions
is checkedActions are only for organization repos
Actions will not currently work on a personal repositories during this phase of the beta. You must use a repository owned by an organization.
Try running the Actions quickstart demo
Try running the Hello World demo
Try running the BOM generation Action demo
Debugging workflow
The best way to get started debugging, is to run our debugging workflow: 10-Debugging-workflows.yml
found here:
https://hub.allspice.io/AllSpice-demos/Actions-demo
This workflow runs a series of tests and then uploads the log as an artifact file.
# Python-py-allspice demo repository
# This workflow demonstrates how to use Python and py-allspice to interact with the AllSpice API
# AllSpice Actions documentation: https://learn.allspice.io/docs/actions-cicd
name: Debugging workflows
on:
push:
issues:
types: [opened, closed, reopened]
jobs:
py-allspice test:
runs-on: ubuntu-latest
steps:
# Check out repository code
- name: "[π->π₯οΈ] Check out repository code"
uses: actions/checkout@v3
# Run some basic debugging steps
- name: "Print container info π"
run: |
{
echo "OS Version: $(lsb_release -a)"
echo "Container IP: $(hostname -I)"
echo "Container Hostname: $(hostname)"
echo "Container OS: $(uname -a)"
echo "Container CPU: $(lscpu)"
echo "Container Memory: $(free -h)"
echo "Container Disk: $(df -h)"
echo "Container Network: $(ifconfig)"
echo "Current user: $(whoami)"
echo "Container Users: $(who)"
echo "Container Processes: $(ps -aux)"
echo "Container Environment: $(env)"
echo "Container Path: $(echo $PATH)"
echo "Container Python: $(python --version)"
} | tee -a debug.log
- name: "Network test π"
run: |
{
echo "curl -I http://example.com"
curl -I http://example.com
} | tee -a debug.log
- name: "Print current workflow user π"
run: |
{
echo "Workflow AllSpice user: ${{ allspice.actor }}"
} | tee -a debug.log
- name: "[π->π] List files in repo π"
run: |
{
ls -la .
ls -la ${{ allspice.workspace }}
} | tee -a debug.log
- name: List all environment variables π
run: |
{
echo "Listing all environment variables..."
printenv | sort
} | tee -a debug.log
# Installs python requirements from the requirements.txt file
- name: "[π€Ό->π₯οΈ] Install python requirements"
run: |
{
pip install -r .allspice/utils/requirements.txt
} | tee -a debug.log
# Call a python script from the .allspice/utils directory
- name: "[π->π] Run .allspice/utils/hello-world.py π"
run: |
{
python .allspice/utils/hello-world.py
} | tee -a debug.log
# Run the py-allspice self-test script, this will ping the server and verify the API is working
# Parameters: ${allspice.server_url} and ${allspice.token} are automatic Workflow variables and are used to authenticate the AllSpice API
- name: "[π->πΈοΈ] Test AllSpice API with py-allspice π"
run: |
{
python .allspice/utils/py-allspice-BIST.py --allspice_hub_url ${{ allspice.server_url }} --allspice_token ${{ allspice.token }}
} | tee -a debug.log
# Upload log file as an artifact
- name: Upload debug log file as artifact
uses: actions/upload-artifact@v3
with:
name: debug.log
path: debug.log
Print container info
The software container is spun up, loads the requirements, and then spins down after use. This section prints relevant information about the software container.
Network test
This tests the ability for the Actions container to communicate with the outside world via simple HTTP request.
Print current workflow user
Each action workflow runs as the user who triggered the workflow. This step will print the name of the user.
List files in repo
A simple directory search in the root folder of the repository.
List all environmental variables
Our Actions servers run on Ubuntu Linux (Debian). This section lists relevant information about the Linux OS that is running the Action container.
Run .allspice/utils/hello-world.py
This tests the Actions container ability to run a python command. This tests if python is set up correctly.
Test AllSpice API with py-allspice
This step tests the Action container AllSpice API key, as well as test if the server is working. The step returns the software version and the user making the API request.
If you need help understanding the debug log, please reach out to us at support@allspice.io
Actions documentation home