diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 1414a562ad..0000000000 --- a/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -.github -node_modules -packer -tools diff --git a/.github/workflows/delete-vm.yaml b/.github/workflows/delete-vm.yaml deleted file mode 100644 index ddfe941a07..0000000000 --- a/.github/workflows/delete-vm.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: Delete VM on PR close - -on: - pull_request: - types: [closed] - -jobs: - packer: - runs-on: ubuntu-latest - name: packer - - steps: - - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@v0 - with: - project_id: ${{ secrets.GCP_PROJECT_PACKER }} - service_account_key: ${{ secrets.GCP_SA_KEY_PACKER }} - export_default_credentials: true - - name: Delete vm for branch - shell: bash - run: gcloud compute instances delete "console-git-${GITHUB_HEAD_REF//[\/.]/-}" --quiet --zone=us-central1-a || true diff --git a/.github/workflows/deploy-vm.yml b/.github/workflows/deploy-vm.yml deleted file mode 100644 index b1839a1809..0000000000 --- a/.github/workflows/deploy-vm.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: push image and deploy vm -on: - pull_request: - push: - branches: [main] - workflow_dispatch: -jobs: - docker-image: - strategy: - max-parallel: 4 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Extract branch name - shell: bash - run: BRANCH="${GITHUB_HEAD_REF//[\/.]/-}"; echo "::set-output name=branch::${BRANCH:-main}" - id: extract_branch - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ steps.extract_branch.outputs.branch }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx-${{ steps.extract_branch.outputs.branch }} - ${{ runner.os }}-buildx-main - ${{ runner.os }}-buildx- - - name: Login to GitHub Packages Docker Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v2 - with: - push: true - file: ./Dockerfile - tags: ghcr.io/${{ github.repository_owner }}/console:${{ steps.extract_branch.outputs.branch }},ghcr.io/${{ github.repository_owner }}/console:${{ github.sha }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache,mode=max - create-vm: - needs: [docker-image] - runs-on: ubuntu-latest - environment: - name: 'Preview VM' - url: https://console-git-${{ steps.extract_branch.outputs.branch }}.internal.oxide.computer - steps: - - uses: actions/checkout@master - - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@v0 - with: - project_id: ${{ secrets.GCP_PROJECT_PACKER }} - service_account_key: ${{ secrets.GCP_SA_KEY_PACKER }} - export_default_credentials: true - - name: Extract branch name - shell: bash - run: BRANCH="${GITHUB_HEAD_REF//[\/.]/-}"; echo "::set-output name=branch::${BRANCH:-main}" - id: extract_branch - - name: Deploy VM - shell: bash - run: ./tools/create_gcp_instance.sh - env: - BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} diff --git a/.github/workflows/packer.yaml b/.github/workflows/packer.yaml deleted file mode 100644 index 4ad4cb3c00..0000000000 --- a/.github/workflows/packer.yaml +++ /dev/null @@ -1,110 +0,0 @@ -name: Packer - -on: - push: - paths: - - 'packer/**' # Only run on changes to the packer directory. - - 'tools/populate_omicron_data.sh' - - '.github/workflows/packer.yaml' # Run when this file changes. - workflow_dispatch: - -jobs: - packer: - runs-on: ubuntu-latest - name: packer - outputs: - packer-id: ${{ steps.packer-output.outputs.id }} - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: Check if packer files have changed - id: packer-files-changed - uses: tj-actions/changed-files@v12.2 - with: - files: | - .github/workflows/packer.yaml - packer - - - name: Stop if not changed - if: steps.packer-files-changed.outputs.any_changed == 'false' - id: stop-if-changed - uses: actions/github-script@v5 - with: - script: | - const { owner, repo } = context.repo; - const run_id = "${{ github.run_id }}"; - github.rest.actions.cancelWorkflowRun({ - owner, - repo, - run_id - }); - - - name: Wait for cancellation - if: steps.packer-files-changed.outputs.any_changed == 'false' - run: sleep 60 - - - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@v0 - with: - project_id: ${{ secrets.GCP_PROJECT_PACKER }} - service_account_key: ${{ secrets.GCP_SA_KEY_PACKER }} - export_default_credentials: true - - # validate templates - - name: Validate Template - uses: hashicorp/packer-github-actions@master - with: - command: validate - arguments: -syntax-only - target: packer/config.pkr.hcl - - # build artifact - - name: Build Artifact - uses: hashicorp/packer-github-actions@master - with: - command: build - arguments: '-color=false -on-error=abort' - target: packer/config.pkr.hcl - env: - PACKER_LOG: 1 - GITHUB_TOKEN: ${{secrets.GLOBAL_GITHUB_TOKEN}} - TAILSCALE_MACHINE_KEY: ${{secrets.TAILSCALE_MACHINE_KEY}} - CLOUDFLARE_EMAIL: ${{secrets.CLOUDFLARE_EMAIL}} - CLOUDFLARE_TOKEN: ${{secrets.CLOUDFLARE_TOKEN}} - SSL_CERT: ${{secrets.SSL_CERT}} - SSL_KEY: ${{secrets.SSL_KEY}} - API_VERSION: c52656d6226a573bc5a8e0c4bdc94a5bd8080f45 - - # get the image information from gcloud - - name: Get image information - id: packer-output - shell: bash - run: | - PACKER=$(gcloud compute images list --sort-by "~creationTimestamp" --filter "name~'packer'" --limit 1) - echo "$PACKER" - echo "::set-output name=id::$(echo $PACKER | grep -o -P 'packer-\d+')" - - update-packer: - runs-on: ubuntu-latest - name: update-packer - needs: packer - if: ${{ github.ref != 'refs/heads/main' }} - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - with: - token: ${{ secrets.GLOBAL_GITHUB_TOKEN }} - - name: Update packer id - shell: bash - run: | - PACKER_SCRIPT="$(cat ./tools/create_gcp_instance.sh)" - OLD_PACKER_ID=$(echo $PACKER_SCRIPT | grep -o -P 'packer-\d+') - echo "${PACKER_SCRIPT/$OLD_PACKER_ID/${{ needs.packer.outputs.packer-id }}}" > ./tools/create_gcp_instance.sh - - uses: EndBug/add-and-commit@v7 - with: - add: ./tools/create_gcp_instance.sh - message: 'automatically update packer-id' - default_author: github_actions diff --git a/.github/workflows/preview-vm.yaml b/.github/workflows/preview-vm.yaml deleted file mode 100644 index cc68579646..0000000000 --- a/.github/workflows/preview-vm.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: Preview VM - -on: - pull_request: - branches: - - 'main' - types: [synchronize, opened, reopened] - -jobs: - comment: - runs-on: ubuntu-latest - steps: - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${{github.event.pull_request.head.ref}} | sed 's#refs/heads/##g' | sed 's#[/.]#-#g')" - id: extract_branch - - name: Post PR comment with preview deployment URL - uses: mshick/add-pr-comment@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - message: | - Preview will be deployed at https://console-git-${{steps.extract_branch.outputs.branch}}.internal.oxide.computer - allow-repeats: false diff --git a/.vscode/settings.json b/.vscode/settings.json index 297d62a840..1cd1adc4aa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,6 +14,6 @@ "explorer.fileNesting.expand": false, "explorer.fileNesting.patterns": { ".gitignore": ".gitattributes, .gitmodules, .gitmessage, .mailmap, .git-blame*", - "package.json": ".babelrc, .editorconfig, .eslint*, .figma*, .github*, .huskyrc*, plopfile*, .prettier*, .vercel*, .vscode*, Dockerfile, .dockerignore, playwright.config.*, prettier*, tsconfig.*, vitest.config.*, yarn*, postcss.config.*, tailwind.config.*, vite.config.ts" + "package.json": ".babelrc, .editorconfig, .eslint*, .figma*, .github*, .huskyrc*, plopfile*, .prettier*, .vercel*, .vscode*, playwright.config.*, prettier*, tsconfig.*, vitest.config.*, yarn*, postcss.config.*, tailwind.config.*, vite.config.ts" } } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 3bf5127736..d0635661b6 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -3,7 +3,7 @@ "tasks": [ { "label": "Switch Omicron to Pinned Version", - "detail": "Checks out the pinned version as specified in packer.yaml", + "detail": "Checks out the pinned version as specified in OMICRON_VERSION", "type": "shell", "command": "tools/checkout_pinned_omicron.sh" }, diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index cb25b40761..0000000000 --- a/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -# build environment -FROM node:16-alpine as build -WORKDIR /app -ENV PATH /app/node_modules/.bin:$PATH -COPY package.json ./ -COPY yarn.lock ./ -RUN yarn -COPY . ./ -RUN yarn build - -# production environment -FROM nginx:stable-alpine -COPY --from=build /app/dist /usr/share/nginx/html -EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] diff --git a/OMICRON_VERSION b/OMICRON_VERSION new file mode 100644 index 0000000000..786e72e9fd --- /dev/null +++ b/OMICRON_VERSION @@ -0,0 +1 @@ +c52656d6226a573bc5a8e0c4bdc94a5bd8080f45 \ No newline at end of file diff --git a/docs/serve-from-nexus.md b/docs/serve-from-nexus.md index a300987f83..5e346ac381 100644 --- a/docs/serve-from-nexus.md +++ b/docs/serve-from-nexus.md @@ -10,7 +10,7 @@ Following the rest of the instructions is only necessary if you want to build th ### Choosing a Console version to download -Most of the time you will want the latest commit on `main`. Look at `libs/api/__generated__/OMICRON_VERSION` to see what Omicron SHA that version of the console expects. Often it will work with a newer version of the API, but don't be surprised if it doesn't. +Most of the time you will want the latest commit on `main`. Look at [`OMICRON_VERSION`](/OMICRON_VERSION) to see what Omicron SHA that version of the console expects. Often it will work with a newer version of the API, but don't be surprised if it doesn't. ## Dependencies @@ -19,7 +19,7 @@ Most of the time you will want the latest commit on `main`. Look at `libs/api/__ ## Note about pinned omicron version -The API client in the console is generated from a specific omicron commit (see [`OMICRON_VERSION`](/libs/api/__generated__/OMICRON_VERSION)), which means we can only be sure the API calls will work if you're running that version of Nexus. However, this shouldn't be a big issue for dev/testing because: +The API client in the console is generated from a specific omicron commit (see [`OMICRON_VERSION`](/OMICRON_VERSION)), which means we can only be sure the API calls will work if you're running that version of Nexus. However, this shouldn't be a big issue for dev/testing because: - We update the generated API client in console frequently - Most API changes are additive, so if you're not running _too_ new a Nexus you'll probably be fine diff --git a/docs/update-pinned-api.md b/docs/update-pinned-api.md index b1b11331e9..18f0b473fe 100644 --- a/docs/update-pinned-api.md +++ b/docs/update-pinned-api.md @@ -1,26 +1,18 @@ # Updating the pinned API version -There are, in a way, two sources of truth for the omicron version pinned for deploy alongside the console, and they need to be kept in sync. Eventually we will make this process more automatic. - -The primary source of truth, in the sense that it determines what is actually deployed, is the packer image ID in `tools/create_gcp/instance.sh`. Unless that is changed, the API version deployed will not change. But if you want to change the packer image, you have to get a new one to build by first changing the `API_VERSION` env var set in `.github/workflows/packer.yaml`. - ## Setup The API generation script assumes you have `omicron` and `oxide.ts` cloned under the same parent directory as the console. You should also run `npm install` in `oxide.ts/generator`. ## Instructions -1. Update `API_VERSION` in [`packer.yaml`](https://github.com/oxidecomputer/console/blob/c90ac1660273dbee2a2fe5456fc8318057444a13/.github/workflows/packer.yaml#L49) with new Omicron commit hash +1. Update [`OMICRON_VERSION`](/OMICRON_VERSION) with new Omicron commit hash 1. Update the generated API client by running `yarn gen-api`. This will automatically check out the omicron commit specified as `API_VERSION`. If you forget this step, a safety test in `libs/api` will fail. 1. Fix any type errors introduced by changes to the generated code 1. Commit and push to a branch -1. Wait for `Packer` github action to complete, followed by a bot commit that updates the packer image ID in [`tools/create_gcp_instance.sh`](https://github.com/oxidecomputer/console/blob/d046263cbfbb80b08757e432a8fcd980b8facbe3/tools/create_gcp_instance.sh#L23). -1. Test deployed version on GCP ## Available omicron versions -The list of allowed omicron hashes (i.e., hashes for which there is a docker image for us to pull in) is available [here](https://github.com/orgs/oxidecomputer/packages/container/omicron/versions). That link is probably not accessible to everyone, but it basically contains an image corresponding to every commit on omicron `main` as well as the latest commit on every branch with a PR. - **We should only be pinning omicron `main` commits in console `main`.** Occasionally, in an in-progress console PR, we may want to _temporarily_ pin to a commit from an as-yet-unmerged API branch. But such a PR should **not** be merged into console `main` until the omicron PR is merged and the pinned version in console updated accordingly. -While you can technically pin an omicron branch name instead of a commit, that's probably not a good idea, because even if that branch gets updated, your console branch won't until something triggers a new packer build. It is always better to pin the commit hash corresponding to an omicron branch and then update it when that branch gets more commits. +While you can technically pin an omicron branch name instead of a commit, that's probably not a good idea, because even if that branch gets updated, your console branch won't. It is always better to pin the commit hash corresponding to an omicron branch and then update it when that branch gets more commits. diff --git a/libs/api/__tests__/safety.spec.ts b/libs/api/__tests__/safety.spec.ts index 80bac9de70..9166caf01f 100644 --- a/libs/api/__tests__/safety.spec.ts +++ b/libs/api/__tests__/safety.spec.ts @@ -7,15 +7,14 @@ it('Generated API client version matches API version specified for deployment', .readFileSync(path.resolve(__dirname, '../__generated__/OMICRON_VERSION'), 'utf8') .split('\n')[1] - const packerConfig = fs.readFileSync( - path.resolve(__dirname, '../../../.github/workflows/packer.yaml'), + const pinnedVersion = fs.readFileSync( + path.resolve(__dirname, '../../../OMICRON_VERSION'), 'utf8' ) - const deployedVersion = /API_VERSION: ([0-9a-f]+)/.exec(packerConfig)?.[1] - // if this test fails, most likely you have updated the API_VERSION in packer.yaml - // without re-running `yarn gen-api` - expect(generatedVersion).toEqual(deployedVersion) + // if this test fails, most likely you have updated the API_VERSION in + // console/OMICRON_VERSION without re-running `yarn gen-api` + expect(generatedVersion).toEqual(pinnedVersion) }) const grepFiles = (s: string) => diff --git a/packer/README.txt b/packer/README.txt deleted file mode 100644 index a3bd8e84f1..0000000000 --- a/packer/README.txt +++ /dev/null @@ -1,42 +0,0 @@ -In order to do deploy previews easily and behind the VPN we first bake a VM -image, we will reuse as the base image for each VM. - -## Pre-baked image - -On the image is the following: -- Tailscale is installed -- Docker is installed -- Cockroach DB already started -- The API server already started and pre-populated with some data -- Docker images are pulled for cfcert (built in the cio repo): This is for - routing cloudflare after the VM is launch. We pre-pull the image since then - running it when the VM is launched takes less time. -- SSL cert wildcard for *.internal.oxide.computer (URL syntax is documented in - https://119.rfd.oxide.computer). - This cert is generated in the configs repo. It expires every three months so - the secrets in this repo will need to be updated accordingly when it does, - then a new packer image will need to be built. - -Packer is the tool used for building the image. - -## VM launched - -When the VM is launched you can find what is done on startup in -tools/gcp_instance_startup_script.sh. - -Essentially, we run `tailscale up` and get the Tailscale IP for the VM. -We use that IP to route DNS through Cloudflare. - -Then we pull and run the docker image that was built for the branch. - -## Ports on the VM - -Cockroach DB: 0.0.0.0:8080 -API Server: 0.0.0.0:8888 -React App: 0.0.0.0:80,443 - -TODO: -- Set up the right env vars so the App actually talks to the API. -- When nexus requires cockroach actually hook that up to the cockroach URL we have -- cleanup old images -- cleanup tailscale old machine names diff --git a/packer/bootstrap-cockroach.sh b/packer/bootstrap-cockroach.sh deleted file mode 100755 index 02d121989e..0000000000 --- a/packer/bootstrap-cockroach.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -e -set -o pipefail - -# Start the first node. -sudo docker run -d \ - --restart=always \ - --name=cockroachdb \ - --hostname=cockroachdb \ - -p 0.0.0.0:26257:26257 \ - -p 0.0.0.0:8080:8080 \ - -v "/etc/cockroach/roach1/data:/cockroach/cockroach-data" \ - cockroachdb/cockroach start-single-node \ - --insecure - -echo "Waiting for CockroachDB to start..." -sleep 5 diff --git a/packer/bootstrap-omicron.sh b/packer/bootstrap-omicron.sh deleted file mode 100755 index 0025711ebb..0000000000 --- a/packer/bootstrap-omicron.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -set -e -set -o pipefail - -sudo docker run --rm -i \ - --name=bootstrap_db \ - --hostname=nexus \ - --net host \ - -v "/etc/omicron/config.toml:/etc/omicron/config.toml:ro" \ - --entrypoint=omicron-dev \ - ghcr.io/oxidecomputer/omicron:"$API_VERSION" \ - db-populate --database-url "postgresql://root@0.0.0.0:26257/omicron?sslmode=disable" -# Run nexus. -sudo docker run -d \ - --restart=always \ - --name=nexus \ - --hostname=nexus \ - --net host \ - -v "/etc/omicron/config.toml:/etc/omicron/config.toml:ro" \ - --entrypoint=nexus \ - ghcr.io/oxidecomputer/omicron:"$API_VERSION" \ - /etc/omicron/config.toml - -# Run the sled agent. -sudo docker run -d \ - --restart=always \ - --name=sled-agent \ - --hostname=sled-agent \ - --net host \ - --entrypoint=sled-agent-sim \ - ghcr.io/oxidecomputer/omicron:"$API_VERSION" \ - $(uuidgen) 0.0.0.0:12345 0.0.0.0:12221 diff --git a/packer/config.pkr.hcl b/packer/config.pkr.hcl deleted file mode 100644 index b3169e63a1..0000000000 --- a/packer/config.pkr.hcl +++ /dev/null @@ -1,140 +0,0 @@ -variable "github_token" { - default = env("GITHUB_TOKEN") - - validation { - condition = length(var.github_token) > 0 - error_message = < 0 - error_message = < 0 - error_message = < 0 - error_message = < 0 - error_message = < 0 - error_message = < 0 - error_message = < /dev/null && pwd )" - -export ZONE="us-central1-a" -export INSTANCE_TYPE="n2-standard-2" -export INSTANCE_NAME="console-git-${BRANCH_NAME}" - -echo "Deleting old instance if it already exists." -gcloud compute instances delete "$INSTANCE_NAME" --quiet \ - --zone=$ZONE || true - -echo " Creating instance: ${INSTANCE_NAME}" - -sed -i "s/BRANCH_NAME/${BRANCH_NAME}/g" tools/gcp_instance_startup_script.sh - -# Retry command twice just in case there is a random failure. -retry 2 gcloud compute instances create "$INSTANCE_NAME" \ - --description="Machine automatically generated from branch ${BRANCH_NAME} of the oxidecomputer/console git repo." \ - --hostname="${INSTANCE_NAME}.internal.oxide.computer" \ - --zone=$ZONE \ - --image=packer-1652148550 \ - --maintenance-policy=TERMINATE \ - --restart-on-failure \ - --machine-type=$INSTANCE_TYPE \ - --boot-disk-size=200GB \ - --boot-disk-auto-delete \ - --metadata-from-file startup-script=${DIR}/gcp_instance_startup_script.sh \ - --quiet diff --git a/tools/gcp_instance_startup_script.sh b/tools/gcp_instance_startup_script.sh deleted file mode 100755 index 6f5f827bc4..0000000000 --- a/tools/gcp_instance_startup_script.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -set -e -set -o pipefail -set -x - -export API_VERSION=$(cat /etc/api_version | tr -d '[:space:]') - -/usr/local/bin/bootstrap-cockroach.sh -/usr/local/bin/bootstrap-omicron.sh - -# Install tailscale at machine start, there is something they are saving on the -# host that makes everything think its the same machine. -sudo apt update -sudo apt install -y --no-install-recommends \ - tailscale - -# Start tailscale. -export TAILSCALE_MACHINE_KEY=$(cat /etc/tailscale/machine_key | tr -d '[:space:]') -tailscale up --authkey=${TAILSCALE_MACHINE_KEY} -sleep 5 - -# Get the IP of the instance. -# This _should_ be the first column. -export TAILSCALE_IP=$(tailscale status --active | grep console-git-BRANCH_NAME | awk '{print $1}') - -# Let's make sure cloudflare knows the right IP for this instance. -export CLOUDFLARE_EMAIL=$(cat /etc/cloudflare/email | tr -d '[:space:]') -export CLOUDFLARE_TOKEN=$(cat /etc/cloudflare/token | tr -d '[:space:]') - -# Create the A record for the domain. -docker run --rm \ - --name=cfcert \ - -e CLOUDFLARE_EMAIL \ - -e CLOUDFLARE_TOKEN \ - ghcr.io/oxidecomputer/cio:cfcert \ - cfcert console-git-BRANCH_NAME.internal.oxide.computer ${TAILSCALE_IP} - -# Run the console. -docker pull ghcr.io/oxidecomputer/console:BRANCH_NAME -docker run -d \ - --restart=always \ - --name=console \ - --net host \ - -v "/etc/cloudflare:/etc/cloudflare:ro" \ - -v "/etc/nginx/ssl-params.conf:/etc/nginx/ssl-params.conf:ro" \ - -v "/etc/nginx/conf.d:/etc/nginx/conf.d:ro" \ - ghcr.io/oxidecomputer/console:BRANCH_NAME - -export OXIDE_HOST='localhost:8888' # used by oxide command line -export OXIDE_TOKEN="oxide-spoof-001de000-05e4-4000-8000-000000004007" - -/usr/local/bin/populate_omicron_data.sh - -set +x diff --git a/tools/generate_api_client.sh b/tools/generate_api_client.sh index 7776f26eae..35c1cf6bb3 100755 --- a/tools/generate_api_client.sh +++ b/tools/generate_api_client.sh @@ -7,18 +7,12 @@ set -o xtrace # script assumes omicron and oxide.ts are cloned under the same parent dir as # console and have run `npm install` inside oxide.ts/generator -OMICRON_SHA=$(awk '/API_VERSION/ {print $2}' .github/workflows/packer.yaml) +OMICRON_SHA=$(cat OMICRON_VERSION) GEN_DIR='libs/api/__generated__' git -C '../omicron' fetch --all git -C '../omicron' checkout "$OMICRON_SHA" -# copy nexus config with some minor modifications... -cat ../omicron/nexus/examples/config.toml | - sed 's/127.0.0.1:12220/0.0.0.0:8888/' | - sed 's/127.0.0.1:12221/0.0.0.0:12221/' | - sed 's/127.0.0.1:32221/0.0.0.0:26257/' > packer/omicron.toml - # path to spec needs to be absolute cd ../omicron SPEC_FILE="$(pwd)/openapi/nexus.json" diff --git a/tools/start_api.sh b/tools/start_api.sh index 3fc173ace7..db153a97bb 100755 --- a/tools/start_api.sh +++ b/tools/start_api.sh @@ -31,7 +31,7 @@ run_in_pane() { # unless -f flag is present, refuse to start if we're not on the right omicron commit if [ -z "$f_flag" ]; then - PINNED_API_VERSION=$(awk '/API_VERSION/ {print $2}' ../console/.github/workflows/packer.yaml) + PINNED_API_VERSION=$(cat ../console/OMICRON_VERSION) CURRENT_API_VERSION=$(git rev-parse HEAD) if [ "$CURRENT_API_VERSION" != "$PINNED_API_VERSION" ]; then