Skip to content

Commit

Permalink
Initial move of integration-tests/deployment to /deployment as a sepa…
Browse files Browse the repository at this point in the history
…rate module.

This updates the dependencies, and makes the integration-tests depend on both chainlink and the deployments package.

A few things to fix.  The go.mod entry for deployments is off, because there is no version currently checked-in. It's overridden in a replace statement, but I'm not sure if there are any contexts in which that goes wrong. It just seems weird to keep an incorrect version number there.

Also:
  * Rename the node client to nodeclient, to disambiguate.
  * Move the various non-product elements into 'environment'
  • Loading branch information
cgruber committed Oct 26, 2024
1 parent 974def5 commit 441bd8a
Show file tree
Hide file tree
Showing 163 changed files with 2,803 additions and 729 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-mice-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Relocation of the deployment directory into a direct subdir of the root. #internal
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ tmp/
contracts/node_modules
examples/

deployment/
integration/
integration-scripts/
integration-tests/
Expand Down
6 changes: 3 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ core/scripts/gateway @smartcontractkit/dev-services

# Deployment tooling
# Initially the common structures owned by CCIP
/integration-tests/deployment @smartcontractkit/ccip @smartcontractkit/keystone
/integration-tests/deployment/ccip @smartcontractkit/ccip
/integration-tests/deployment/keystone @smartcontractkit/keystone
/deployment @smartcontractkit/ccip @smartcontractkit/keystone
/deployment/ccip @smartcontractkit/ccip
/deployment/keystone @smartcontractkit/keystone
# TODO: As more products add their deployment logic here, add the team as an owner

# CI/CD
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ jobs:
with:
filters: |
changes:
- 'integration-tests/deployment/**'
- 'deployment/**'
- '!integration-tests/**'
- 'integration-tests/deployment/**'
- name: Ignore Filter On Workflow Dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
id: ignore-filter
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.8
// Make sure we're working with the latest chainlink libs
replace github.com/smartcontractkit/chainlink/v2 => ../../

replace github.com/smartcontractkit/chainlink/integration-tests => ../../integration-tests
replace github.com/smartcontractkit/chainlink/deployment => ../../deployment

require (
github.com/docker/docker v27.3.1+incompatible
Expand All @@ -25,7 +25,7 @@ require (
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chainlink-automation v1.0.0-alpha.0.0.20241023165837-8c05ee9b97d5
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241025132045-cfad02139595
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-00010101000000-000000000000
github.com/smartcontractkit/chainlink/deployment v0.0.0-00010101000000-000000000000
github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000
github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12
github.com/spf13/cobra v1.8.1
Expand Down
12 changes: 6 additions & 6 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,8 @@ github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/b
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
Expand Down Expand Up @@ -881,8 +881,8 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky
github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU=
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae h1:O4SWKdcHVCvYqyDV+9CJA1fcDN2L11Bule0iFy3YlAI=
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down Expand Up @@ -1021,8 +1021,8 @@ github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6po
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE=
github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo=
github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/keystone/src/01_deploy_contracts_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/ethereum/go-ethereum/common"

helpers "github.com/smartcontractkit/chainlink/core/scripts/common"
ksdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone"
ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability"
)
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/keystone/src/88_gen_jobspecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"

helpers "github.com/smartcontractkit/chainlink/core/scripts/common"
ksdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone"
ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone"
)

type spec []string
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/keystone/src/88_gen_ocr3_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package src

import (
helpers "github.com/smartcontractkit/chainlink/core/scripts/common"
ksdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone"
ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone"
)

