-
Notifications
You must be signed in to change notification settings - Fork 115
feat: rie private to public automation initial merge (#172) #174
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
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,8 @@ on: | |
| branches: | ||
| - develop | ||
| - main | ||
|
|
||
| merge_group: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
|
|
||
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 |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: Validate PR Branch into Main | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| validate-pr-branch: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check source branch | ||
| run: | | ||
| SOURCE_BRANCH="${{ github.head_ref }}" | ||
| if [[ "$SOURCE_BRANCH" != "develop" ]]; then | ||
| echo "Error: Only pull requests from develop branch are allowed into main" | ||
| echo "Current source branch ($SOURCE_BRANCH)." | ||
| exit 1 | ||
| fi | ||
| echo "Source branch is develop - merge allowed" | ||
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
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
97 changes: 97 additions & 0 deletions
97
internal/lambda-managed-instances/aws-lambda-rie/internal/telemetry/README.md
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 |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # RIE Telemetry Package | ||
|
|
||
| The RIE (Runtime Interface Emulator) telemetry package provides Telemetry API. | ||
|
|
||
| ## Architecture Overview | ||
|
|
||
| ``` | ||
| ┌─────────────────┐ ┌─────────────────┐ ┌──────────────────┐ | ||
| │ EventsAPI │ │ LogsEgress │ │ SubscriptionAPI │ | ||
| │ │ │ │ │ │ | ||
| │ • Platform │ │ • Runtime logs │ │ • Subscription │ | ||
| │ events │ │ • Extension │ │ management │ | ||
| │ • Lifecycle │ │ logs │ │ • Schema │ | ||
| │ events │ │ • Log capture │ │ validation │ | ||
| └─────────┬───────┘ └─────────┬───────┘ └──────────┬───────┘ | ||
| │ │ │ | ||
| └──────────────┬───────────────────────────────┘ | ||
| │ | ||
| ┌────▼────┐ | ||
| │ Relay │ | ||
| │ │ | ||
| │ Event │ | ||
| │ Broker │ | ||
| └────┬────┘ | ||
| │ | ||
| ┌──────────────┼──────────────┐ | ||
| │ │ │ | ||
| ┌─────▼─────┐ ┌─────▼─────┐ ┌─────▼─────┐ | ||
| │Subscriber │ │Subscriber │ │Subscriber │ | ||
| │ A │ │ B │ │ C │ | ||
| └─────┬─────┘ └─────┬─────┘ └─────┬─────┘ | ||
| │ │ │ | ||
| ┌─────▼─────┐ ┌─────▼─────┐ ┌─────▼─────┐ | ||
| │TCP Client │ │HTTP Client│ │TCP Client │ | ||
| └───────────┘ └───────────┘ └───────────┘ | ||
| ``` | ||
|
|
||
| ## Core Components | ||
|
|
||
| ### 1. EventsAPI (`events_api.go`) | ||
| **Responsibility**: Platform event generation and distribution | ||
|
|
||
| The EventsAPI serves as the primary interface for generating and broadcasting AWS Lambda platform events. It implements the `EventsAPI` interface and handles various lifecycle events including initialization, invocation, and error reporting. | ||
|
|
||
| ### 2. LogsEgress (`logs_egress.go`) | ||
| **Responsibility**: Log capture and forwarding | ||
|
|
||
| The LogsEgress component implements the `StdLogsEgressAPI` interface to capture stdout/stderr from both runtime and extensions, forwarding them to telemetry subscribers while maintaining original console output. | ||
|
|
||
| ### 3. Relay (`relay.go`) | ||
| **Responsibility**: Event broadcasting and subscriber management | ||
|
|
||
| The Relay acts as a central event broker, managing subscribers and broadcasting events to all registered telemetry consumers. | ||
|
|
||
| ### 4. SubscriptionAPI (`subscription_api.go`) | ||
| **Responsibility**: Subscription management and validation | ||
|
|
||
| The SubscriptionAPI handles telemetry subscription requests, validates them against JSON schemas, and manages the subscription lifecycle. | ||
|
|
||
| ## Internal Components | ||
|
|
||
| ### 1. Subscriber (`internal/subscriber.go`) | ||
| **Responsibility**: Event batching and delivery | ||
|
|
||
| Each subscriber represents a telemetry consumer and manages efficient event delivery through batching and asynchronous processing. | ||
|
|
||
| ### 2. Client (`internal/client.go`) | ||
| **Responsibility**: Protocol-specific event delivery | ||
|
|
||
| The client abstraction provides protocol-specific implementations for delivering events to telemetry consumers. | ||
|
|
||
| ### 3. Batch (`internal/batch.go`) | ||
| **Responsibility**: Event collection and timing | ||
|
|
||
| The batch component manages collections of events with size and time-based flushing logic. | ||
|
|
||
| ### 4. Types (`internal/types.go`) | ||
| **Responsibility**: Type definitions and constants | ||
|
|
||
| Centralized type definitions for protocols, event categories, and configuration structures. | ||
|
|
||
| ## Event Flow | ||
|
|
||
| ### 1. Subscription Flow | ||
| ``` | ||
| Extension/Agent → SubscriptionAPI → Schema Validation → Subscriber Creation → Relay Registration | ||
| ``` | ||
|
|
||
| ### 2. Event Flow | ||
| ``` | ||
| Event Source → EventsAPI → Relay → Subscribers → Batching → Client | ||
| ``` | ||
|
|
||
| ### 3. Log Flow | ||
| ``` | ||
| Runtime/Extension → LogsEgress → Console Output + Relay → Subscribers → Batching → Client | ||
| ``` |
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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package main | ||
|
|
||
| import ( | ||
| "github.com/aws/aws-lambda-runtime-interface-emulator/internal/lambda-managed-instances/aws-lambda-rie/run" | ||
| ) | ||
|
|
||
| func main() { | ||
| run.Run() | ||
| } |
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
39 changes: 39 additions & 0 deletions
39
internal/lambda-managed-instances/interop/mock_reserve_idle_runtime_request.go
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 |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package interop | ||
|
|
||
| import mock "github.com/stretchr/testify/mock" | ||
|
|
||
| type MockReserveIdleRuntimeRequest struct { | ||
| mock.Mock | ||
| } | ||
|
|
||
| func (_m *MockReserveIdleRuntimeRequest) InvokeID() string { | ||
| ret := _m.Called() | ||
|
|
||
| if len(ret) == 0 { | ||
| panic("no return value specified for InvokeID") | ||
| } | ||
|
|
||
| var r0 string | ||
| if rf, ok := ret.Get(0).(func() string); ok { | ||
| r0 = rf() | ||
| } else { | ||
| r0 = ret.Get(0).(string) | ||
| } | ||
|
|
||
| return r0 | ||
| } | ||
|
|
||
| func NewMockReserveIdleRuntimeRequest(t interface { | ||
| mock.TestingT | ||
| Cleanup(func()) | ||
| }) *MockReserveIdleRuntimeRequest { | ||
| mock := &MockReserveIdleRuntimeRequest{} | ||
| mock.Mock.Test(t) | ||
|
|
||
| t.Cleanup(func() { mock.AssertExpectations(t) }) | ||
|
|
||
| return mock | ||
| } |
26 changes: 26 additions & 0 deletions
26
internal/lambda-managed-instances/interop/mock_reserve_idle_runtime_response.go
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 |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package interop | ||
|
|
||
| import mock "github.com/stretchr/testify/mock" | ||
|
|
||
| type MockReserveIdleRuntimeResponse struct { | ||
| mock.Mock | ||
| } | ||
|
|
||
| func (_m *MockReserveIdleRuntimeResponse) reserveIdleRuntimeResponse() { | ||
| _m.Called() | ||
| } | ||
|
|
||
| func NewMockReserveIdleRuntimeResponse(t interface { | ||
| mock.TestingT | ||
| Cleanup(func()) | ||
| }) *MockReserveIdleRuntimeResponse { | ||
| mock := &MockReserveIdleRuntimeResponse{} | ||
| mock.Mock.Test(t) | ||
|
|
||
| t.Cleanup(func() { mock.AssertExpectations(t) }) | ||
|
|
||
| return mock | ||
| } |
Oops, something went wrong.
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.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 6 days ago
In general, this problem is fixed by explicitly defining a
permissions:block for the workflow or for individual jobs, granting only the minimal scopes required. For a job that only reads context information (likegithub.head_ref) and doesn’t interact with repository contents, PRs, or issues, the least‑privilege configuration is to setcontents: readat the workflow or job level (or evenpermissions: {}if no GitHub API access is needed, butcontents: readis a common safe baseline).For this specific file, the simplest non‑breaking fix is to add a root‑level
permissions:block that applies to all jobs. The workflow only reads metadata and performs shell logic, so we can restrict the token to read‑only repository contents. Concretely, in.github/workflows/validate-branch-into-main.yaml, insert:between the
name:section and theon:block (e.g., after line 2), leaving all job and step definitions unchanged. No imports or additional methods are needed since this is just a YAML configuration change and does not affect the workflow’s behavior.