Skip to content
Closed
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
9 changes: 9 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -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"
51 changes: 51 additions & 0 deletions .github/workflows/trigger-gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
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: 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 ""

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:-<not found>}"
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:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
GITLAB_HOST: gitlab.com
GITLAB_PROJECT_PATH: ${{ secrets.GITLAB_PROJECT_PATH }}
34 changes: 34 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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"
- if: $CI_PIPELINE_SOURCE == "trigger"
- if: $CI_PIPELINE_SOURCE == "web"

default:
!reference [.standard_defaults]

variables:
QCS_INFRASTRUCTURE_REF: v0.1.1
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
Loading