Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/build_external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:

build-chainlink:
needs: init
environment: integration
environment:
name: integration
deployment: false
Comment thread
kalverra marked this conversation as resolved.
permissions:
contents: read
id-token: write
Expand Down Expand Up @@ -76,7 +78,9 @@ jobs:

solana-build-relay:
needs: init
environment: integration
environment:
name: integration
deployment: false
permissions:
id-token: write
contents: read
Expand Down Expand Up @@ -115,7 +119,9 @@ jobs:

starknet-build-relay:
needs: init
environment: integration
environment:
name: integration
deployment: false
permissions:
id-token: write
contents: read
Expand Down
29 changes: 15 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ on:
type: choice
# Keep this up-to-date with the modules in the repository.
options:
- '.'
- 'keystore'
- 'observability-lib'
- 'pkg/values'
- 'pkg/workflows/sdk/v2/pb'
- 'pkg/chipingress'
- 'pkg/monitoring'
- "."
- "keystore"
- "observability-lib"
- "pkg/values"
- "pkg/workflows/sdk/v2/pb"
- "pkg/chipingress"
- "pkg/monitoring"
Comment thread
kalverra marked this conversation as resolved.

tag-prefix-override:
# Tags for go modules have some formatting requirements.
Expand All @@ -84,7 +84,7 @@ on:
head-ref-override:
# This overrides/forces the tag to point to something other than the HEAD of the branch the workflow is running on.
# This is only needed if the commit to be released is not the HEAD of the branch.
description: 'HEAD REF (override) - the ref/sha the new release/tag will reference. Defaults to the HEAD of the current branch.'
description: "HEAD REF (override) - the ref/sha the new release/tag will reference. Defaults to the HEAD of the current branch."
required: false
# default: ${{ github.ref_name }} - not possible here
type: string
Expand All @@ -93,12 +93,12 @@ on:
# Normally, the workflow determines the latest version/release by comparing the git tags matching the desired format (see tag-prefix-override).
# This overrides the latest release/version to be a specific ref. The computed API diff will be between this ref and the head ref (or release-ref-override if specified).
# If this is set then version-override is required, as overriding the base ref breaks the normal version recommendation heuristic.
description: 'BASE REF (override) - The most recent release/version/ref to compare against. Defaults to the latest (semver) tag with the associated tag prefix. version-override is required if this is set.'
description: "BASE REF (override) - The most recent release/version/ref to compare against. Defaults to the latest (semver) tag with the associated tag prefix. version-override is required if this is set."
required: false
type: string

dry-run:
description: 'DRY RUN - Run everything, except for release creation.'
description: "DRY RUN - Run everything, except for release creation."
required: true
type: boolean
default: false
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:

release:
name: Version and Draft Release ${{ inputs.dry-run && '(dry-run)' || '' }}
needs: [ process-inputs, approval-gate ]
needs: [process-inputs, approval-gate]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -344,14 +344,15 @@ jobs:

gh release create "${release_args[@]}"


# Used to enforce approvals before kicking off the rest of the jobs.
approval-gate:
name: Approval Gate ${{ inputs.dry-run && '(dry-run bypass)' || '' }}
needs: [ review-context, process-inputs ]
needs: [review-context, process-inputs]
runs-on: ubuntu-latest
# Only require approval gate if not a dry-run
environment: ${{ !inputs.dry-run && 'approval-gate-foundations' || '' }}
environment:
name: ${{ !inputs.dry-run && 'approval-gate-foundations' || '' }}
deployment: false
Comment thread
kalverra marked this conversation as resolved.
steps:
- name: Exit successfully
run: exit 0
Expand Down
35 changes: 15 additions & 20 deletions pkg/sqlutil/sqltest/sqltest.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/google/uuid"
"github.com/jmoiron/sqlx"
"github.com/lib/pq"
"github.com/scylladb/go-reflectx"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -57,35 +58,28 @@ func SkipInMemory(t *testing.T) {
// CreateOrReplace creates a new database with the given name (optionally from template), and schedules it to be dropped
// after test completion.
func CreateOrReplace(t testing.TB, u url.URL, dbName string, template string) url.URL {
if u.Path == "" {
t.Fatal("path missing from database URL")
}
require.NotEmpty(t, u.Path, "path missing from database URL")
require.LessOrEqual(t, len(dbName), 63, "dbName %v too long (%d), max is 63 bytes", dbName, len(dbName))

if l := len(dbName); l > 63 {
t.Fatalf("dbName %v too long (%d), max is 63 bytes", dbName, l)
}
// Cannot drop test database if we are connected to it, so we must connect
// to a different one. 'postgres' should be present on all postgres installations
u.Path = "/postgres"
db, err := sql.Open(pg.DriverPostgres, u.String())
if err != nil {
t.Fatalf("in order to drop the test database, we need to connect to a separate database"+
" called 'postgres'. But we are unable to open 'postgres' database: %+v\n", err)
}
require.NoError(t, err, "in order to drop the test database, we need to connect to a separate database"+
" called 'postgres'. But we are unable to open 'postgres' database")
defer db.Close()

_, err = db.Exec(fmt.Sprintf("DROP DATABASE IF EXISTS %s", dbName))
if err != nil {
t.Fatalf("unable to drop postgres migrations test database: %v", err)
}
quotedName := pq.QuoteIdentifier(dbName)
// WITH (FORCE) requires PostgreSQL 13+; terminates backends and avoids "being accessed by other users".
_, err = db.Exec(fmt.Sprintf("DROP DATABASE IF EXISTS %s WITH (FORCE)", quotedName))
require.NoError(t, err, "unable to drop postgres migrations test database")
if template != "" {
_, err = db.Exec(fmt.Sprintf("CREATE DATABASE %s WITH TEMPLATE %s", dbName, template))
quotedTemplate := pq.QuoteIdentifier(template)
_, err = db.Exec(fmt.Sprintf("CREATE DATABASE %s WITH TEMPLATE %s", quotedName, quotedTemplate))
} else {
_, err = db.Exec(fmt.Sprintf("CREATE DATABASE %s", dbName))
}
if err != nil {
t.Fatalf("unable to create postgres test database with name '%s': %v", dbName, err)
_, err = db.Exec(fmt.Sprintf("CREATE DATABASE %s", quotedName))
}
require.NoError(t, err, "unable to create postgres test database with name '%s'", dbName)
u.Path = fmt.Sprintf("/%s", dbName)
// simple best effort; some tests seem to hold a db connection and race with this drop
t.Cleanup(func() {
Expand Down Expand Up @@ -120,7 +114,8 @@ func drop(dbURL url.URL) error {
}
defer db.Close()

_, err = db.Exec(fmt.Sprintf("DROP DATABASE IF EXISTS %s", dbname))
quoted := pq.QuoteIdentifier(dbname)
_, err = db.Exec(fmt.Sprintf("DROP DATABASE IF EXISTS %s WITH (FORCE)", quoted))
if err != nil {
return fmt.Errorf("unable to drop postgres migrations test database: %v", err)
Comment thread
kalverra marked this conversation as resolved.
}
Expand Down
Loading