Skip to content

tmp

tmp #5

Workflow file for this run

name: "simulator acceptance tests"

Check failure on line 1 in .github/workflows/acceptance-sim.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/acceptance-sim.yml

Invalid workflow file

(Line: 137, Col: 13): Unrecognized named-value: 'secrets'. Located at position 13 within expression: always() && secrets.testrail-host != ''
on:
workflow_call:
inputs:
omicron-sha:
type: "string"
required: true
testrail-upload:
type: "boolean"
required: false
default: false
secrets:
testrail-host:
required: false
testrail-project:
required: false
testrail-username:
required: false
testrail-api-key:
required: false
jobs:
acceptance:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tf-binary:
- terraform
- tofu
steps:
- uses: actions/checkout@v7
- uses: hashicorp/setup-terraform@v4
if: matrix.tf-binary == 'terraform'
with:
terraform_wrapper: false
- uses: opentofu/setup-opentofu@v2
if: matrix.tf-binary == 'tofu'
with:
tofu_wrapper: false
- uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- uses: docker/setup-compose-action@v2
- uses: astral-sh/setup-uv@v7
with:
# We don't have any Python dependencies to cache.
enable-cache: false
# Look up the version of oxide.rs corresponding to the requested omicron version. We'll cache
# the resulting binary, so that we only build the CLI for a given oxide.rs commit once, and
# always use the latest oxide.rs version corresponding to the relevant omicron version.
- name: resolve oxide cli version
id: oxide-cli
env:
GH_TOKEN: ${{ github.token }}
run: |
commit=$(./acctest/oxide-cli-version.sh '${{ inputs.omicron-sha }}')
echo "commit=${commit}" >> $GITHUB_OUTPUT
- name: cache oxide cli
uses: actions/cache@v6
with:
path: ~/.cargo/bin/oxide
key: oxide-cli-${{ steps.oxide-cli.outputs.commit }}
- name: install oxide cli
run: |
if [[ -x ~/.cargo/bin/oxide ]]; then
echo "using cached oxide cli"
else
cargo install \
--git https://github.com/oxidecomputer/oxide.rs \
--rev '${{ steps.oxide-cli.outputs.commit }}' \
oxide-cli
fi
~/.cargo/bin/oxide version
echo ~/.cargo/bin >> $GITHUB_PATH
# Run simulated omicron in the background with docker compose.
# The image is pre-built and pushed by the publish-image job in build-test.yml.
- name: ensure omicron-dev image
run: ./acctest/ensure-image.sh '${{ inputs.omicron-sha }}'
- name: start omicron-dev
working-directory: acctest
env:
TEST_ACC_DOCKER_TAG: ${{ inputs.omicron-sha }}
run: docker compose up --wait --wait-timeout 1500
# We can't use `oxide auth login` here, since it requires a browser to
# complete the oauth device flow. Instead, fetch an auth token using a
# script that simulates the browser flow.
- id: auth-token
working-directory: acctest
run: |
echo "OXIDE_TOKEN=$(uv run auth.py)" >> $GITHUB_OUTPUT
# Create oxide resources necessary for acceptance tests, including an
# arbitrary small image. Skip proxy to avoid recording the fairly large
# image upload requests.
- name: oxide-dependencies
run: |
# Install qemu, which we'll use to build a sample image.
sudo apt-get update && sudo apt-get install -y qemu-utils
./scripts/acc-test-setup.sh
env:
OXIDE_HOST: http://localhost:12220
OXIDE_TOKEN: ${{ steps.auth-token.outputs.OXIDE_TOKEN }}
- name: run acceptance test
run: |
export TF_ACC_TERRAFORM_PATH=$(which ${{ matrix.tf-binary }})
make testacc
env:
CHECKPOINT_DISABLE: "1"
OXIDE_HOST: http://localhost:8080
OXIDE_TOKEN: ${{ steps.auth-token.outputs.OXIDE_TOKEN }}
TEST_ACC_GOTESTSUM_ARGS: "--rerun-fails-report=./acctest/acc-test-rerun.txt --junitfile=./acctest/acc-tests.xml"
TF_ACC_PROVIDER_NAMESPACE: oxidecomputer
TF_ACC_SIM: "1"
TF_LOG: "TRACE"
TF_LOG_PATH: "terraform.log"
- name: extract log files
if: always()
continue-on-error: true
working-directory: acctest
# Ignore command errors to collect as many logs as possible.
run: |
docker compose exec -T omicron-dev sh -c 'tar -cf - /tmp/omicron-dev*.log' | tar -xf - || true
docker compose exec -T mitmproxy sh -c 'tar -cf - /tmp/mitmproxy.log' | tar -xf - || true
docker compose logs omicron-dev > ./tmp/omicron-dev.log || true
find .. -name terraform.log -exec cat {} \; > ./tmp/terraform.log || true
cp ./acc-tests.xml ./tmp || true
- name: rerun warn
if: always()
continue-on-error: true
working-directory: acctest
run: |
if [ -f ./acc-test-rerun.txt ]; then
echo "::warning title=${{ github.job }} (${{ matrix.tf-binary }}) - test rerun::$(cat ./acc-test-rerun.txt)"
fi
- name: upload test results to TestRail
if: ${{ always() && secrets.testrail-host != '' }}
continue-on-error: true
env:
TR_CLI_HOST: ${{ secrets.testrail-host }}
TR_CLI_USERNAME: ${{ secrets.testrail-username }}
TR_CLI_KEY: ${{ secrets.testrail-api-key }}
TR_CLI_PROJECT: ${{ secrets.testrail-project }}
run: |
uvx trcli \
--yes `# Auto-create new test cases.` \
parse_junit \
--file './acctest/acc-tests.xml' \
--title 'Acceptance Tests (${{ matrix.tf-binary }}) - ${{ github.run_id }} - ${{ job.check_run_id }}' \
--run-description 'GitHub workflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}' \
--update-existing-cases 'yes' \
--case-matcher 'auto' \
--close-run
- name: upload logs
if: always()
continue-on-error: true
uses: actions/upload-artifact@v7
with:
name: logs-${{ matrix.tf-binary }}-${{ job.check_run_id }}
path: acctest/tmp/