mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
cli: split image into oss and enterprise (#1788)
This commit is contained in:
parent
cfef384f36
commit
6062b10035
6
.github/actions/e2e_mini/action.yml
vendored
6
.github/actions/e2e_mini/action.yml
vendored
@ -42,10 +42,6 @@ runs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ inputs.githubToken }}
|
||||
|
||||
- name: Upload referenced container images
|
||||
shell: bash
|
||||
run: bazelisk run //bazel/release:push
|
||||
|
||||
- name: MiniConstellation E2E
|
||||
shell: bash
|
||||
env:
|
||||
@ -53,4 +49,4 @@ runs:
|
||||
ARM_SUBSCRIPTION_ID: ${{ inputs.azureSubscriptionID }}
|
||||
ARM_TENANT_ID: ${{ inputs.azureTenantID }}
|
||||
run: |
|
||||
bazelisk run //e2e/miniconstellation:remote_test
|
||||
bazelisk run //e2e/miniconstellation:push_remote_test
|
||||
|
@ -80,11 +80,11 @@ jobs:
|
||||
defaultVersionReg='defaultImage = \"[^\"]*\"'
|
||||
|
||||
# Ensure regexp matches (otherwise the file was changed or the workflow is broken).
|
||||
grep -E "${defaultVersionReg}" internal/config/image.go
|
||||
grep -E "${defaultVersionReg}" internal/config/image_enterprise.go
|
||||
|
||||
# Update version.
|
||||
newVersion="ref\/${{ steps.version.outputs.branchName }}\/stream\/nightly\/${{ steps.version.outputs.version }}"
|
||||
sed -i "s/${defaultVersionReg}/defaultImage = \"${newVersion}\"/" internal/config/image.go
|
||||
sed -i "s/${defaultVersionReg}/defaultImage = \"${newVersion}\"/" internal/config/image_enterprise.go
|
||||
|
||||
- name: Build generateMeasurements tool
|
||||
working-directory: internal/attestation/measurements/measurement-generator
|
||||
|
7
.github/workflows/release.yml
vendored
7
.github/workflows/release.yml
vendored
@ -147,12 +147,11 @@ jobs:
|
||||
defaultVersionReg='defaultImage = \"[^\"]*\"'
|
||||
|
||||
# Ensure regexp matches (otherwise the file was changed or the workflow is broken).
|
||||
grep -E "${defaultVersionReg}" internal/config/image.go
|
||||
grep -E "${defaultVersionReg}" internal/config/image_enterprise.go
|
||||
|
||||
# Update version.
|
||||
sed -i "s/${defaultVersionReg}/defaultImage = \"${VERSION}\"/" internal/config/image.go
|
||||
git add internal/config/image.go
|
||||
|
||||
sed -i "s/${defaultVersionReg}/defaultImage = \"${VERSION}\"/" internal/config/image_enterprise.go
|
||||
git add internal/config/image_enterprise.go
|
||||
- name: Commit
|
||||
run: |
|
||||
git config --global user.name "edgelessci"
|
||||
|
@ -428,7 +428,7 @@ func (c *Creator) createQEMU(ctx context.Context, cl terraformClient, lv libvirt
|
||||
// if no libvirt URI is specified, start a libvirt container
|
||||
case libvirtURI == "":
|
||||
if err := lv.Start(ctx, opts.Config.Name, opts.Config.Provider.QEMU.LibvirtContainerImage); err != nil {
|
||||
return clusterid.File{}, err
|
||||
return clusterid.File{}, fmt.Errorf("start libvirt container: %w", err)
|
||||
}
|
||||
libvirtURI = libvirt.LibvirtTCPConnectURI
|
||||
|
||||
@ -485,7 +485,7 @@ func (c *Creator) createQEMU(ctx context.Context, cl terraformClient, lv libvirt
|
||||
}
|
||||
|
||||
if err := cl.PrepareWorkspace(path.Join("terraform", strings.ToLower(cloudprovider.QEMU.String())), &vars); err != nil {
|
||||
return clusterid.File{}, err
|
||||
return clusterid.File{}, fmt.Errorf("prepare workspace: %w", err)
|
||||
}
|
||||
|
||||
// Allow rollback of QEMU Terraform workspace from this point on
|
||||
@ -493,7 +493,7 @@ func (c *Creator) createQEMU(ctx context.Context, cl terraformClient, lv libvirt
|
||||
|
||||
tfOutput, err := cl.CreateCluster(ctx, opts.TFLogLevel)
|
||||
if err != nil {
|
||||
return clusterid.File{}, err
|
||||
return clusterid.File{}, fmt.Errorf("create cluster: %w", err)
|
||||
}
|
||||
|
||||
return clusterid.File{
|
||||
|
@ -10,6 +10,7 @@ package libvirt
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
@ -43,7 +44,7 @@ func New() *Runner {
|
||||
func (r *Runner) Start(ctx context.Context, name, imageName string) error {
|
||||
docker, err := docker.NewClientWithOpts(docker.FromEnv, docker.WithAPIVersionNegotiation())
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to create docker client: %w", err)
|
||||
}
|
||||
defer docker.Close()
|
||||
|
||||
@ -65,7 +66,7 @@ func (r *Runner) Start(ctx context.Context, name, imageName string) error {
|
||||
if len(images) == 0 {
|
||||
reader, err := docker.ImagePull(ctx, imageName, types.ImagePullOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to pull image %q: %w", imageName, err)
|
||||
}
|
||||
defer reader.Close()
|
||||
if _, err := io.Copy(io.Discard, reader); err != nil {
|
||||
@ -88,11 +89,11 @@ func (r *Runner) Start(ctx context.Context, name, imageName string) error {
|
||||
nil,
|
||||
containerName,
|
||||
); err != nil {
|
||||
return err
|
||||
return fmt.Errorf("failed to create container: %w", err)
|
||||
}
|
||||
if err := docker.ContainerStart(ctx, containerName, types.ContainerStartOptions{}); err != nil {
|
||||
_ = docker.ContainerRemove(ctx, containerName, types.ContainerRemoveOptions{Force: true})
|
||||
return err
|
||||
return fmt.Errorf("failed to start container: %w", err)
|
||||
}
|
||||
|
||||
// write the name of the container to a file so we can remove it later
|
||||
|
@ -411,13 +411,13 @@ func (c *Client) writeVars(vars Variables) error {
|
||||
// If a variables file already exists, check if it's the same as we're expecting, so we can continue using it.
|
||||
varsContent, err := c.file.Read(pathToVarsFile)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("read variables file: %w", err)
|
||||
}
|
||||
if vars.String() != string(varsContent) {
|
||||
return ErrTerraformWorkspaceExistsWithDifferentVariables
|
||||
}
|
||||
} else if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("write variables file: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -1,3 +1,4 @@
|
||||
load("@com_github_ash2k_bazel_tools//multirun:def.bzl", "multirun")
|
||||
load("//bazel/sh:def.bzl", "sh_template")
|
||||
|
||||
filegroup(
|
||||
@ -31,3 +32,13 @@ sh_template(
|
||||
":dependencies_lib",
|
||||
],
|
||||
)
|
||||
|
||||
multirun(
|
||||
name = "push_remote_test",
|
||||
commands = [
|
||||
"//bazel/release:push",
|
||||
":remote_test",
|
||||
],
|
||||
jobs = 1, # execute sequentially
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
@ -8,7 +8,10 @@ go_library(
|
||||
"azure.go",
|
||||
"config.go",
|
||||
"config_doc.go",
|
||||
"image.go",
|
||||
# keep
|
||||
"image_enterprise.go",
|
||||
# keep
|
||||
"image_oss.go",
|
||||
"qemu.go",
|
||||
"validation.go",
|
||||
],
|
||||
|
@ -1,3 +1,5 @@
|
||||
//go:build enterprise
|
||||
|
||||
/*
|
||||
Copyright (c) Edgeless Systems GmbH
|
||||
|
14
internal/config/image_oss.go
Normal file
14
internal/config/image_oss.go
Normal file
@ -0,0 +1,14 @@
|
||||
//go:build !enterprise
|
||||
|
||||
/*
|
||||
Copyright (c) Edgeless Systems GmbH
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package config
|
||||
|
||||
const (
|
||||
// defaultImage is the default image to use.
|
||||
defaultImage = ""
|
||||
)
|
Loading…
Reference in New Issue
Block a user