Repository: metal3-io/baremetal-operator
Pull request #1695 (2024-04-23 15:33:05)

🐛  Fix Status logic for HostFirmwareComponents
- Make Updates and Components optional in HostFirmwareComponentsStatus, so we don't get errors when they are empty.
- The UpdatedAt field for FirmwareComponentStatus can be nil, this caused runtime error in the BMO. Now we check the field before adding it.

**What this PR does / why we need it**: metal3-io/metal3-docs#364


metal3-io-bot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by:
**Once this PR has been reviewed and has the lgtm label**, please assign [zaneb](https://github.com/zaneb) for approval. For more information see [the Kubernetes Code Review Process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process).

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=metal3-io%2Fbaremetal-operator).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/metal3-io/baremetal-operator/blob/main/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["zaneb"]} -->
iurygregory: /assign @dtantsur @honza  
iurygregory: /test metal3-bmo-e2e-test-pull
iurygregory: /test metal3-centos-e2e-integration-test-main
dtantsur: /approve
metal3-io-bot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/metal3-io/baremetal-operator/pull/1695#issuecomment-2072814422" title="Approved">dtantsur</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=metal3-io%2Fbaremetal-operator).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/metal3-io/baremetal-operator/blob/main/OWNERS)~~ [dtantsur]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
iurygregory: /test metal3-bmo-e2e-test-pull
metal3-io-bot: @iurygregory: The following test **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-bmo-e2e-test-pull | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/426/) | true | `/test metal3-bmo-e2e-test-pull`

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-bmo-e2e-test-pull | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/426/) | true | `/test metal3-bmo-e2e-test-pull`
metal3-centos-e2e-integration-test-main | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/49/) | true | `/test metal3-centos-e2e-integration-test-main`

[Full PR test history](https://prow.apps.test.metal3.io/pr-history?org=metal3-io&repo=baremetal-operator&pr=1695). [Your PR dashboard](https://prow.apps.test.metal3.io/pr?query=is:pr+state:open+author:iurygregory).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-bmo-e2e-test-pull | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/426/) | true | `/test metal3-bmo-e2e-test-pull`
metal3-centos-e2e-integration-test-main | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/49/) | true | `/test metal3-centos-e2e-integration-test-main`

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
iurygregory: /test metal3-centos-e2e-integration-test-main
iurygregory: /test metal3-bmo-e2e-test-pull
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-centos-e2e-integration-test-main | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/49/) | true | `/test metal3-centos-e2e-integration-test-main`
metal3-bmo-e2e-test-pull | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/428/) | true | `/test metal3-bmo-e2e-test-pull`

[Full PR test history](https://prow.apps.test.metal3.io/pr-history?org=metal3-io&repo=baremetal-operator&pr=1695). [Your PR dashboard](https://prow.apps.test.metal3.io/pr?query=is:pr+state:open+author:iurygregory).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-centos-e2e-integration-test-main | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/49/) | true | `/test metal3-centos-e2e-integration-test-main`
metal3-bmo-e2e-test-pull | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/428/) | true | `/test metal3-bmo-e2e-test-pull`

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
honza: /lgtm
honza: /ok-to-test

metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-bmo-e2e-test-pull | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/428/) | true | `/test metal3-bmo-e2e-test-pull`
metal3-centos-e2e-integration-test-main | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/53/) | true | `/test metal3-centos-e2e-integration-test-main`

[Full PR test history](https://prow.apps.test.metal3.io/pr-history?org=metal3-io&repo=baremetal-operator&pr=1695). [Your PR dashboard](https://prow.apps.test.metal3.io/pr?query=is:pr+state:open+author:iurygregory).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-bmo-e2e-test-pull | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/428/) | true | `/test metal3-bmo-e2e-test-pull`
metal3-centos-e2e-integration-test-main | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/53/) | true | `/test metal3-centos-e2e-integration-test-main`

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
metal3-io-bot: New changes are detected. LGTM label has been removed.
iurygregory: /test metal3-centos-e2e-integration-test-main 
/test metal3-bmo-e2e-test-pull
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-centos-e2e-integration-test-main | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/53/) | true | `/test metal3-centos-e2e-integration-test-main`
metal3-bmo-e2e-test-pull | 67f290a08dd517e11092795059a3c45820d4d003 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/429/) | true | `/test metal3-bmo-e2e-test-pull`

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-centos-e2e-integration-test-main | 0b055bac2fc0ccce62cfdccf6bc5e90e31d45614 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/53/) | true | `/test metal3-centos-e2e-integration-test-main`
metal3-bmo-e2e-test-pull | 67f290a08dd517e11092795059a3c45820d4d003 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/429/) | true | `/test metal3-bmo-e2e-test-pull`

