From d9d4c542de10f5d3a711b7a45ffe450fd0666437 Mon Sep 17 00:00:00 2001 From: Martin Grigorov Date: Sat, 30 May 2026 09:42:00 +0300 Subject: [PATCH 01/12] chore: fix 'clippy::manual_option_zip' in tracing-error (#3553) ## Motivation CI `warnings` job (clippy) is failing with `error: manual implementation of "Option::zip"` for Rust 1.96.0. e.g. https://github.com/tokio-rs/tracing/actions/runs/25983660191/job/78456844423?pr=3534 ``` error: manual implementation of `Option::zip` --> tracing-error/src/backtrace.rs:208:41 | 208 | if let Some((file, line)) = metadata | _________________________________________^ 209 | | .file() 210 | | .and_then(|file| metadata.line().map(|line| (file, line))) | |__________________________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#manual_option_zip = note: `-D clippy::manual-option-zip` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::manual_option_zip)]` help: use | 208 ~ if let Some((file, line)) = metadata 209 + .file().zip(metadata.line()) ``` ## Solution Apply the suggestion by Clippy and format the code (cargo fmt --all). --- tracing-error/src/backtrace.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tracing-error/src/backtrace.rs b/tracing-error/src/backtrace.rs index a4311f8456..b1896f3c2f 100644 --- a/tracing-error/src/backtrace.rs +++ b/tracing-error/src/backtrace.rs @@ -205,10 +205,7 @@ impl fmt::Display for SpanTrace { try_bool!(write!(f, "\n with {}", fields), err); } - if let Some((file, line)) = metadata - .file() - .and_then(|file| metadata.line().map(|line| (file, line))) - { + if let Some((file, line)) = metadata.file().zip(metadata.line()) { try_bool!(write!(f, "\n at {}:{}", file, line), err); } @@ -240,11 +237,7 @@ impl fmt::Debug for SpanTrace { write!(f, ", fields: {:?}", self.fields)?; } - if let Some((file, line)) = self - .metadata - .file() - .and_then(|file| self.metadata.line().map(|line| (file, line))) - { + if let Some((file, line)) = self.metadata.file().zip(self.metadata.line()) { write!(f, ", file: {:?}, line: {:?}", file, line)?; } From b7087b3758c23f693542669250f4a6b44652da20 Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Fri, 29 May 2026 13:46:59 -0600 Subject: [PATCH 02/12] chore: publish 'tracing-error' crate from 'rigetti-main' branch to 'rigetti-cargo' registry --- .cargo/config.toml | 9 +++++++ .github/workflows/publish-tracing-error.yml | 27 +++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .cargo/config.toml create mode 100644 .github/workflows/publish-tracing-error.yml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000000..1a3e354f93 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,9 @@ +[registries.rigetti-cargo] +index = "sparse+https://rigetti-733799784722.d.codeartifact.us-west-2.amazonaws.com/cargo/rigetti-cargo/" +# Unlike internal repos, this does not include the `--profile` argument, which is not used by CI. +# This makes it less convenient to use locally, but it should only be used for *publishing*, +# never for donwloading dependencies. +credential-provider = ["cargo:token-from-stdout", "sh", "-c", "aws codeartifact get-authorization-token --domain rigetti --domain-owner 733799784722 --region us-west-2 --query authorizationToken --output text"] + +[registry] +default = "crates-io" diff --git a/.github/workflows/publish-tracing-error.yml b/.github/workflows/publish-tracing-error.yml new file mode 100644 index 0000000000..be0a4aeba6 --- /dev/null +++ b/.github/workflows/publish-tracing-error.yml @@ -0,0 +1,27 @@ +name: Publish tracing-error + +on: + push: + branches: + - rigetti-main + +jobs: + publish: + name: Publish tracing-error to rigetti-cargo + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v4 + + - uses: dtolnay/rust-toolchain@stable + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} + aws-region: us-west-2 + + - name: Publish tracing-error + run: cargo publish -p tracing-error --registry rigetti-cargo From 6125924fa33a1df763d2bff59ce1df4cdf9f21dc Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Mon, 15 Jun 2026 13:39:36 -0600 Subject: [PATCH 03/12] chore: switch from GHA to GL CI --- .github/workflows/publish-tracing-error.yml | 27 ----------------- .gitlab-ci.yml | 32 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 27 deletions(-) delete mode 100644 .github/workflows/publish-tracing-error.yml create mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/publish-tracing-error.yml b/.github/workflows/publish-tracing-error.yml deleted file mode 100644 index be0a4aeba6..0000000000 --- a/.github/workflows/publish-tracing-error.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Publish tracing-error - -on: - push: - branches: - - rigetti-main - -jobs: - publish: - name: Publish tracing-error to rigetti-cargo - runs-on: ubuntu-latest - permissions: - id-token: write - contents: read - steps: - - uses: actions/checkout@v4 - - - uses: dtolnay/rust-toolchain@stable - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-west-2 - - - name: Publish tracing-error - run: cargo publish -p tracing-error --registry rigetti-cargo diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000..a5369638cb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,32 @@ +include: + - project: "rigetti/qcs/utilities/qcs-infrastructure" + ref: v0.1.1 + file: + - gitlab-ci/common.yaml + - gitlab-ci/gitlab.yaml + - gitlab-ci/rust.yaml + +workflow: + rules: + - if: $CI_COMMIT_BRANCH == "rigetti-main" + +default: + !reference [.standard_defaults] + +variables: + QCS_INFRASTRUCTURE_REF: v0.0.17 + RUST_CI_IMAGE_TAG: $QCS_INFRASTRUCTURE_REF + CLI_TOOLS_IMAGE_TAG: $QCS_INFRASTRUCTURE_REF + +publish-tracing-error: + extends: [.cargo_publish_crate] + needs: [] + rules: + # Automatically run from rigetti-main + - if: $CI_COMMIT_BRANCH == "rigetti-main" + # Manually run from any other branch + - when: manual + before_script: + - !reference [.cargo_publish_crate, before_script] + script: + - cargo publish -p tracing-error --registry rigetti-cargo From 58181305da640f319ace5a6103dce0c7769ed765 Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Mon, 15 Jun 2026 13:54:42 -0600 Subject: [PATCH 04/12] GHA trigger GL CI --- .github/workflows/trigger-gitlab-ci.yml | 18 ++++++++++++++++++ .gitlab-ci.yml | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/trigger-gitlab-ci.yml diff --git a/.github/workflows/trigger-gitlab-ci.yml b/.github/workflows/trigger-gitlab-ci.yml new file mode 100644 index 0000000000..31e9fb9a84 --- /dev/null +++ b/.github/workflows/trigger-gitlab-ci.yml @@ -0,0 +1,18 @@ +name: Trigger GitLab CI + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + trigger: + name: Trigger GitLab pipeline + runs-on: ubuntu-latest + container: gitlab/glab + steps: + - name: Trigger pipeline on mirrored branch + run: glab ci run --branch "${{ github.head_ref }}" --repo "$GITLAB_PROJECT_PATH" + env: + GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} + GITLAB_HOST: gitlab.com + GITLAB_PROJECT_PATH: ${{ secrets.GITLAB_PROJECT_PATH }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a5369638cb..79b757647b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,12 +9,14 @@ include: workflow: rules: - if: $CI_COMMIT_BRANCH == "rigetti-main" + - if: $CI_PIPELINE_SOURCE == "trigger" + - if: $CI_PIPELINE_SOURCE == "web" default: !reference [.standard_defaults] variables: - QCS_INFRASTRUCTURE_REF: v0.0.17 + QCS_INFRASTRUCTURE_REF: v0.1.1 RUST_CI_IMAGE_TAG: $QCS_INFRASTRUCTURE_REF CLI_TOOLS_IMAGE_TAG: $QCS_INFRASTRUCTURE_REF From 1c2772084ffb04acda613a1944ee3a4e69f2eebb Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Mon, 15 Jun 2026 14:19:58 -0600 Subject: [PATCH 05/12] explicitly sync fork before running CI --- .github/workflows/trigger-gitlab-ci.yml | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/trigger-gitlab-ci.yml b/.github/workflows/trigger-gitlab-ci.yml index 31e9fb9a84..1d8783e209 100644 --- a/.github/workflows/trigger-gitlab-ci.yml +++ b/.github/workflows/trigger-gitlab-ci.yml @@ -10,6 +10,37 @@ jobs: runs-on: ubuntu-latest container: gitlab/glab steps: + - name: Sync mirror and wait for branch SHA + run: | + BRANCH="${{ github.head_ref }}" + EXPECTED_SHA="${{ github.event.pull_request.head.sha }}" + ENCODED_PATH="${GITLAB_PROJECT_PATH//\//%2F}" + TIMEOUT=300 + ELAPSED=0 + + echo "Triggering mirror sync..." + glab api --method POST "projects/${ENCODED_PATH}/mirror/pull" + + echo "Waiting for GitLab branch '${BRANCH}' to reach SHA ${EXPECTED_SHA}..." + while true; do + ACTUAL_SHA=$(glab api "projects/${ENCODED_PATH}/repository/branches/${BRANCH}" 2>/dev/null \ + | jq -r '.commit.id // empty') + if [ "$ACTUAL_SHA" = "$EXPECTED_SHA" ]; then + echo "SHA matched." + break + fi + if [ "$ELAPSED" -ge "$TIMEOUT" ]; then + echo "Timed out after ${TIMEOUT}s waiting for mirror to sync." + exit 1 + fi + sleep 10 + ELAPSED=$((ELAPSED + 10)) + done + env: + GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} + GITLAB_HOST: gitlab.com + GITLAB_PROJECT_PATH: ${{ secrets.GITLAB_PROJECT_PATH }} + - name: Trigger pipeline on mirrored branch run: glab ci run --branch "${{ github.head_ref }}" --repo "$GITLAB_PROJECT_PATH" env: From b670f758247ba6d0bd3be736f12f22e959378da5 Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Mon, 15 Jun 2026 14:30:41 -0600 Subject: [PATCH 06/12] log more info --- .github/workflows/trigger-gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/trigger-gitlab-ci.yml b/.github/workflows/trigger-gitlab-ci.yml index 1d8783e209..51d014d7b7 100644 --- a/.github/workflows/trigger-gitlab-ci.yml +++ b/.github/workflows/trigger-gitlab-ci.yml @@ -20,11 +20,13 @@ jobs: echo "Triggering mirror sync..." glab api --method POST "projects/${ENCODED_PATH}/mirror/pull" + echo "" echo "Waiting for GitLab branch '${BRANCH}' to reach SHA ${EXPECTED_SHA}..." while true; do ACTUAL_SHA=$(glab api "projects/${ENCODED_PATH}/repository/branches/${BRANCH}" 2>/dev/null \ | jq -r '.commit.id // empty') + echo " elapsed=${ELAPSED}s actual_sha=${ACTUAL_SHA:-}" if [ "$ACTUAL_SHA" = "$EXPECTED_SHA" ]; then echo "SHA matched." break From 30af80976c1b7bc82ede3d5a9449b72ef8902560 Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Mon, 15 Jun 2026 15:37:08 -0600 Subject: [PATCH 07/12] add more workflow rules --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79b757647b..f359a9db22 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,9 @@ workflow: - if: $CI_COMMIT_BRANCH == "rigetti-main" - if: $CI_PIPELINE_SOURCE == "trigger" - if: $CI_PIPELINE_SOURCE == "web" + - if: $CI_PIPELINE_SOURCE == "api" + - if: $CI_PIPELINE_SOURCE == "external" + - if: $CI_PIPELINE_SOURCE == "external_pull_request_event" default: !reference [.standard_defaults] From 99495ff4a38a68fb975f84509caee5227e8bbf21 Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Mon, 15 Jun 2026 15:52:14 -0600 Subject: [PATCH 08/12] auto-run jobs; project-path isn't secret --- .github/workflows/trigger-gitlab-ci.yml | 4 ++-- .gitlab-ci.yml | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/trigger-gitlab-ci.yml b/.github/workflows/trigger-gitlab-ci.yml index 51d014d7b7..57d1297874 100644 --- a/.github/workflows/trigger-gitlab-ci.yml +++ b/.github/workflows/trigger-gitlab-ci.yml @@ -41,11 +41,11 @@ jobs: env: GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} GITLAB_HOST: gitlab.com - GITLAB_PROJECT_PATH: ${{ secrets.GITLAB_PROJECT_PATH }} + GITLAB_PROJECT_PATH: ${{ vars.GITLAB_PROJECT_PATH }} - name: Trigger pipeline on mirrored branch run: glab ci run --branch "${{ github.head_ref }}" --repo "$GITLAB_PROJECT_PATH" env: GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} GITLAB_HOST: gitlab.com - GITLAB_PROJECT_PATH: ${{ secrets.GITLAB_PROJECT_PATH }} + GITLAB_PROJECT_PATH: ${{ vars.GITLAB_PROJECT_PATH }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f359a9db22..1a18ea3a79 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,6 +29,9 @@ publish-tracing-error: rules: # Automatically run from rigetti-main - if: $CI_COMMIT_BRANCH == "rigetti-main" + # Automatically run when triggered from GitHub, automatically via sync or via the API + - if: $CI_PIPELINE_SOURCE == "api" + - if: $CI_PIPELINE_SOURCE == "external_pull_request_event" # Manually run from any other branch - when: manual before_script: From 5501cdff1d8f46f12b3b1f5cff8a58ca40993393 Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Mon, 15 Jun 2026 17:03:50 -0600 Subject: [PATCH 09/12] monitor pipeline status; use prereleases --- .github/workflows/trigger-gitlab-ci.yml | 42 ++++++++++++++++++++++++- .gitlab-ci.yml | 5 +++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/.github/workflows/trigger-gitlab-ci.yml b/.github/workflows/trigger-gitlab-ci.yml index 57d1297874..cae53aaecb 100644 --- a/.github/workflows/trigger-gitlab-ci.yml +++ b/.github/workflows/trigger-gitlab-ci.yml @@ -44,7 +44,47 @@ jobs: GITLAB_PROJECT_PATH: ${{ vars.GITLAB_PROJECT_PATH }} - name: Trigger pipeline on mirrored branch - run: glab ci run --branch "${{ github.head_ref }}" --repo "$GITLAB_PROJECT_PATH" + id: trigger + run: | + OUTPUT=$(glab ci run --branch "${{ github.head_ref }}" --repo "$GITLAB_PROJECT_PATH") + echo "$OUTPUT" + PIPELINE_ID=$(echo "$OUTPUT" | grep -oP '(?<=id: )\d+') + echo "pipeline_id=${PIPELINE_ID}" >> "$GITHUB_OUTPUT" + env: + GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} + GITLAB_HOST: gitlab.com + GITLAB_PROJECT_PATH: ${{ vars.GITLAB_PROJECT_PATH }} + + - name: Monitor GitLab pipeline + run: | + PIPELINE_ID="${{ steps.trigger.outputs.pipeline_id }}" + ENCODED_PATH="${GITLAB_PROJECT_PATH//\//%2F}" + TIMEOUT=300 + ELAPSED=0 + POLL_INTERVAL=15 + + echo "Monitoring pipeline ${PIPELINE_ID}..." + while true; do + STATUS=$(glab api "projects/${ENCODED_PATH}/pipelines/${PIPELINE_ID}" 2>/dev/null \ + | jq -r '.status // empty') + echo " elapsed=${ELAPSED}s status=${STATUS:-}" + case "$STATUS" in + success) + echo "Pipeline succeeded." + exit 0 + ;; + failed|canceled|skipped) + echo "Pipeline ended with status: ${STATUS}." + exit 1 + ;; + esac + if [ "$ELAPSED" -ge "$TIMEOUT" ]; then + echo "Timed out after ${TIMEOUT}s waiting for pipeline to complete." + exit 1 + fi + sleep "$POLL_INTERVAL" + ELAPSED=$((ELAPSED + POLL_INTERVAL)) + done env: GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} GITLAB_HOST: gitlab.com diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1a18ea3a79..58b28884c2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,4 +37,9 @@ publish-tracing-error: before_script: - !reference [.cargo_publish_crate, before_script] script: + - | + if [ "$CI_COMMIT_BRANCH" != "rigetti-main" ]; then + sed -i "s/^version = \"\([^\"]*\)\"/version = \"\1-${CI_COMMIT_SHORT_SHA}\"/" tracing-error/Cargo.toml + echo "Patched version: $(grep '^version' tracing-error/Cargo.toml)" + fi - cargo publish -p tracing-error --registry rigetti-cargo From 71fa8ade2e3d6211acc3c6a575d6645c008d0ad8 Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Mon, 15 Jun 2026 17:20:39 -0600 Subject: [PATCH 10/12] fix ID-extraction for busybox --- .github/workflows/trigger-gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trigger-gitlab-ci.yml b/.github/workflows/trigger-gitlab-ci.yml index cae53aaecb..69ae15a423 100644 --- a/.github/workflows/trigger-gitlab-ci.yml +++ b/.github/workflows/trigger-gitlab-ci.yml @@ -48,7 +48,7 @@ jobs: run: | OUTPUT=$(glab ci run --branch "${{ github.head_ref }}" --repo "$GITLAB_PROJECT_PATH") echo "$OUTPUT" - PIPELINE_ID=$(echo "$OUTPUT" | grep -oP '(?<=id: )\d+') + PIPELINE_ID=$(echo "$OUTPUT" | sed 's/.*id: \([0-9]*\).*/\1/') echo "pipeline_id=${PIPELINE_ID}" >> "$GITHUB_OUTPUT" env: GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} From 89fde9f587e5dde83ec1468f801d202fc4426477 Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Mon, 15 Jun 2026 17:45:32 -0600 Subject: [PATCH 11/12] include pipeline URL in error message --- .github/workflows/trigger-gitlab-ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/trigger-gitlab-ci.yml b/.github/workflows/trigger-gitlab-ci.yml index 69ae15a423..269440585b 100644 --- a/.github/workflows/trigger-gitlab-ci.yml +++ b/.github/workflows/trigger-gitlab-ci.yml @@ -65,8 +65,9 @@ jobs: echo "Monitoring pipeline ${PIPELINE_ID}..." while true; do - STATUS=$(glab api "projects/${ENCODED_PATH}/pipelines/${PIPELINE_ID}" 2>/dev/null \ - | jq -r '.status // empty') + RESPONSE=$(glab api "projects/${ENCODED_PATH}/pipelines/${PIPELINE_ID}" 2>/dev/null) + STATUS=$(echo "$RESPONSE" | jq -r '.status // empty') + PIPELINE_URL=$(echo "$RESPONSE" | jq -r '.web_url // empty') echo " elapsed=${ELAPSED}s status=${STATUS:-}" case "$STATUS" in success) @@ -74,7 +75,7 @@ jobs: exit 0 ;; failed|canceled|skipped) - echo "Pipeline ended with status: ${STATUS}." + echo "Pipeline ended with status: ${STATUS}. [View pipeline](${PIPELINE_URL})" exit 1 ;; esac From b95a0d2a3d65c6207419f9c45402263de83004dd Mon Sep 17 00:00:00 2001 From: Kyle J Strand Date: Mon, 15 Jun 2026 22:15:51 -0600 Subject: [PATCH 12/12] need to allow-dirty --- .github/workflows/trigger-gitlab-ci.yml | 2 +- .gitlab-ci.yml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/trigger-gitlab-ci.yml b/.github/workflows/trigger-gitlab-ci.yml index 269440585b..671ed70e84 100644 --- a/.github/workflows/trigger-gitlab-ci.yml +++ b/.github/workflows/trigger-gitlab-ci.yml @@ -75,7 +75,7 @@ jobs: exit 0 ;; failed|canceled|skipped) - echo "Pipeline ended with status: ${STATUS}. [View pipeline](${PIPELINE_URL})" + echo "Pipeline ended with status: ${STATUS}. ${PIPELINE_URL}" exit 1 ;; esac diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 58b28884c2..7731032f1c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,5 +41,8 @@ publish-tracing-error: if [ "$CI_COMMIT_BRANCH" != "rigetti-main" ]; then sed -i "s/^version = \"\([^\"]*\)\"/version = \"\1-${CI_COMMIT_SHORT_SHA}\"/" tracing-error/Cargo.toml echo "Patched version: $(grep '^version' tracing-error/Cargo.toml)" + dirty="--allow-dirty" + else + dirty="" fi - - cargo publish -p tracing-error --registry rigetti-cargo + - cargo publish $dirty -p tracing-error --registry rigetti-cargo