Skip to content

Commit

Permalink
chore: adding better example
Browse files Browse the repository at this point in the history
  • Loading branch information
florianow committed Nov 8, 2024
1 parent 569a80c commit bbcb5f8
Showing 1 changed file with 29 additions and 30 deletions.
59 changes: 29 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# actions-send-status

This GitHub Action helps you send the status of a step to the meshcloud API.
This GitHub Action helps you send the status back to your buildinbblock-run in meshStack.

Before using this action, set up authentication to Meshstack with the [meshcloud/actions-register-source](https://github.com/meshcloud/actions-register-source) action. This action logs in to Meshstack and registers the source of the run.

## Overview


The meshStack Building Block pipeline allows you to automate and manage complex workflows by defining a series of steps that need to be executed. Each Building Block Run represents an instance of such a workflow. This GitHub Action helps you send the status of a step back to the registered source in the meshStack Building Block pipeline.

In order to return updates for a run to meshStack, you first need to register one or multiple steps and their resources of your run execution. It is up to you how many or how you organize your steps. You can, however, also just send step results back and the registration takes place on the fly. But in order to have a consistent display and ordering of steps, it is highly advised to pre-register steps and sources.
Expand Down Expand Up @@ -34,44 +37,40 @@ Whenever a run was successful but meshStack did not receive a success for one or

Besides a status, meshStack can also show custom user messages consuming the service and operator messages to the provider of the pipline run inside of meshStack. This can be used to provide more detailed information about the current state of the run.

## GitHub Action: Send Status

### name: 'Send Status'
### description: 'Sends the status of a step to the meshcloud API'

### inputs:
- `base_url`: (required) The base URL for the API
- `bb_run_uuid`: (required) The Building Block Run UUID
- `step_id`: (required) The ID of the step
- `status`: (required) The status of the step (SUCCEEDED or FAILED)
- `user_message`: (optional) The user message for a failed step
- `system_message`: (optional) The system message for a failed step
- `token`: (required) The API token for authentication
- `is_final`: (optional) Indicates if this is the final status report (default: 'false')
- `summary`: (optional) The summary message for the final status report

## Example Usage

```yaml
name: Send Status to meshcloud API

on: [push]

jobs:
send-status:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Send Status
uses: ./ # Uses an action in the root directory
with:
base_url: 'https://mesh-backend-url'
bb_run_uuid: 'b3116611-e08b-4b00-91c5-10365b25a6ef'
step_id: 'step1'
status: 'SUCCEEDED'
token: ${{ secrets.API_TOKEN }}
is_final: 'true'
summary: 'A summary of the run.'
- name: Setup meshStack bbrun
id: setup-meshstack-auth
uses: meshcloud/actions-register-source@main
with:
client_id: ${{ vars.BUILDINGBLOCK_API_CLIENT_ID }}
key_secret: ${{ secrets.BUILDINGBLOCK_API_KEY_SECRET }}
steps: |
[
{ "id": "terraform-validate", "displayName": "terraform validate" },
{ "id": "terraform-plan", "displayName": "terraform plan" },
{ "id": "terraform-apply", "displayName": "terraform apply" }
]
- name: Terragrunt validate
id: terraform-validate
run: terraform validate

- name: Send status on validate
if: ${{ steps.terraform-validate.outcome == 'success' }}
uses: meshcloud/actions-send-status@main
with:
step_id: "terraform-validate"
status: ${{ steps.terraform-validate.outcome == 'success' && 'SUCCEEDED' || 'FAILED' }}
user_message: ${{ steps.terraform-validate.outcome == 'success' && 'Successful plan Terraform configuration.' || 'Failed to plan Terraform configuration.' }}
system_message: ${{ steps.terraform-validate.outcome == 'success' && 'Successful plan Terraform configuration.' || 'Failed to plan Terraform configuration.' }}
```

0 comments on commit bbcb5f8

Please sign in to comment.