func mustReadConfig(fileName string) (output ksdeploy.TopLevelConfigSource) {
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/keystone/src/99_fetch_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/urfave/cli"

helpers "github.com/smartcontractkit/chainlink/core/scripts/common"
ksdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/keystone"
ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone"
ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big"
"github.com/smartcontractkit/chainlink/v2/core/cmd"
"github.com/smartcontractkit/chainlink/v2/core/web/presenters"
Expand Down
81 changes: 81 additions & 0 deletions deployment/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
run:
timeout: 15m
linters:
enable:
- exhaustive
- exportloopref
- revive
- goimports
- gosec
- misspell
- rowserrcheck
- errorlint
linters-settings:
exhaustive:
default-signifies-exhaustive: true
goimports:
local-prefixes: github.com/smartcontractkit/chainlink
golint:
min-confidence: 0.999
gosec:
excludes:
- G101
govet:
enable:
- shadow
revive:
confidence: 0.8
rules:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: if-return
- name: increment-decrement
# - name: var-naming // doesn't work with some generated names
- name: var-declaration
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
#- name: unused-parameter
- name: unreachable-code
- name: redefines-builtin-id
- name: waitgroup-by-value
- name: unconditional-recursion
- name: struct-tag
- name: string-format
- name: string-of-int
- name: range-val-address
- name: range-val-in-closure
- name: modifies-value-receiver
- name: modifies-parameter
- name: identical-branches
- name: get-return
# - name: flag-parameter // probably one we should work on doing better at in the future
# - name: early-return // probably one we should work on doing better at in the future
- name: defer
- name: constant-logical-expr
- name: confusing-naming
- name: confusing-results
- name: bool-literal-in-expr
- name: atomic
issues:
exclude-rules:
- path: memory/(.+)\.go
linters:
- revive
- text: "^G404: Use of weak random number generator"
linters:
- gosec
- linters:
- govet
text: "declaration of \"err\" shadows"
61 changes: 29 additions & 32 deletions integration-tests/deployment/README.md → deployment/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
### Overview
The deployment package in the integration-tests Go module serves
as a product agnostic set of environment abstractions used
to deploy and configure products including both on/offchain
dependencies. The environment abstractions allow for
complex and critical deployment/configuration logic to be tested
against ephemeral environments and then exposed for use in persistent
environments like testnet/mainnet.
## Overview
The deployment Go module serves as a product agnostic set of environment
abstractions used to deploy and configure products including both on/offchain
dependencies. The environment abstractions allow for complex and critical
deployment/configuration logic to be tested against ephemeral environments
and then exposed for use in persistent environments like testnet/mainnet.

### Directory structure
## Directory structure

/deployment
- package name `deployment`
Expand All @@ -19,11 +17,6 @@ environments like testnet/mainnet.
- In-memory environment for fast integration testing
- EVM only

/deployment/devenv
- package name `devenv`
- Docker environment for higher fidelity testing
- Support non-EVMs (yet to be implemented)

/deployment/ccip
- package name `ccipdeployment`
- Files and tests per product deployment/configuration workflows
Expand All @@ -38,24 +31,28 @@ environments like testnet/mainnet.
- They should be go functions where the first argument is an
environment and the second argument is a config struct which can be unique to the
changeset. The return value should be a `deployment.ChangesetOutput` and an error.
```Go
do_something.go
func DoSomethingChangeSet(env deployment.Environment, c ccipdeployment.Config) (deployment.ChangesetOutput, error)
{
// Deploy contracts, generate MCMS proposals, generate
// job specs according to contracts etc.
return deployment.ChangesetOutput{}, nil
}
do_something_test.go
func TestDoSomething(t *testing.T)
{
// Set up memory env
// DoSomethingChangeSet function
// Take the artifacts from ChangeSet output
// Apply them to the memory env
// Send traffic, run assertions etc.
}
```

- `do_something.go`
```Go
func DoSomethingChangeSet(env deployment.Environment, c ccipdeployment.Config) (deployment.ChangesetOutput, error)
{
// Deploy contracts, generate MCMS proposals, generate
// job specs according to contracts etc.
return deployment.ChangesetOutput{}, nil
}
```

- `do_something_test.go`
```Go
func TestDoSomething(t *testing.T)
{
// Set up memory env
// DoSomethingChangeSet function
// Take the artifacts from ChangeSet output
// Apply them to the memory env
// Send traffic, run assertions etc.
}
```
- Changesets are exposed and applied via a different repo.

/deployment/llo
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/ethereum/go-ethereum/common"

"github.com/smartcontractkit/chainlink/integration-tests/deployment"
"github.com/smartcontractkit/chainlink/deployment"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp"

"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext"

"github.com/smartcontractkit/chainlink/integration-tests/deployment"
"github.com/smartcontractkit/chainlink/deployment"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp"
"github.com/smartcontractkit/chainlink/v2/core/logger"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/mcms"
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock"

"github.com/smartcontractkit/chainlink/integration-tests/deployment"
ccdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip"
"github.com/smartcontractkit/chainlink/deployment"
ccdeploy "github.com/smartcontractkit/chainlink/deployment/ccip"
cctypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/ccip_home"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import (
cciptypes "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3"
"github.com/smartcontractkit/chainlink-ccip/pluginconfig"

"github.com/smartcontractkit/chainlink/integration-tests/deployment"
"github.com/smartcontractkit/chainlink/deployment"

"github.com/stretchr/testify/require"

jobv1 "github.com/smartcontractkit/chainlink-protos/job-distributor/v1/job"

ccdeploy "github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip"
ccdeploy "github.com/smartcontractkit/chainlink/deployment/ccip"

"github.com/smartcontractkit/chainlink/v2/core/logger"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import (
"fmt"
"math/big"

ccipdeployment "github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip"
ccipdeployment "github.com/smartcontractkit/chainlink/deployment/ccip"

"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types"

"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/mcms"
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock"

"github.com/smartcontractkit/chainlink/integration-tests/deployment"
"github.com/smartcontractkit/chainlink/deployment"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/onramp"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

ccipdeployment "github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip"
ccipdeployment "github.com/smartcontractkit/chainlink/deployment/ccip"

"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types"

Expand All @@ -19,7 +19,7 @@ import (

"github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext"

"github.com/smartcontractkit/chainlink/integration-tests/deployment"
"github.com/smartcontractkit/chainlink/deployment"

"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package changeset
import (
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock"

"github.com/smartcontractkit/chainlink/integration-tests/deployment"
ccipdeployment "github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip"
"github.com/smartcontractkit/chainlink/deployment"
ccipdeployment "github.com/smartcontractkit/chainlink/deployment/ccip"
)

// Separated changset because cap reg is an env var for CL nodes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package changeset
import (
"github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock"

"github.com/smartcontractkit/chainlink/integration-tests/deployment"
"github.com/smartcontractkit/chainlink/deployment"

ccipdeployment "github.com/smartcontractkit/chainlink/integration-tests/deployment/ccip"
ccipdeployment "github.com/smartcontractkit/chainlink/deployment/ccip"
)

// TEST_LOCATION: integration-tests/ccip-tests/deployment/initial_deploy_test.go

// We expect the change set input to be unique per change set.
// TODO: Maybe there's a generics approach here?
// Note if the change set is a deployment and it fails we have 2 options:
Expand Down
Loading

0 comments on commit 441bd8a

Please sign in to comment.