Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add bootc_status to payload #1696

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

richm
Copy link

@richm richm commented Apr 9, 2024

Allow adding hosts for testing with bootc_status information.
When using make run_inv_mq_service_test_producer, you can now
provide the following environment variables to add bootc_status
fields to the system_profile:

  • BOOTC_BOOTED_IMAGE
  • BOOTC_STAGED_IMAGE
  • BOOTC_ROLLBACK_IMAGE

Example:

BOOTC_BOOTED_IMAGE=quay.io/my_org/my_repo:a_tag \
BOOTC_STAGED_IMAGE=quay.io/my_org/my_repo:a_new_tag \
BOOTC_ROLLBACK_IMAGE=quay.io/my_org/my_repo:a_previous_tag \
make run_inv_mq_service_test_producer

This will cause the payload to have a bootc_status field, and
the return value from an api query of system_profile will look like this:

"bootc_status": {
    "booted": {
      "image": "quay.io/my_org/my_repo:a_tag",
      "image_digest": "sha256:c7f7cbd......"
    },
    "staged": {
      "image": "quay.io/my_org/my_repo:a_new_tag",
      "image_digest": "sha256:a28b09c......"
    },
    "rollback": {
      "image": "quay.io/my_org/my_repo:a_previous_tag",
      "image_digest": "sha256:fd99cb0......"
    }
}

The sha256 digest value is calculated from the image name, so that way the same image name
will have the same digest value.

Signed-off-by: Rich Megginson [email protected]

@richm richm requested a review from a team as a code owner April 9, 2024 14:07
@richm
Copy link
Author

richm commented Apr 9, 2024

I use it like this to add a lot of hosts with different images for testing:

registries=(quay.io registry.redhat.io 192.168.122.1 localhost)
orgs=(my_org_1 my_org_2)
ports=("" ":5000")
for port in "${ports[@]}"; do
    for org in "${orgs[@]}"; do
        for reg in "${registries[@]}"; do
            image="${reg}${port}/${org}/image_name:latest"
            BOOTC_BOOTED_IMAGE="$image" \
            PIPENV_IGNORE_VIRTUALENVS=1 pipenv run make run_inv_mq_service_test_producer
            BOOTC_BOOTED_IMAGE="$image" BOOTC_STAGED_IMAGE="$image" \
            PIPENV_IGNORE_VIRTUALENVS=1 pipenv run make run_inv_mq_service_test_producer
            BOOTC_BOOTED_IMAGE="$image" BOOTC_ROLLBACK_IMAGE="$image" \
            PIPENV_IGNORE_VIRTUALENVS=1 pipenv run make run_inv_mq_service_test_producer
        done
    done
done

@richm richm force-pushed the add_bootc_status_to_payload branch from b6e6085 to 0c96480 Compare April 22, 2024 16:34
Allow adding hosts for testing with bootc_status information.
When using `make run_inv_mq_service_test_producer`, you can now
provide the following environment variables to add `bootc_status`
fields to the `system_profile`:

* `BOOTC_BOOTED_IMAGE`
* `BOOTC_STAGED_IMAGE`
* `BOOTC_ROLLBACK_IMAGE`

Example:
```bash
BOOTC_BOOTED_IMAGE=quay.io/my_org/my_repo:a_tag \
BOOTC_STAGED_IMAGE=quay.io/my_org/my_repo:a_new_tag \
BOOTC_ROLLBACK_IMAGE=quay.io/my_org/my_repo:a_previous_tag \
make run_inv_mq_service_test_producer
```
This will cause the payload to have a `bootc_status` field, and
the return value from an api query of system_profile will look like this:

```json
...
"bootc_status": {
    "booted": {
      "image": "quay.io/my_org/my_repo:a_tag",
      "image_digest": "sha256:c7f7cbd......"
    },
    "staged": {
      "image": "quay.io/my_org/my_repo:a_new_tag",
      "image_digest": "sha256:a28b09c......"
    },
    "rollback": {
      "image": "quay.io/my_org/my_repo:a_previous_tag",
      "image_digest": "sha256:fd99cb0......"
    }
}
```

The sha256 digest value is calculated from the image name, so that way the same image name
will have the same digest value.

Signed-off-by: Rich Megginson <[email protected]>
@richm richm force-pushed the add_bootc_status_to_payload branch from 0c96480 to a180600 Compare April 22, 2024 19:32
@richm
Copy link
Author

richm commented Apr 22, 2024

I don't know why ci.ext.devshift.net PR build failed - some sort of internal error - can I retest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant