Repository navigation
ci: simplify AWS beta bundle workflow and token refs #113
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,90 +1,87 @@ | ||
| # Managed OpenHound + AWS beta images (BED-9518) | ||
|
|
||
| Use **Push Bundled OpenHound + AWS Beta Image to ECR** to publish updated managed | ||
| OpenHound/AWS beta collector images. This workflow is **manual-only**: pushes, | ||
| merges, pull requests, and releases do not trigger it. | ||
|
|
||
| It uses the same repository-access rules, ECR variables, and AWS publishing | ||
| credentials as **Build image for ECR**. Repository writers can run it; it adds no | ||
| code-owner restriction, environment approval, or team-membership requirement. | ||
|
|
||
| ## Required configuration | ||
|
|
||
| Keep the existing `ECR_REGISTRY` and `ECR_REPOSITORY` repository variables and | ||
| `BHE_AWS_ACCESS_KEY_ID` / `BHE_AWS_SECRET_ACCESS_KEY` secrets. Bundled images go to | ||
| the same ECR location as regular OpenHound images. | ||
|
|
||
| The additional secret **`OPENHOUND_AWS_GITHUB_TOKEN`** needs **Contents: read** on | ||
| the internal `SpecterOps/openhound-aws` repository, with organization approval/SSO | ||
| authorization if required. The ordinary workflow `GITHUB_TOKEN` cannot normally | ||
| read that repository. The source token is mounted as a BuildKit secret, never | ||
| passed as a build argument or saved in an image layer. | ||
|
|
||
| ## Publish a beta image | ||
|
|
||
| Commit references for the workflow inputs: | ||
|
|
||
| - **`aws_commit`:** [Recent openhound-aws commits](https://github.com/SpecterOps/openhound-aws/commits/main/). | ||
| Open the desired commit and copy its **full 40-character SHA**, not the | ||
| abbreviated value shown in the history. Repository access is required. | ||
| - **`source_ref`:** [Recent OpenHound commits](https://github.com/SpecterOps/OpenHound/commits/main/). | ||
| Use the branch selector to view feature-branch history when needed. | ||
|
|
||
| 1. In GitHub Actions, select **Push Bundled OpenHound + AWS Beta Image to ECR**. | ||
| 2. Use the workflow from **`main`**. Set `source_ref` to `main`, or to the beta | ||
| branch/commit containing the managed functionality you want to build. | ||
| 3. Set `tag` to a development version such as `0.4.1.dev9346005`, without `v` or | ||
| `ecr-enterprise`. Use the existing numbering convention and coordinate versions | ||
| with other publishers to the shared repository. | ||
| 4. Set **`aws_commit`** to the full 40-character source commit SHA from | ||
| `SpecterOps/openhound-aws` that you want to bundle. This input is required and | ||
| has no default; branches, tags, and abbreviated SHAs are rejected by the build. | ||
| 5. Run the workflow. It builds the `enterprise` image for AMD64 and ARM64 and | ||
| publishes only this version tag: | ||
|
|
||
| ```text | ||
| ${ECR_REGISTRY}/${ECR_REPOSITORY}:ecr-enterprise0.4.1.dev9346005 | ||
| ``` | ||
|
|
||
| 6. Update the managed beta collector deployment through the infrastructure team's | ||
| existing process. Publishing an image does not update a running deployment. | ||
|
|
||
| The Dockerfile and preparation/smoke scripts come from the selected **workflow | ||
| revision**, independently of `source_ref`. This lets | ||
| the workflow on `main` build a feature branch that predates these bundle files. | ||
| The AWS source revision is selected separately through `aws_commit`. The selected | ||
| OpenHound source still needs to contain the desired managed runtime features. | ||
|
|
||
| After the workflow merges to `main`, it can also be started with the GitHub CLI. | ||
| Set `AWS_COMMIT_SHA` to the desired full AWS source commit SHA first: | ||
| # Bundled OpenHound + AWS beta images | ||
|
|
||
| Use **Push Bundled OpenHound + AWS Beta Image to ECR** to publish a bundled | ||
| OpenHound/AWS beta collector image. The workflow runs manually and uses the | ||
| configured GitHub App to access `SpecterOps/openhound-aws`. | ||
|
|
||
| ## Run in GitHub Actions | ||
|
|
||
| 1. Select **Push Bundled OpenHound + AWS Beta Image to ECR**, then **Run workflow**. | ||
| 2. Under **Use workflow from**, select the OpenHound branch to build: `main` or | ||
| the feature branch containing the changes you want. This selects both the | ||
| OpenHound source and the bundle build tooling; the branch must include this | ||
| version of the workflow. | ||
| 3. Set **`tag`** to a new development version such as `0.5.0.dev9346005`, without | ||
| `v` or `ecr-enterprise`. Coordinate versions with other publishers to the shared | ||
| ECR repository. | ||
| 4. Set **`aws_commit`** to the full **40-character SHA** of the AWS extension | ||
| revision to bundle. Copy it from the desired commit in | ||
| [openhound-aws history](https://github.com/SpecterOps/openhound-aws/commits/main/). | ||
| This is required; the build rejects branches, tags, and abbreviated SHAs. | ||
| 5. Leave **`verify_access_only`** unchecked and run the workflow. | ||
|
|
||
| ### Beta version convention | ||
|
|
||
| Use development versions to distinguish beta builds from stable releases. For | ||
| example, `0.5.0.dev9346005` consists of: | ||
|
|
||
| - `0.5.0`: the OpenHound base version. | ||
| - `.dev`: the Python development-release marker used for these beta builds. | ||
| - `9346`: the beta project's tracking identifier. | ||
| - `005`: the release counter, starting at `000`; `005` is the sixth beta image | ||
| in this sequence. | ||
|
|
||
| Increment the counter for each release and use a new version for each published | ||
| build. This is a project naming convention; Python interprets the entire | ||
| `9346005` suffix as one development-release number. | ||
|
|
||
| The workflow builds the `enterprise` image for AMD64 and ARM64 and publishes: | ||
|
|
||
| ```text | ||
| ${ECR_REGISTRY}/${ECR_REPOSITORY}:ecr-enterprise0.5.0.dev9346005 | ||
| ${ECR_REGISTRY}/${ECR_REPOSITORY}:candidate | ||
| ``` | ||
|
|
||
| Both tags point to the same multi-architecture image. Each successful publish | ||
| moves `candidate` to the newly published beta image. The version tag remains | ||
| available for that build. | ||
| The ECR repository must allow the `candidate` tag to be overwritten. | ||
|
|
||
| Publishing does not update a running deployment. See the deployment guidance | ||
| below. | ||
|
|
||
| To check GitHub App access without building or publishing, enable | ||
| **`verify_access_only`**. Supply the required `tag` and `aws_commit` inputs; this | ||
| mode only checks out the requested AWS revision. | ||
|
|
||
| ## Run with the GitHub CLI | ||
|
|
||
| Set `AWS_COMMIT_SHA` to the desired full AWS source commit SHA, then run: | ||
|
|
||
| ```sh | ||
| gh workflow run build-ecr-aws-beta-manual.yaml --ref main \ | ||
| -f tag=0.4.1.dev9346005 -f source_ref=main -f aws_commit="$AWS_COMMIT_SHA" | ||
| -f tag=0.5.0.dev9346005 -f aws_commit="$AWS_COMMIT_SHA" | ||
| ``` | ||
|
|
||
| ## Include newer AWS extension changes | ||
|
|
||
| Run the workflow with the desired **`aws_commit`** and a new development version. | ||
| Selecting a newer extension revision does not require editing files or merging a | ||
| SHA update to `main`. Each build fetches exactly the supplied commit instead of | ||
| automatically following the AWS repository's latest commit. Local Docker builds | ||
| must likewise pass `--build-arg OPENHOUND_AWS_COMMIT=<full-commit-sha>`. | ||
|
|
||
| When selecting a newer commit, consider compatibility with | ||
| `scripts/prepare_aws_bundle.py`. | ||
| The preparation script patches the temporary extension's OpenHound requirement | ||
| to the installed local version, raises its boto3 requirement to `>=1.43.90`, and | ||
| places `extension.yaml` inside the Python package. Changed upstream packaging may | ||
| require updating those patches. | ||
|
|
||
| The build preserves OpenHound's installed, locked dependencies while resolving | ||
| the extension's declared requirements. It runs `uv pip check` and an offline smoke | ||
| check inside the final nonroot image on each architecture. These checks verify | ||
| extension discovery, metadata, and native imports only when the bundle is | ||
| manually built. No extra automatic workflow test suite is added. | ||
|
|
||
| When bringing `main` into older beta branches, retain its standard | ||
| `build-ecr-manual.yaml` and `Dockerfile`, plus the separate bundle files. Replace | ||
| the old temporary in-place bundle modifications. Rebasing is not required just | ||
| to make the new workflow appear in Actions. | ||
| Replace `main` with the OpenHound branch to build. Add | ||
| `-f verify_access_only=true` for an access-only check. To include newer AWS | ||
| extension changes, run again with the desired SHA and a new development version. | ||
|
|
||
| Bundle preparation updates the AWS extension's OpenHound requirements to the | ||
| selected OpenHound build version, regardless of the original version pins. Other | ||
| requirements, including boto3, are preserved and resolved against the frozen | ||
| OpenHound build environment. Incompatible requirements fail the build before the | ||
| image tag is published to ECR; reconcile the dependency requirements before | ||
| retrying. | ||
|
|
||
| ## Deployment guidance | ||
|
|
||
| > [!WARNING] | ||
| > The linked guide includes examples specific to BHE. For OpenHound collectors, | ||
| > always explicitly pass `-p bhe-collector` to Commute commands. Verify the product | ||
| > and destination in the confirmation prompt before approving a deployment. | ||
|
|
||
| For managed deployments, authorized operators should follow the internal | ||
| [Commute documentation](https://specterops.atlassian.net/wiki/spaces/BE/pages/356679809/Commute) | ||
| and the infrastructure team's current collector release guidance for setup, | ||
| target selection, promotion, deployment, and rollback procedures. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.