Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix xen blkfront #136

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
28 changes: 28 additions & 0 deletions .github/workflows/build-upload-ami.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
environment: images
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: DeterminateSystems/nix-installer-action@cd46bde16ab981b0a7b2dce0574509104543276e # v9
- uses: DeterminateSystems/magic-nix-cache-action@eeabdb06718ac63a7021c6132129679a8e22d0c7 # v3
- run: nix build .#legacyAmazonImage
- uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: us-east-1 # because t2.nano not available in eu-north-1
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/upload-ami
- run: |
image_info=./result/nix-support/image-info.json
images_bucket=${{ vars.IMAGES_BUCKET }}
image_id=$(nix run .#upload-ami -- \
--image-info "$image_info" \
--prefix "build-upload-ami/" \
--s3-bucket "$images_bucket" | jq -r '.["us-east-1"]')
echo "$image_id"
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: DeterminateSystems/nix-installer-action@cd46bde16ab981b0a7b2dce0574509104543276e # v9
- uses: DeterminateSystems/magic-nix-cache-action@eeabdb06718ac63a7021c6132129679a8e22d0c7 # v3
- run: nix run nixpkgs#actionlint
- run: nix build .#amazonImage -L --system ${{ matrix.runs-on.system }}
- run: nix flake check -L --system ${{ matrix.runs-on.system }}
2 changes: 1 addition & 1 deletion .github/workflows/upload-legacy-ami.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches:
- main
pull_request:
# pull_request:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0"
Expand Down
1 change: 1 addition & 0 deletions tf/iam_github_actions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ data "aws_iam_policy_document" "upload_ami" {
test = "StringNotEquals"
variable = "ec2:InstanceType"
values = [
"t2.nano",
"t3.nano",
"t3a.nano",
"t4g.nano"
Expand Down
17 changes: 12 additions & 5 deletions upload-ami/src/upload_ami/smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@
from mypy_boto3_ec2.literals import InstanceTypeType


def smoke_test(image_id: str, run_id: str, cancel: bool) -> None:
def smoke_test(
*, image_id: str, instance_type: InstanceTypeType | None, run_id: str, cancel: bool
) -> None:
ec2: EC2Client = boto3.client("ec2")

images = ec2.describe_images(Owners=["self"], ImageIds=[image_id])
assert len(images["Images"]) == 1
image = images["Images"][0]
assert "Architecture" in image
architecture = image["Architecture"]
instance_type: InstanceTypeType
if architecture == "x86_64":
if architecture == "x86_64" and instance_type is None:
instance_type = "t3.nano"
elif architecture == "arm64":
elif architecture == "arm64" and instance_type is None:
instance_type = "t4g.nano"
else:
raise Exception("Unknown architecture: " + architecture)
Expand Down Expand Up @@ -76,10 +77,16 @@ def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--image-id", required=True)
parser.add_argument("--run-id", required=False)
parser.add_argument("--instance-type", required=False, type=str)
parser.add_argument("--cancel", action="store_true", required=False)
args = parser.parse_args()

smoke_test(args.image_id, args.run_id, args.cancel)
smoke_test(
image_id=args.image_id,
instance_type=args.instance_type,
run_id=args.run_id,
cancel=args.cancel,
)


if __name__ == "__main__":
Expand Down