diff --git a/.circleci/config.yml b/.circleci/config.yml index 50416822..37676ffe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,41 @@ setup: true orbs: path-filtering: circleci/path-filtering@1.0.0 +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: diff --git a/.circleci/continue_config.yml b/.circleci/continue_config.yml index 26e01888..b976dddc 100644 --- a/.circleci/continue_config.yml +++ b/.circleci/continue_config.yml @@ -2,6 +2,15 @@ version: 2.1 orbs: gcp-cli: circleci/gcp-cli@2.4.1 + utils: ethereum-optimism/circleci-utils@0.0.12 + +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: @@ -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: @@ -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: @@ -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:" @@ -162,8 +218,7 @@ jobs: description: Docker repo type: string default: "oplabs-tools-artifacts/images" - machine: - image: <> + executor: default steps: - checkout - run: @@ -209,8 +264,7 @@ jobs: description: Docker repo type: string default: "oplabs-tools-artifacts/images" - machine: - image: <> + executor: default steps: - attach_workspace: at: /tmp/docker_images @@ -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: | @@ -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: | @@ -387,6 +435,39 @@ jobs: name: Run goreleaser command: | goreleaser release --clean -f ./<>/<> + + 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: @@ -607,3 +688,16 @@ workflows: 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 >> \ No newline at end of file diff --git a/README.md b/README.md index eceef6a7..a966bbb4 100644 --- a/README.md +++ b/README.md @@ -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). \ No newline at end of file +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 +``` \ No newline at end of file diff --git a/mise.toml b/mise.toml new file mode 100644 index 00000000..105770c2 --- /dev/null +++ b/mise.toml @@ -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 \ No newline at end of file diff --git a/ops/tag-service/mise.toml b/ops/tag-service/mise.toml new file mode 100644 index 00000000..88650e22 --- /dev/null +++ b/ops/tag-service/mise.toml @@ -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 \ No newline at end of file