Debugging Actions
    • PDF

    Debugging Actions

    • PDF

    Article Summary

    ""

    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

        image.png

        Scroll down to search (ctrl+f) for "Actions"

        Ensure Enable Repository Actions is checked

        image.png

        enable actions in your repository.gif

        Actions 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: ${{ github.actor }}"
              } | tee -a debug.log          
    
          - name: "[πŸ”Ž->πŸ“‚] List files in repo πŸ”Ž"
            run: |
              {
              ls -la .
              ls -la ${{ github.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: ${github.server_url} and ${github.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 ${{ github.server_url }}  --allspice_token ${{ github.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

    Actions Documentation Home


    Was this article helpful?

    What's Next