Skip to content

Commit

Permalink
feat: add cloud images to releases
Browse files Browse the repository at this point in the history
This PR updates our CI so that when we release talos, a json file
containing our cloud images for AWS will be published as a release
asset.

Signed-off-by: Spencer Smith <robertspencersmith@gmail.com>
  • Loading branch information
rsmitty committed Jun 23, 2021
1 parent b52b206 commit 0731be9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
28 changes: 6 additions & 22 deletions .drone.jsonnet
Expand Up @@ -488,29 +488,12 @@ local conformance_pipelines = [
Pipeline('cron-conformance-qemu', default_pipeline_steps + [conformance_k8s_qemu], [default_cron_pipeline]) + cron_trigger(['nightly']),
];

// Cloud images pipeline.

local cloud_images = Step("cloud-images", depends_on=[load_artifacts], environment=creds_env_vars);

local upload_images_steps = default_pipeline_steps + [
cloud_images,
];


local upload_images_trigger = {
trigger: {
target: {
include: ['upload-images'],
},
},
};

local upload_images_pipeline = Pipeline('upload-images', upload_images_steps) + upload_images_trigger;

// Release pipeline.

local boot = Step('boot', depends_on=[e2e_docker, e2e_qemu]);

local cloud_images = Step("cloud-images", depends_on=[e2e_docker, e2e_qemu], environment=creds_env_vars);

local release_notes = Step('release-notes', depends_on=[e2e_docker, e2e_qemu]);

// TODO(andrewrynhard): We should run E2E tests on a release.
Expand All @@ -528,6 +511,7 @@ local release = {
'_out/azure-arm64.tar.gz',
'_out/boot-amd64.tar.gz',
'_out/boot-arm64.tar.gz',
'_out/cloud-images.json',
'_out/digital-ocean-amd64.tar.gz',
'_out/digital-ocean-arm64.tar.gz',
'_out/gcp-amd64.tar.gz',
Expand Down Expand Up @@ -563,11 +547,12 @@ local release = {
when: {
event: ['tag'],
},
depends_on: [build.name, boot.name, talosctl_cni_bundle.name, images.name, sbcs.name, iso.name, push.name, release_notes.name]
depends_on: [build.name, boot.name, cloud_images.name, talosctl_cni_bundle.name, images.name, sbcs.name, iso.name, push.name, release_notes.name]
};

local release_steps = default_steps + [
boot,
cloud_images,
release_notes,
release,
];
Expand Down Expand Up @@ -617,14 +602,13 @@ local notify_trigger = {
},
};

local notify_pipeline = Pipeline('notify', notify_steps, [default_pipeline, upload_images_pipeline, release_pipeline] + integration_pipelines + e2e_pipelines + conformance_pipelines, false, true) + notify_trigger;
local notify_pipeline = Pipeline('notify', notify_steps, [default_pipeline, release_pipeline] + integration_pipelines + e2e_pipelines + conformance_pipelines, false, true) + notify_trigger;

// Final configuration file definition.

[
default_pipeline,
default_cron_pipeline,
upload_images_pipeline,
release_pipeline,
] + integration_pipelines + e2e_pipelines + conformance_pipelines + [
notify_pipeline,
Expand Down
11 changes: 10 additions & 1 deletion hack/cloud-image-uploader/main.go
Expand Up @@ -9,9 +9,11 @@ import (
cryptorand "crypto/rand"
"encoding/binary"
"encoding/json"
"io"
"log"
"math/rand"
"os"
"path/filepath"
"sync"

"github.com/spf13/pflag"
Expand Down Expand Up @@ -85,7 +87,14 @@ func main() {
log.Fatalf("failed: %s", err)
}

e := json.NewEncoder(os.Stdout)
f, err := os.Create(filepath.Join(DefaultOptions.ArtifactsPath, "cloud-images.json"))
if err != nil {
log.Fatalf("failed: %s", err)
}

defer f.Close()

e := json.NewEncoder(io.MultiWriter(os.Stdout, f))
e.SetIndent("", " ")
e.Encode(&result) //nolint:errcheck
}

0 comments on commit 0731be9

Please sign in to comment.