Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Initial Action #2

Merged
merged 65 commits into from
Jan 29, 2024
Merged

feat: Initial Action #2

merged 65 commits into from
Jan 29, 2024

Conversation

jsirianni
Copy link
Member

@jsirianni jsirianni commented Jan 23, 2024

Initial action has the following features

  • Apply destinations from a given file path
  • Apply configurations from a given file path
  • Write raw otel configurations back to the repo

The repo contains Ci configuration for testing against a bindplane instance (local docker).

  • Shellcheck for the script
  • Testing against 1.37 and 1.40 bindplane releases. This list can be expanded as needed.

Testing

I have an example repo here, but you should try it on your own.

You can test with the following steps

  1. Create a new bindplane op account within our dev or stage environments
  2. Create an API key
  3. Create one or more configurations with one or more destinations
  4. Create a new repo under your personal github, give it any name. You can delete it after.
  • Create repo actions secret BINDPLANE_REMOTE_URL with value https://<bindplane dev or stage>.com
  • Create repo actions secret BINDPLANE_SECRET_KEY
  1. Export the resources to "seed" your repo
bindplane get destination -o yaml --export > destinations.yaml
bindplane get configuration -o yaml --export > configurations.yaml
  1. Create your workflow file with the following contents
name: bindplane
on:
  push:
    branches:
      - main
permissions:
  contents: write
concurrency:
  group: ${{ github.head_ref || github.ref_name }}
  cancel-in-progress: false
jobs:
  bindplane:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

     # Pointing to the dev branch because main is not ready yet
      - uses: observIQ/bindplane-op-action@dev
        with:
          bindplane_remote_url: ${{ secrets.BINDPLANE_REMOTE_URL }}
          bindplane_api_key: ${{ secrets.BINDPLANE_SECRET_KEY }}
          target_branch: main
          destination_path: destination.yaml
          configuration_path: configuration.yaml
          enable_otel_config_write_back: true
          configuration_output_dir: otel/
          token: ${{ secrets.GITHUB_TOKEN }}
  1. Commit everything to your repo.

You should expect actions to kick off. You should also expect to see a new commit from the action containing your configurations at the directory otel/.

If you change your configurations / destinations, you should expect them to be applied. You should also expect to see a pending rollout in the ui.

edit: We added an enable_auto_rollout option. If you include an additional with param, enable_auto_rollout: true, you should expect the configuration to automatically rollout.

@jsirianni jsirianni marked this pull request as ready for review January 23, 2024 19:35
@jsirianni jsirianni requested a review from cpheps January 23, 2024 19:40
Comment on lines +31 to +32
bindplane get configuration -o yaml --export > configuration.yaml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the PR instructions it has plural of these file names destinations.yaml and configurations.yaml what do we want? It failed for me as I followed the PR instructions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you got it working. The path you export the initial resources too should match whatever you configure your action to point to, in your repo you have:

          destination_path: destination.yaml
          configuration_path: configuration.yaml

but you could have anything. My example repo has the following structure:

.
├── otel
│   ├── k8s-cluster.yaml
│   ├── k8s-gateway.yaml
│   └── k8s-node.yaml
├── README.md
└── resources
    ├── configurations
    │   └── resource.yaml
    └── destinations
        └── resource.yaml

Where resources/ is the top level directory for my destinations and configurations. The output dir is otel.

Copy link

@cpheps cpheps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a private repo here. The action ran
https://github.com/cpheps/bpop-actions/actions/runs/7640827115 but I did not see a commit. I haven't touched the repo since this ran so you can see what happened.

@jsirianni
Copy link
Member Author

I created a private repo here. The action ran https://github.com/cpheps/bpop-actions/actions/runs/7640827115 but I did not see a commit. I haven't touched the repo since this ran so you can see what happened.

This should be fixed now

@jsirianni jsirianni requested a review from cpheps January 26, 2024 17:02
Copy link

@cpheps cpheps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working great

* wip: auto rollout

* test against this branch

* add auto rollout to workflow

* print config apply output

* check rollout status

* check for pending rollout

* shellcheck: Fix loop logic

* install jq

* add enable_auto_rollout to readme

* revert this change, use external repo for testing this pr

* check for stable configs as well

* remove branch from ci, we will test using an external repo

* use case
@jsirianni jsirianni merged commit 8c1785e into main Jan 29, 2024
6 checks passed
@jsirianni jsirianni deleted the dev branch January 29, 2024 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants