Skip to content

chore: Migrate tag-service workflow to CircleCI #126

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
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
35 changes: 35 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,41 @@ setup: true
orbs:
path-filtering: circleci/[email protected]

parameters:
#
#
# These parameters are passed down to the continuation pipeline
# Thet are defined here so that the UI form for triggering pipelines
# is prepopulated and only allows for valid values to be set
#
#
# An explicit boolean parameter that triggers the tag-service pipeline
run-tag-service:
type: boolean
description: "Run the tag-service job. tag-service--bump and tag-service--service parameters also need to be specified"
default: false
# Controls the version bump for the tag-service job
#
# If left empty, the tag-service job will not run
tag-service--bump:
type: enum
description: "If left empty, the tag-service job will not run"
enum: ["", "major", "minor", "patch", "prerelease", "finalize-prerelease", "missing"]
default: ""
# Controls the affected service for the tag-service job
#
# If left empty, the tag-service job will not run
tag-service--service:
type: enum
description: "If left empty, the tag-service job will not run"
enum: ["", "op-signer", "op-ufm", "op-txproxy", "proxyd", "peer-mgmt-service"]
default: ""
# Toggle between prerelase and release for the tag-service job
tag-service--prerelease:
type: boolean
description: "Toggle between prerelase and release for the tag-service job"
default: false

workflows:
check-updated-files:
jobs:
Expand Down
134 changes: 114 additions & 20 deletions .circleci/continue_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ version: 2.1

orbs:
gcp-cli: circleci/[email protected]
utils: ethereum-optimism/[email protected]

executors:
default:
machine:
image: ubuntu-2204:2024.08.1
builder:
docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest

parameters:
run-build-op-conductor-mon:
Expand All @@ -28,11 +37,58 @@ parameters:
run-all:
type: boolean
default: false
vm-image:
#
#
# The following tags are defined more strictly in the parent pipeline
# so that when the pipeline is triggered manually, the user is forced
# to enter valid values and the UI parameter form is prepopulated.
#
#
run-tag-service:
type: boolean
default: false
tag-service--bump:
type: string
default: ubuntu-2204:current
default: ""
tag-service--service:
type: string
default: ""
tag-service--prerelease:
type: boolean
default: false

commands:
install-dependencies:
parameters:
module:
type: string
default: .
steps:
- run:
name: Install mise
command: curl https://mise.run | MISE_INSTALL_PATH=/home/circleci/bin/mise sh
working_directory: << parameters.module >>
- run:
name: Contents
command: ls -al
working_directory: << parameters.module >>
- run:
name: Activate mise
command: echo 'eval "$(mise activate bash)"' >> $BASH_ENV
working_directory: << parameters.module >>
- run:
name: Mise doctor
command: mise doctor
working_directory: << parameters.module >>
- run:
name: Mise config
command: mise config
working_directory: << parameters.module >>
- run:
name: Install mise dependencies
command: mise install --verbose
working_directory: << parameters.module >>

gcp-oidc-authenticate:
description: "Authenticate with GCP using a CircleCI OIDC token."
parameters:
Expand Down Expand Up @@ -77,8 +133,7 @@ commands:

jobs:
log-config-results:
docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest # only used to enable codecov.
executor: builder
environment:
CURRENT_TAG: << pipeline.git.tag >>
steps:
Expand All @@ -93,6 +148,7 @@ jobs:
echo "run-build-pms: << pipeline.parameters.run-build-pms >>"
echo "run-build-op-ufm: << pipeline.parameters.run-build-op-ufm >>"
echo "run-build-proxyd: << pipeline.parameters.run-build-proxyd >>"
echo "run-tag-service: << pipeline.parameters.run-tag-service >>"
echo "run-all: << pipeline.parameters.run-all >>"
echo ""
echo "Pipeline Trigger Information:"
Expand Down Expand Up @@ -162,8 +218,7 @@ jobs:
description: Docker repo
type: string
default: "oplabs-tools-artifacts/images"
machine:
image: <<pipeline.parameters.vm-image>>
executor: default
steps:
- checkout
- run:
Expand Down Expand Up @@ -209,8 +264,7 @@ jobs:
description: Docker repo
type: string
default: "oplabs-tools-artifacts/images"
machine:
image: <<pipeline.parameters.vm-image>>
executor: default
steps:
- attach_workspace:
at: /tmp/docker_images
Expand Down Expand Up @@ -290,10 +344,11 @@ jobs:
module:
description: Go Module Name
type: string
docker:
- image: cimg/go:1.23
executor: default
steps:
- checkout
- install-dependencies:
module: << parameters.module >>
- run:
name: run generate
command: |
Expand Down Expand Up @@ -361,24 +416,17 @@ jobs:
description: Goreleaser config file
default: .goreleaser.yaml
type: string
docker:
- image: us-docker.pkg.dev/oplabs-tools-artifacts/images/ci-builder:latest
executor: default
resource_class: large
steps:
- setup_remote_docker
- install-dependencies:
module: << parameters.module >>
- gcp-cli/install
- gcp-oidc-authenticate:
gcp_cred_config_file_path: /root/gcp_cred_config.json
oidc_token_file_path: /root/oidc_token.json
- checkout
- run:
name: Install goreleaser pro
command: |
mkdir -p /tmp/goreleaser
cd /tmp/goreleaser
curl -L -o goreleaser.tgz https://github.com/goreleaser/goreleaser-pro/releases/download/v2.4.3-pro/goreleaser-pro_Linux_x86_64.tar.gz
tar -xzvf goreleaser.tgz
mv goreleaser /usr/local/bin/goreleaser
- run:
name: Configure Docker
command: |
Expand All @@ -387,6 +435,39 @@ jobs:
name: Run goreleaser
command: |
goreleaser release --clean -f ./<<parameters.module>>/<<parameters.filename>>

tag-service:
executor: default
parameters:
bump:
type: string
service:
type: string
prerelease:
type: boolean
steps:
- checkout
- run:
name: Fetch tags
command: git fetch --tags origin --force
- install-dependencies:
module: ops/tag-service
- utils/get-github-access-token:
output-token-name: INPUT_GITHUB_TOKEN
# This conditional step runs the prerelease command
- when:
condition: << parameters.prerelease >>
steps:
- run:
name: Prerelease << parameters.bump >> bump of << parameters.service >>
command: ops/tag-service/tag-service.py --bump="<< parameters.bump >>" --service="<< parameters.service >>" --pre-release
# This conditional step runs the release command
- unless:
condition: << parameters.prerelease >>
steps:
- run:
name: Release << parameters.bump >> bump of << parameters.service >>
command: ops/tag-service/tag-service.py --bump="<< parameters.bump >>" --service="<< parameters.service >>"

workflows:
logging:
Expand Down Expand Up @@ -607,3 +688,16 @@ workflows:
module: <<matrix.module>>
context:
- oplabs-gcr-release
tag:
when:
and:
- << pipeline.parameters.run-tag-service >>
- << pipeline.parameters.tag-service--bump >>
- << pipeline.parameters.tag-service--service >>
jobs:
- tag-service:
context:
- circleci-repo-infra
bump: << pipeline.parameters.tag-service--bump >>
service: << pipeline.parameters.tag-service--service >>
prerelease: << pipeline.parameters.tag-service--prerelease >>
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,26 @@ This repository is an extension of the [Optimism monorepo](https://github.com/et

## Release Process

For the thoroughly defined process releasing services in this repository, please refer to [this document](./RELEASE.md).
For the thoroughly defined process releasing services in this repository, please refer to [this document](./RELEASE.md).

## Development

### Dependencies

#### Using `mise`

We use [`mise`](https://mise.jdx.dev/) as a dependency manager for these tools.
Once properly installed, `mise` will provide the correct versions for each tool. `mise` does not
replace any other installations of these binaries and will only serve these binaries when you are
working inside of the `optimism` directory.

##### Install `mise`

Install `mise` by following the instructions provided on the
[Getting Started page](https://mise.jdx.dev/getting-started.html#_1-install-mise-cli).

##### Install dependencies

```sh
mise install
```
12 changes: 12 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[tools]

# Core dependencies
go = "1.21"

# Go dependencies
"ubi:golangci/golangci-lint" = "v1.63.4"
"ubi:goreleaser/goreleaser-pro[exe=goreleaser]" = "v2.4.3-pro"

[settings]
# Needs to be enabled for hooks to work
experimental = true
13 changes: 13 additions & 0 deletions ops/tag-service/mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tools]

# Core dependencies
python = "3.10"

[hooks]
postinstall = [
'pip install -r requirements.txt'
]

[settings]
# Needs to be enabled for hooks to work
experimental = true