[Full PR test history](https://prow.apps.test.metal3.io/pr-history?org=metal3-io&repo=baremetal-operator&pr=1695). [Your PR dashboard](https://prow.apps.test.metal3.io/pr?query=is:pr+state:open+author:iurygregory).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
iurygregory: The panic in the BMO log seems valid but the fact it shows L161 (which is a comment is a bit weird)... 
```
github.com/metal3-io/baremetal-operator/pkg/provisioner/ironic.(*ironicProvisioner).GetFirmwareComponents(0xc000478200)
	/workspace/pkg/provisioner/ironic/ironic.go:1171 +0x222
github.com/metal3-io/baremetal-operator/controllers/metal3%2eio.(*HostFirmwareComponentsReconciler).Reconcile(0xc0001d6f40, {0x1bb6050?, 0xc0008588d0}, {{{0xc0007e6760, 0x6}, {0xc0007e6756, 0x6}}})
	/workspace/controllers/metal3.io/hostfirmwarecomponents_controller.go:161 +0x90c
```
/test metal3-centos-e2e-integration-test-main
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-bmo-e2e-test-pull | 67f290a08dd517e11092795059a3c45820d4d003 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/429/) | true | `/test metal3-bmo-e2e-test-pull`
metal3-centos-e2e-integration-test-main | 67f290a08dd517e11092795059a3c45820d4d003 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/55/) | true | `/test metal3-centos-e2e-integration-test-main`

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-bmo-e2e-test-pull | 67f290a08dd517e11092795059a3c45820d4d003 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/429/) | true | `/test metal3-bmo-e2e-test-pull`
metal3-centos-e2e-integration-test-main | 67f290a08dd517e11092795059a3c45820d4d003 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/55/) | true | `/test metal3-centos-e2e-integration-test-main`

[Full PR test history](https://prow.apps.test.metal3.io/pr-history?org=metal3-io&repo=baremetal-operator&pr=1695). [Your PR dashboard](https://prow.apps.test.metal3.io/pr?query=is:pr+state:open+author:iurygregory).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
iurygregory: /test metal3-centos-e2e-integration-test-main
/test metal3-bmo-e2e-test-pull
iurygregory: /test metal3-centos-e2e-integration-test-main
/test metal3-bmo-e2e-test-pull
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-centos-e2e-integration-test-main | 67f290a08dd517e11092795059a3c45820d4d003 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/55/) | true | `/test metal3-centos-e2e-integration-test-main`
metal3-bmo-e2e-test-pull | 40944670a69c803beb56f2e2ecf86ed93276d3f0 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/433/) | true | `/test metal3-bmo-e2e-test-pull`

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-centos-e2e-integration-test-main | 67f290a08dd517e11092795059a3c45820d4d003 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/55/) | true | `/test metal3-centos-e2e-integration-test-main`
metal3-bmo-e2e-test-pull | 40944670a69c803beb56f2e2ecf86ed93276d3f0 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/433/) | true | `/test metal3-bmo-e2e-test-pull`

[Full PR test history](https://prow.apps.test.metal3.io/pr-history?org=metal3-io&repo=baremetal-operator&pr=1695). [Your PR dashboard](https://prow.apps.test.metal3.io/pr?query=is:pr+state:open+author:iurygregory).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-bmo-e2e-test-pull | 40944670a69c803beb56f2e2ecf86ed93276d3f0 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/433/) | true | `/test metal3-bmo-e2e-test-pull`
metal3-centos-e2e-integration-test-main | e57d67a35d115163a8dd7911be160e97064cc7a7 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/70/) | true | `/test metal3-centos-e2e-integration-test-main`

[Full PR test history](https://prow.apps.test.metal3.io/pr-history?org=metal3-io&repo=baremetal-operator&pr=1695). [Your PR dashboard](https://prow.apps.test.metal3.io/pr?query=is:pr+state:open+author:iurygregory).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
iurygregory: /test metal3-centos-e2e-integration-test-main
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-centos-e2e-integration-test-main | e57d67a35d115163a8dd7911be160e97064cc7a7 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/70/) | true | `/test metal3-centos-e2e-integration-test-main`
metal3-bmo-e2e-test-pull | e57d67a35d115163a8dd7911be160e97064cc7a7 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/435/) | true | `/test metal3-bmo-e2e-test-pull`

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-centos-e2e-integration-test-main | e57d67a35d115163a8dd7911be160e97064cc7a7 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/70/) | true | `/test metal3-centos-e2e-integration-test-main`
metal3-bmo-e2e-test-pull | e57d67a35d115163a8dd7911be160e97064cc7a7 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/435/) | true | `/test metal3-bmo-e2e-test-pull`

