Skip to content

Commit

Permalink
Merge branch 'develop' into task/CAPPL-284/compute-beholder-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzaldysanchez authored Nov 15, 2024
2 parents ec81c23 + 827e003 commit 2224340
Show file tree
Hide file tree
Showing 43 changed files with 1,607 additions and 634 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-geckos-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#bugfix Update Log.Level and MaxSize configs description in the docs
8 changes: 4 additions & 4 deletions .github/actions/goreleaser-build-sign-publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ runs:
name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Setup docker buildx
uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 # v3.2.0
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.0
- name: Set up Go
uses: ./.github/actions/setup-go
with:
go-version-file: 'go.mod'
only-modules: 'true'
- name: Setup goreleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0
with:
distribution: goreleaser-pro
install-only: true
Expand All @@ -49,12 +49,12 @@ runs:
GORELEASER_KEY: ${{ inputs.goreleaser-key }}

- name: Login to docker registry
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ inputs.docker-registry }}

- name: Install syft
uses: anchore/sbom-action/download-syft@61119d458adab75f756bc0b9e4bde25725f86a7a # v0.17.2
uses: anchore/sbom-action/download-syft@fc46e51fd3cb168ffb36c6d1915723c47db58abb # v0.17.7

- name: Run goreleaser release
shell: bash
Expand Down
51 changes: 36 additions & 15 deletions .github/workflows/delete-caches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,48 @@ jobs:
# See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id
actions: write
contents: read
env:
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
steps:
- name: Check out code
uses: actions/[email protected]

- name: Cleanup Branch Caches
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge
- name: Setup gh-actions-cache extension
run: gh extension install actions/gh-actions-cache

echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
- name: Retrieve Trunk SHA
id: get-sha
run: |
SHA=$(gh pr view -R $REPO $PR_NUMBER --json mergeCommit --jq .mergeCommit.oid)
echo "sha=$SHA" >> $GITHUB_OUTPUT
## Setting this to not fail the workflow while deleting cache keys.
- name: Cleanup Caches
env:
TRUNK_SHA: ${{ steps.get-sha.outputs.sha }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
PR_BRANCH=refs/pull/$PR_NUMBER/merge
echo "Fetching list of cache keys for the PR branch ($PR_BRANCH)"
PR_CACHE_KEYS=$(gh actions-cache list -R $REPO -B $PR_BRANCH | cut -f 1)
echo "Deleting caches for PR branch ($PR_BRANCH)..."
for CACHE_KEY in $PR_CACHE_KEYS; do
gh actions-cache delete $CACHE_KEY -R $REPO -B $PR_BRANCH --confirm
done
if [[ -n "$TRUNK_SHA" ]]; then
echo "Found corresponding merge commit $TRUNK_SHA"
QUEUE_BRANCH="gh-readonly-queue/develop/pr-${PR_NUMBER}-${TRUNK_SHA}"
echo "Fetching list of cache keys for the merge queue branch ($QUEUE_BRANCH)"
QUEUE_CACHE_KEYS=$(gh actions-cache list -R $REPO -B $QUEUE_BRANCH | cut -f 1)
echo "Deleting caches for merge queue branch ($QUEUE_BRANCH)..."
for CACHE_KEY in $QUEUE_CACHE_KEYS; do
gh actions-cache delete $CACHE_KEY -R $REPO -B $QUEUE_BRANCH --confirm
done
fi
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion core/capabilities/compute/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ func (c *Compute) createFetcher() func(ctx context.Context, req *wasmpb.FetchReq
)

messageID := strings.Join([]string{
req.Metadata.WorkflowId,
req.Metadata.WorkflowExecutionId,
ghcapabilities.MethodComputeAction,
c.idGenerator(),
Expand Down
1 change: 0 additions & 1 deletion core/capabilities/compute/compute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ func TestComputeFetch(t *testing.T) {
th.connector.EXPECT().GatewayIDs().Return([]string{"gateway1", "gateway2"})

msgID := strings.Join([]string{
workflowID,
workflowExecutionID,
ghcapabilities.MethodComputeAction,
validRequestUUID,
Expand Down
58 changes: 52 additions & 6 deletions core/capabilities/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/values"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/remote"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/target"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/executable"
remotetypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/types"
"github.com/smartcontractkit/chainlink/v2/core/capabilities/streams"
"github.com/smartcontractkit/chainlink/v2/core/logger"
Expand Down Expand Up @@ -294,12 +294,26 @@ func (w *launcher) addRemoteCapabilities(ctx context.Context, myDON registrysync
return fmt.Errorf("failed to add trigger shim: %w", err)
}
case capabilities.CapabilityTypeAction:
w.lggr.Warn("no remote client configured for capability type action, skipping configuration")
newActionFn := func(info capabilities.CapabilityInfo) (capabilityService, error) {
client := executable.NewClient(
info,
myDON.DON,
w.dispatcher,
defaultTargetRequestTimeout,
w.lggr,
)
return client, nil
}

err := w.addToRegistryAndSetDispatcher(ctx, capability, remoteDON, newActionFn)
if err != nil {
return fmt.Errorf("failed to add action shim: %w", err)
}
case capabilities.CapabilityTypeConsensus:
w.lggr.Warn("no remote client configured for capability type consensus, skipping configuration")
case capabilities.CapabilityTypeTarget:
newTargetFn := func(info capabilities.CapabilityInfo) (capabilityService, error) {
client := target.NewClient(
client := executable.NewClient(
info,
myDON.DON,
w.dispatcher,
Expand Down Expand Up @@ -419,7 +433,34 @@ func (w *launcher) exposeCapabilities(ctx context.Context, myPeerID p2ptypes.Pee
// continue attempting other capabilities
}
case capabilities.CapabilityTypeAction:
w.lggr.Warn("no remote client configured for capability type action, skipping configuration")
newActionServer := func(cap capabilities.BaseCapability, info capabilities.CapabilityInfo) (remotetypes.ReceiverService, error) {
actionCapability, ok := (cap).(capabilities.ActionCapability)
if !ok {
return nil, errors.New("capability does not implement ActionCapability")
}

remoteConfig := &capabilities.RemoteExecutableConfig{}
if capabilityConfig.RemoteTargetConfig != nil {
remoteConfig.RequestHashExcludedAttributes = capabilityConfig.RemoteTargetConfig.RequestHashExcludedAttributes
}

return executable.NewServer(
capabilityConfig.RemoteExecutableConfig,
myPeerID,
actionCapability,
info,
don.DON,
idsToDONs,
w.dispatcher,
defaultTargetRequestTimeout,
w.lggr,
), nil
}

err = w.addReceiver(ctx, capability, don, newActionServer)
if err != nil {
return fmt.Errorf("failed to add action server-side receiver: %w", err)
}
case capabilities.CapabilityTypeConsensus:
w.lggr.Warn("no remote client configured for capability type consensus, skipping configuration")
case capabilities.CapabilityTypeTarget:
Expand All @@ -429,8 +470,13 @@ func (w *launcher) exposeCapabilities(ctx context.Context, myPeerID p2ptypes.Pee
return nil, errors.New("capability does not implement TargetCapability")
}

return target.NewServer(
capabilityConfig.RemoteTargetConfig,
remoteConfig := &capabilities.RemoteExecutableConfig{}
if capabilityConfig.RemoteTargetConfig != nil {
remoteConfig.RequestHashExcludedAttributes = capabilityConfig.RemoteTargetConfig.RequestHashExcludedAttributes
}

return executable.NewServer(
remoteConfig,
myPeerID,
targetCapability,
info,
Expand Down
7 changes: 4 additions & 3 deletions core/capabilities/launcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func TestLauncher(t *testing.T) {
)

dispatcher.On("SetReceiver", fullTriggerCapID, dID, mock.AnythingOfType("*remote.triggerPublisher")).Return(nil)
dispatcher.On("SetReceiver", fullTargetID, dID, mock.AnythingOfType("*target.server")).Return(nil)
dispatcher.On("SetReceiver", fullTargetID, dID, mock.AnythingOfType("*executable.server")).Return(nil)

err = launcher.Launch(ctx, state)
require.NoError(t, err)
Expand Down Expand Up @@ -603,7 +603,8 @@ func TestLauncher_RemoteTriggerModeAggregatorShim(t *testing.T) {
)

dispatcher.On("SetReceiver", fullTriggerCapID, capDonID, mock.AnythingOfType("*remote.triggerSubscriber")).Return(nil)
dispatcher.On("SetReceiver", fullTargetID, capDonID, mock.AnythingOfType("*target.client")).Return(nil)
dispatcher.On("SetReceiver", fullTargetID, capDonID, mock.AnythingOfType("*executable.client")).Return(nil)
dispatcher.On("Ready").Return(nil).Maybe()
awaitRegistrationMessageCh := make(chan struct{})
dispatcher.On("Send", mock.Anything, mock.Anything).Return(nil).Run(func(args mock.Arguments) {
select {
Expand Down Expand Up @@ -919,7 +920,7 @@ func TestLauncher_WiresUpClientsForPublicWorkflowDON(t *testing.T) {
)

dispatcher.On("SetReceiver", fullTriggerCapID, capDonID, mock.AnythingOfType("*remote.triggerSubscriber")).Return(nil)
dispatcher.On("SetReceiver", fullTargetID, capDonID, mock.AnythingOfType("*target.client")).Return(nil)
dispatcher.On("SetReceiver", fullTargetID, capDonID, mock.AnythingOfType("*executable.client")).Return(nil)

err = launcher.Launch(ctx, state)
require.NoError(t, err)
Expand Down
Loading

0 comments on commit 2224340

Please sign in to comment.