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 }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ inputs.githubToken }}
|
password: ${{ inputs.githubToken }}
|
||||||
|
|
||||||
- name: Upload referenced container images
|
|
||||||
shell: bash
|
|
||||||
run: bazelisk run //bazel/release:push
|
|
||||||
|
|
||||||
- name: MiniConstellation E2E
|
- name: MiniConstellation E2E
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
@ -53,4 +49,4 @@ runs:
|
|||||||
ARM_SUBSCRIPTION_ID: ${{ inputs.azureSubscriptionID }}
|
ARM_SUBSCRIPTION_ID: ${{ inputs.azureSubscriptionID }}
|
||||||
ARM_TENANT_ID: ${{ inputs.azureTenantID }}
|
ARM_TENANT_ID: ${{ inputs.azureTenantID }}
|
||||||
run: |
|
run: |
|
||||||
bazelisk run //e2e/miniconstellation:remote_test
|
bazelisk run //e2e/miniconstellation:push_remote_test
|
||||||
|
@ -80,11 +80,11 @@ jobs:
|
|||||||
defaultVersionReg='defaultImage = \"[^\"]*\"'
|
defaultVersionReg='defaultImage = \"[^\"]*\"'
|
||||||
|
|
||||||
# Ensure regexp matches (otherwise the file was changed or the workflow is broken).
|
# 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.
|
# Update version.
|
||||||
newVersion="ref\/${{ steps.version.outputs.branchName }}\/stream\/nightly\/${{ steps.version.outputs.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
|
- name: Build generateMeasurements tool
|
||||||
working-directory: internal/attestation/measurements/measurement-generator
|
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 = \"[^\"]*\"'
|
defaultVersionReg='defaultImage = \"[^\"]*\"'
|
||||||
|
|
||||||
# Ensure regexp matches (otherwise the file was changed or the workflow is broken).
|
# 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.
|
# Update version.
|
||||||
sed -i "s/${defaultVersionReg}/defaultImage = \"${VERSION}\"/" internal/config/image.go
|
sed -i "s/${defaultVersionReg}/defaultImage = \"${VERSION}\"/" internal/config/image_enterprise.go
|
||||||
git add internal/config/image.go
|
git add internal/config/image_enterprise.go
|
||||||
|
|
||||||
- name: Commit
|
- name: Commit
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "edgelessci"
|
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
|
// if no libvirt URI is specified, start a libvirt container
|
||||||
case libvirtURI == "":
|
case libvirtURI == "":
|
||||||
if err := lv.Start(ctx, opts.Config.Name, opts.Config.Provider.QEMU.LibvirtContainerImage); err != nil {
|
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
|
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 {
|
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
|
// 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)
|
tfOutput, err := cl.CreateCluster(ctx, opts.TFLogLevel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return clusterid.File{}, err
|
return clusterid.File{}, fmt.Errorf("create cluster: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return clusterid.File{
|
return clusterid.File{
|
||||||
|
@ -10,6 +10,7 @@ package libvirt
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
@ -43,7 +44,7 @@ func New() *Runner {
|
|||||||
func (r *Runner) Start(ctx context.Context, name, imageName string) error {
|
func (r *Runner) Start(ctx context.Context, name, imageName string) error {
|
||||||
docker, err := docker.NewClientWithOpts(docker.FromEnv, docker.WithAPIVersionNegotiation())
|
docker, err := docker.NewClientWithOpts(docker.FromEnv, docker.WithAPIVersionNegotiation())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("failed to create docker client: %w", err)
|
||||||
}
|
}
|
||||||
defer docker.Close()
|
defer docker.Close()
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ func (r *Runner) Start(ctx context.Context, name, imageName string) error {
|
|||||||
if len(images) == 0 {
|
if len(images) == 0 {
|
||||||
reader, err := docker.ImagePull(ctx, imageName, types.ImagePullOptions{})
|
reader, err := docker.ImagePull(ctx, imageName, types.ImagePullOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("failed to pull image %q: %w", imageName, err)
|
||||||
}
|
}
|
||||||
defer reader.Close()
|
defer reader.Close()
|
||||||
if _, err := io.Copy(io.Discard, reader); err != nil {
|
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,
|
nil,
|
||||||
containerName,
|
containerName,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return err
|
return fmt.Errorf("failed to create container: %w", err)
|
||||||
}
|
}
|
||||||
if err := docker.ContainerStart(ctx, containerName, types.ContainerStartOptions{}); err != nil {
|
if err := docker.ContainerStart(ctx, containerName, types.ContainerStartOptions{}); err != nil {
|
||||||
_ = docker.ContainerRemove(ctx, containerName, types.ContainerRemoveOptions{Force: true})
|
_ = 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
|
// 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.
|
// 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)
|
varsContent, err := c.file.Read(pathToVarsFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("read variables file: %w", err)
|
||||||
}
|
}
|
||||||
if vars.String() != string(varsContent) {
|
if vars.String() != string(varsContent) {
|
||||||
return ErrTerraformWorkspaceExistsWithDifferentVariables
|
return ErrTerraformWorkspaceExistsWithDifferentVariables
|
||||||
}
|
}
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return err
|
return fmt.Errorf("write variables file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
load("@com_github_ash2k_bazel_tools//multirun:def.bzl", "multirun")
|
||||||
load("//bazel/sh:def.bzl", "sh_template")
|
load("//bazel/sh:def.bzl", "sh_template")
|
||||||
|
|
||||||
filegroup(
|
filegroup(
|
||||||
@ -31,3 +32,13 @@ sh_template(
|
|||||||
":dependencies_lib",
|
":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",
|
"azure.go",
|
||||||
"config.go",
|
"config.go",
|
||||||
"config_doc.go",
|
"config_doc.go",
|
||||||
"image.go",
|
# keep
|
||||||
|
"image_enterprise.go",
|
||||||
|
# keep
|
||||||
|
"image_oss.go",
|
||||||
"qemu.go",
|
"qemu.go",
|
||||||
"validation.go",
|
"validation.go",
|
||||||
],
|
],
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
//go:build enterprise
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) Edgeless Systems GmbH
|
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