[Full PR test history](https://prow.apps.test.metal3.io/pr-history?org=metal3-io&repo=baremetal-operator&pr=1695). [Your PR dashboard](https://prow.apps.test.metal3.io/pr?query=is:pr+state:open+author:iurygregory).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-bmo-e2e-test-pull | e57d67a35d115163a8dd7911be160e97064cc7a7 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/435/) | true | `/test metal3-bmo-e2e-test-pull`
metal3-centos-e2e-integration-test-main | e57d67a35d115163a8dd7911be160e97064cc7a7 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/71/) | true | `/test metal3-centos-e2e-integration-test-main`

[Full PR test history](https://prow.apps.test.metal3.io/pr-history?org=metal3-io&repo=baremetal-operator&pr=1695). [Your PR dashboard](https://prow.apps.test.metal3.io/pr?query=is:pr+state:open+author:iurygregory).

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
metal3-io-bot: @iurygregory: The following tests **failed**, say `/retest` to rerun all failed tests or `/retest-required` to rerun all mandatory failed tests:

Test name | Commit | Details | Required | Rerun command
--- | --- | --- | --- | ---
metal3-bmo-e2e-test-pull | e57d67a35d115163a8dd7911be160e97064cc7a7 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-bmo-e2e-test-pull/435/) | true | `/test metal3-bmo-e2e-test-pull`
metal3-centos-e2e-integration-test-main | e57d67a35d115163a8dd7911be160e97064cc7a7 | [link](https://jenkins.nordix.org/view/Metal3/job/metal3-centos-e2e-integration-test-main/71/) | true | `/test metal3-centos-e2e-integration-test-main`

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->

Patch:
diff --git a/apis/metal3.io/v1alpha1/hostfirmwarecomponents_types.go b/apis/metal3.io/v1alpha1/hostfirmwarecomponents_types.go
index 4cd10143..e6fe015f 100644
--- a/apis/metal3.io/v1alpha1/hostfirmwarecomponents_types.go
+++ b/apis/metal3.io/v1alpha1/hostfirmwarecomponents_types.go
@@ -56,10 +56,11 @@ type HostFirmwareComponentsSpec struct {
 type HostFirmwareComponentsStatus struct {
 	// Updates is the list of all firmware components that should be updated
 	// they are specified via name and url fields.
+	// +optional
 	Updates []FirmwareUpdate `json:"updates"`
 
 	// Components is the list of all available firmware components and their information.
-	Components []FirmwareComponentStatus `json:"components"`
+	Components []FirmwareComponentStatus `json:"components,omitempty"`
 
 	// Time that the status was last updated
 	// +optional
diff --git a/config/base/crds/bases/metal3.io_hostfirmwarecomponents.yaml b/config/base/crds/bases/metal3.io_hostfirmwarecomponents.yaml
index 095763de..d79382fe 100644
--- a/config/base/crds/bases/metal3.io_hostfirmwarecomponents.yaml
+++ b/config/base/crds/bases/metal3.io_hostfirmwarecomponents.yaml
@@ -170,9 +170,6 @@ spec:
                   - url
                   type: object
                 type: array
-            required:
-            - components
-            - updates
             type: object
         type: object
     served: true
diff --git a/config/render/capm3.yaml b/config/render/capm3.yaml
index fd612ea1..36df29c7 100644
--- a/config/render/capm3.yaml
+++ b/config/render/capm3.yaml
@@ -1770,9 +1770,6 @@ spec:
                   - url
                   type: object
                 type: array
-            required:
-            - components
-            - updates
             type: object
         type: object
     served: true
diff --git a/controllers/metal3.io/hostfirmwarecomponents_controller.go b/controllers/metal3.io/hostfirmwarecomponents_controller.go
index 3e6eedf0..4e1e1dea 100644
--- a/controllers/metal3.io/hostfirmwarecomponents_controller.go
+++ b/controllers/metal3.io/hostfirmwarecomponents_controller.go
@@ -18,6 +18,7 @@ package controllers
 
 import (
 	"context"
+	"errors"
 	"fmt"
 	"reflect"
 
@@ -151,23 +152,21 @@ func (r *HostFirmwareComponentsReconciler) Reconcile(ctx context.Context, req ct
 		return ctrl.Result{Requeue: true, RequeueAfter: provisionerRetryDelay}, nil
 	}
 
-	newStatus, err := r.updateHostFirmware(info)
-	if err != nil {
-		return ctrl.Result{}, fmt.Errorf("could not update hostfirmwarecomponents: %w", err)
-	}
-
+	info.log.Info("retrieving firmware components and saving to resource", "Node", bmh.Status.Provisioning.ID)
 	// Check ironic for the components information if possible
 	components, err := prov.GetFirmwareComponents()
-	info.log.Info("retrieving firmware components and saving to resource", "Node", bmh.Status.Provisioning.ID)
 
 	if err != nil {
-		reqLogger.Error(err, "provisioner returns error", "RequeueAfter", provisionerRetryDelay)
-		setUpdatesCondition(info.hfc.GetGeneration(), &newStatus, info, metal3api.HostFirmwareComponentsValid, metav1.ConditionFalse, reasonInvalidComponent, err.Error())
+		if errors.Is(err, provisioner.ErrFirmwareUpdateUnsupported) {
+			return ctrl.Result{Requeue: false}, err
+		}
+		reqLogger.Info("provisioner returns error", "Error", err.Error(), "RequeueAfter", provisionerRetryDelay)
 		return ctrl.Result{Requeue: true, RequeueAfter: provisionerRetryDelay}, err
 	}
 
-	if err = r.updateHostFirmwareComponents(newStatus, components, info); err != nil {
-		return ctrl.Result{Requeue: false}, err
+	if err = r.updateHostFirmware(info, components); err != nil {
+		info.log.Info("updateHostFirmware returned error")
+		return ctrl.Result{}, fmt.Errorf("could not update hostfirmwarecomponents: %w", err)
 	}
 
 	for _, e := range info.events {
@@ -181,14 +180,19 @@ func (r *HostFirmwareComponentsReconciler) Reconcile(ctx context.Context, req ct
 }
 
 // Update the HostFirmwareComponents resource using the components from provisioner.
-func (r *HostFirmwareComponentsReconciler) updateHostFirmware(info *rhfcInfo) (newStatus metal3api.HostFirmwareComponentsStatus, err error) {
+func (r *HostFirmwareComponentsReconciler) updateHostFirmware(info *rhfcInfo, components []metal3api.FirmwareComponentStatus) (err error) {
 	dirty := false
-
+	var newStatus metal3api.HostFirmwareComponentsStatus
 	// change the Updates in Status
 	newStatus.Updates = info.hfc.Spec.Updates
+	// change the Components in Status
+	newStatus.Components = components
 
 	// Check if the updates in the Spec are different than Status
 	updatesMismatch := !reflect.DeepEqual(info.hfc.Status.Updates, info.hfc.Spec.Updates)
+	if len(info.hfc.Spec.Updates) == 0 && len(info.hfc.Status.Updates) == 0 {
+		updatesMismatch = false
+	}
 
 	reason := reasonValidComponent
 	generation := info.hfc.GetGeneration()
@@ -222,32 +226,6 @@ func (r *HostFirmwareComponentsReconciler) updateHostFirmware(info *rhfcInfo) (n
 		info.log.Info("Status for HostFirmwareComponents changed")
 		info.hfc.Status = *newStatus.DeepCopy()
 
-		t := metav1.Now()
-		info.hfc.Status.LastUpdated = &t
-		return newStatus, r.Status().Update(info.ctx, info.hfc)
-	}
-	return newStatus, nil
-}
-
-// Update the HostFirmwareComponents resource using the components from provisioner.
-func (r *HostFirmwareComponentsReconciler) updateHostFirmwareComponents(newStatus metal3api.HostFirmwareComponentsStatus, components []metal3api.FirmwareComponentStatus, info *rhfcInfo) (err error) {
-	dirty := false
-	// change the Components in Status
-	newStatus.Components = components
-	// Check if the components information we retrieved is different from the one in Status
-	componentsInfoMismatch := !reflect.DeepEqual(components, info.hfc.Status.Components)
-	reason := reasonValidComponent
-	generation := info.hfc.GetGeneration()
-	// Log the components we have
-	info.log.Info("firmware components for node", "components", components, "bmh", info.bmh.Name)
-	if componentsInfoMismatch {
-		setUpdatesCondition(generation, &newStatus, info, metal3api.HostFirmwareComponentsChangeDetected, metav1.ConditionTrue, reason, "")
-		dirty = true
-	}
-	if dirty {
-		info.log.Info("Components Status for HostFirmwareComponents changed")
-		info.hfc.Status = *newStatus.DeepCopy()
-
 		t := metav1.Now()
 		info.hfc.Status.LastUpdated = &t
 		return r.Status().Update(info.ctx, info.hfc)
diff --git a/pkg/provisioner/ironic/ironic.go b/pkg/provisioner/ironic/ironic.go
index 4b9e671c..cee3bc7f 100644
--- a/pkg/provisioner/ironic/ironic.go
+++ b/pkg/provisioner/ironic/ironic.go
@@ -1153,21 +1153,20 @@ func (p *ironicProvisioner) GetFirmwareComponents() ([]metal3api.FirmwareCompone
 	if !p.availableFeatures.HasFirmwareUpdates() {
 		return nil, fmt.Errorf("current ironic version does not support firmware updates")
 	}
+
+	// Setting to 2 since we only support bmc and bios
+	componentsInfo := make([]metal3api.FirmwareComponentStatus, 0, 2)
+
+	if ironicNode.FirmwareInterface == "no-firmware" {
+		return componentsInfo, provisioner.ErrFirmwareUpdateUnsupported
+	}
 	// Get the components from Ironic via Gophercloud
 	componentList, componentListErr := nodes.ListFirmware(p.ctx, p.client, ironicNode.UUID).Extract()
 
-	if componentListErr != nil || len(componentList) == 0 {
-		bmcAccess, _ := p.bmcAccess()
-		if ironicNode.FirmwareInterface == "no-firmware" {
-			return nil, fmt.Errorf("driver %s does not support firmware updates", bmcAccess.Driver())
-		}
-
+	if componentListErr != nil {
 		return nil, fmt.Errorf("could not get firmware components for node %s: %w", ironicNode.UUID, componentListErr)
 	}
 
-	// Setting to 2 since we only support bmc and bios
-	componentsInfo := make([]metal3api.FirmwareComponentStatus, 0, 2)
-
 	// Iterate over the list of components to extract their information and update the list.
 	for _, fwc := range componentList {
 		if fwc.Component != "bios" && fwc.Component != "bmc" {
@@ -1179,9 +1178,12 @@ func (p *ironicProvisioner) GetFirmwareComponents() ([]metal3api.FirmwareCompone
 			InitialVersion:     fwc.InitialVersion,
 			CurrentVersion:     fwc.CurrentVersion,
 			LastVersionFlashed: fwc.LastVersionFlashed,
-			UpdatedAt: metav1.Time{
+		}
+		// Check if UpdatedAt is nil before adding it.
+		if fwc.UpdatedAt != nil {
+			component.UpdatedAt = metav1.Time{
 				Time: *fwc.UpdatedAt,
-			},
+			}
 		}
 		componentsInfo = append(componentsInfo, component)
 		p.log.Info("firmware component added for node", "component", fwc.Component, "node", ironicNode.UUID)
diff --git a/pkg/provisioner/provisioner.go b/pkg/provisioner/provisioner.go
index 689dbd93..15fa2c6f 100644
--- a/pkg/provisioner/provisioner.go
+++ b/pkg/provisioner/provisioner.go
@@ -240,3 +240,6 @@ var ErrNeedsRegistration = errors.New("host not registered")
 // ErrNeedsPreprovisioningImage is returned if a preprovisioning image is
 // required.
 var ErrNeedsPreprovisioningImage = errors.New("no suitable Preprovisioning image available")
+
+// ErrFirmwareUpdateUnsupported is returned if the host can't execute firmware updates.
+var ErrFirmwareUpdateUnsupported = errors.New("host does not support Firmware Updates")


Test patch:
diff --git a/controllers/metal3.io/hostfirmwarecomponents_test.go b/controllers/metal3.io/hostfirmwarecomponents_test.go
index 1998d1a7..ba9f3784 100644
--- a/controllers/metal3.io/hostfirmwarecomponents_test.go
+++ b/controllers/metal3.io/hostfirmwarecomponents_test.go
@@ -425,12 +425,9 @@ func TestStoreHostFirmwareComponents(t *testing.T) {
 				bmh: bmh,
 			}
 
-			currentStatus, err := r.updateHostFirmware(info)
-			assert.NoError(t, err)
-
 			components, err := prov.GetFirmwareComponents()
 			assert.NoError(t, err)
-			err = r.updateHostFirmwareComponents(currentStatus, components, info)
+			err = r.updateHostFirmware(info, components)
 			assert.NoError(t, err)
 
 			// Check that resources get created or updated