Skip to content
Merged
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
57 changes: 51 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches: [main]

env:
BINK_VERSION: v0.1.1
BINK_COMMIT: 2b1bbdca74fc36d319fb1ea6d0523d9a732fcb1f

permissions: {}

Expand All @@ -33,6 +33,11 @@ jobs:
go-version-file: go.mod
cache: true # zizmor: ignore[cache-poisoning]

- name: Check generated files
run: |
make fmt manifests generate
git diff --exit-code || { echo "Run 'make fmt manifests generate' and commit the results"; exit 1; }

- name: Unit tests
run: make unit

Expand All @@ -42,8 +47,45 @@ jobs:
- name: Lint
run: make lint

build-bink:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout bink
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: alicefr/bink
ref: ${{ env.BINK_COMMIT }}
persist-credentials: false

- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
cache: true # zizmor: ignore[cache-poisoning]

- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libgpgme-dev \
libbtrfs-dev \
libdevmapper-dev \
pkg-config

- name: Build bink
run: make build-bink

- name: Upload bink binary
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: bink
path: bink

e2e:
runs-on: ubuntu-latest
needs: build-bink
timeout-minutes: 30
permissions:
contents: read
Expand All @@ -56,11 +98,14 @@ jobs:
with:
persist-credentials: false

- name: Download bink release
run: |
sudo curl -fsSL -o /usr/local/bin/bink \
https://github.com/alicefr/bink/releases/download/${{ env.BINK_VERSION }}/bink
sudo chmod +x /usr/local/bin/bink
- name: Download bink binary
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: bink
path: /usr/local/bin

- name: Make bink executable
run: chmod +x /usr/local/bin/bink

- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ vet: ## Run go vet against code.
unit: manifests generate setup-envtest ## Run unit tests (envtest). V=1 for verbose. RUN=<regex> to filter.
KUBEBUILDER_ASSETS="$(shell "$(ENVTEST)" use $(ENVTEST_K8S_VERSION) --bin-dir "$(LOCALBIN)" -p path)" go test $(if $(V),-v) $(if $(RUN),-run $(RUN)) $$(go list ./... | grep -v /test/e2e)

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter.
"$(GOLANGCI_LINT)" run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes.
"$(GOLANGCI_LINT)" run --fix

.PHONY: e2e
e2e: ## Run e2e tests (requires: make deploy-bink). V=1 for verbose. RUN=<regex> to filter.
# NB: we `cd` here instead of passing a package path to `go test` so that `-v`
Expand All @@ -54,14 +62,6 @@ e2e: ## Run e2e tests (requires: make deploy-bink). V=1 for verbose. RUN=<regex>
$(if $(BINK_NODE_IMAGE),BINK_NODE_IMAGE=$(BINK_NODE_IMAGE)) \
go test -timeout 10m -count=1 $(if $(V),-v) $(if $(RUN),-run $(RUN)) .

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter.
"$(GOLANGCI_LINT)" run

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes.
"$(GOLANGCI_LINT)" run --fix

##@ Build

.PHONY: build
Expand Down
37 changes: 20 additions & 17 deletions internal/bootc/status.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// SPDX-License-Identifier: Apache-2.0

// TODO: move this to e.g. github.com/bootc-dev/bootc-go. We should be able to
// dedupe with at least flightctl.

package bootc

import (
Expand All @@ -24,26 +27,26 @@ type StatusSpec struct {

// StatusBody is the status section of bootc status output.
type StatusBody struct {
Staged *BootEntry `json:"staged"`
Booted *BootEntry `json:"booted"`
Rollback *BootEntry `json:"rollback"`
OtherDeployments []BootEntry `json:"otherDeployments,omitempty"`
RollbackQueued bool `json:"rollbackQueued"`
Type *string `json:"type"`
Staged *BootEntry `json:"staged"`
Booted *BootEntry `json:"booted"`
Rollback *BootEntry `json:"rollback"`
OtherDeployments []BootEntry `json:"otherDeployments,omitempty"`
RollbackQueued bool `json:"rollbackQueued"`
Type *string `json:"type"`
UsrOverlay *FilesystemOverlay `json:"usrOverlay"`
}

// BootEntry represents a single boot entry (booted, staged, or rollback).
type BootEntry struct {
Image *ImageStatus `json:"image"`
CachedUpdate *ImageStatus `json:"cachedUpdate"`
Incompatible bool `json:"incompatible"`
Pinned bool `json:"pinned"`
SoftRebootCapable bool `json:"softRebootCapable"`
DownloadOnly bool `json:"downloadOnly"`
Store *string `json:"store"`
Ostree *OstreeInfo `json:"ostree"`
Composefs *ComposefsInfo `json:"composefs"`
Image *ImageStatus `json:"image"`
CachedUpdate *ImageStatus `json:"cachedUpdate"`
Incompatible bool `json:"incompatible"`
Pinned bool `json:"pinned"`
SoftRebootCapable bool `json:"softRebootCapable"`
DownloadOnly bool `json:"downloadOnly"`
Store *string `json:"store"`
Ostree *OstreeInfo `json:"ostree"`
Composefs *ComposefsInfo `json:"composefs"`
}

// ImageStatus describes the image in a boot entry.
Expand Down Expand Up @@ -81,8 +84,8 @@ type ComposefsInfo struct {
// ImageSignature describes the signature verification policy.
type ImageSignature struct {
OstreeRemote *string `json:"ostreeRemote,omitempty"`
ContainerPolicy *bool `json:"containerPolicy,omitempty"`
Insecure *bool `json:"insecure,omitempty"`
ContainerPolicy *bool `json:"containerPolicy,omitempty"`
Insecure *bool `json:"insecure,omitempty"`
}

// FilesystemOverlay describes a /usr overlay state.
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/e2eutil/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (e *Env) AddNode(t *testing.T, opts ...NodeOption) string {
nodeName := e.generateNodeName(t)

// Provision the node with labels applied at join time.
args := []string{"node", "add", nodeName, "--cluster-name", e.clusterName, "--control-plane", "controller"}
args := []string{"node", "add", nodeName, "--cluster-name", e.clusterName}
args = append(args, "--label", LabelE2ETest+"="+e.testID)
for k, v := range cfg.labels {
args = append(args, "--label", k+"="+v)
Expand Down
3 changes: 3 additions & 0 deletions test/util/builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import (
bootcv1alpha1 "github.com/jlebon/bootc-operator/api/v1alpha1"
)

// Test fixture values. These are not helpers per se that are any use for e2e
// tests, but it's a convenient global spot for now. Should probably be moved
// to a separate envtest-specific package.
const (
ImageRepo = "quay.io/example/myos"

Expand Down
Loading