Skip to content

Commit bb81892

Browse files
authored
Upload as an job artifact (#2)
* Save as an artifact while developing * Simplify
1 parent de3ed49 commit bb81892

File tree

6 files changed

+15
-47
lines changed

6 files changed

+15
-47
lines changed

.github/workflows/fc-kernels.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,19 @@ jobs:
2323
- name: Build kernels
2424
run: sudo make build
2525

26-
- name: Set bucket based on branch
27-
id: set-bucket
28-
run: |
29-
if [ "${{ github.ref_name }}" = "main" ]; then
30-
echo "DESTINATION=${{ vars.GCP_BUCKET_NAME }}/kernels" >> $GITHUB_OUTPUT
31-
else
32-
echo "DESTINATION=${{ vars.GCP_DEV_BUCKET_NAME }}/${{ github.ref_name }}" >> $GITHUB_OUTPUT
33-
echo "You can copy the built kernels by running the following command in your infra repo:"
34-
echo "gsutil cp -r builds gs://${{ vars.GCP_DEV_BUCKET_NAME }}/${{ github.ref_name }}/* gs://$(GCP_PROJECT_ID)-fc-kernels/"
35-
fi
36-
3726
- name: Upload kernels
27+
if: github.ref_name == 'main'
3828
uses: "google-github-actions/upload-cloud-storage@v1"
3929
with:
4030
path: "./builds"
41-
destination: ${{ steps.set-bucket.outputs.DESTINATION }}/kernels
31+
destination: ${{ vars.GCP_BUCKET_NAME }}/kernels
4232
gzip: false
4333
parent: false
34+
35+
- name: Upload kernels as artifact
36+
if: github.ref_name != 'main'
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: kernels-${{ github.run_id }}
40+
path: ./builds
41+
retention-days: 7

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ This project automates the building of custom Linux kernels for Firecracker micr
2222
```
2323
The built kernels will be placed in `builds/vmlinux-<version>/vmlinux.bin`.
2424

25+
## Development Workflow
26+
- On every push, GitHub Actions will automatically build the kernels and save it as an artifact.
27+
2528
## License
2629

2730
This project is licensed under the Apache License 2.0. See [LICENSE](LICENSE) for details.

terraform/.env.template

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
GCP_PROJECT_ID=
22
PREFIX=
3-
TERRAFORM_STATE_BUCKET=
4-
GCP_REGION=
3+
TERRAFORM_STATE_BUCKET=

terraform/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
tf_vars := TF_VAR_gcp_project_id=$(GCP_PROJECT_ID) \
44
TF_VAR_prefix=$(PREFIX) \
5-
TF_VAR_terraform_state_bucket=$(TERRAFORM_STATE_BUCKET) \
6-
TF_VAR_gcp_region=$(GCP_REGION) \
5+
TF_VAR_terraform_state_bucket=$(TERRAFORM_STATE_BUCKET)
76

87

98
.PHONY: init

terraform/main.tf

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -68,26 +68,6 @@ resource "google_storage_bucket_iam_member" "fc_kernels_bucket_iam" {
6868
member = "serviceAccount:${google_service_account.fc_kernels.email}"
6969
}
7070

71-
resource "google_storage_bucket" "development_bucket" {
72-
location = var.gcp_region
73-
name = "${var.gcp_project_id}-fc-kernels-development"
74-
}
75-
76-
resource "google_storage_bucket_iam_binding" "org_read_access" {
77-
bucket = google_storage_bucket.development_bucket.name
78-
role = "roles/storage.objectViewer"
79-
80-
members = [
81-
"domain:e2b.dev"
82-
]
83-
}
84-
85-
resource "google_storage_bucket_iam_member" "fc_kernels_development_bucket_iam" {
86-
bucket = google_storage_bucket.development_bucket.name
87-
role = "roles/storage.objectUser"
88-
member = "serviceAccount:${google_service_account.fc_kernels.email}"
89-
}
90-
9171
resource "google_service_account_iam_member" "gha_service_account_wif_tokencreator_iam_member" {
9272
service_account_id = google_service_account.fc_kernels.name
9373
role = "roles/iam.workloadIdentityUser"
@@ -122,10 +102,3 @@ resource "github_actions_variable" "gcs_bucket_name" {
122102
value = var.gcs_bucket_name
123103
variable_name = "GCP_BUCKET_NAME"
124104
}
125-
126-
resource "github_actions_variable" "gcs_dev_bucket_name" {
127-
repository = var.github_repository
128-
variable_name = "GCP_DEV_BUCKET_NAME"
129-
value = google_storage_bucket.development_bucket.name
130-
}
131-

terraform/variables.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ variable "github_repository" {
88
default = "fc-kernels"
99
}
1010

11-
variable "gcp_region" {
12-
type = string
13-
}
14-
1511
variable "gcp_project_id" {
1612
description = "The project to deploy the cluster in"
1713
type = string

0 commit comments

Comments
 (0)