-
Notifications
You must be signed in to change notification settings - Fork 7
Feature/build scripts update #20
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
source "$(dirname $(realpath $0))/common.sh" | ||
|
||
build_docker_image() { | ||
local arch=$1 | ||
docker build --target device_plugin --platform linux/$arch -t $IMAGE-$arch $TOP_DIR -f $TOP_DIR/container/Dockerfile | ||
} | ||
|
||
docker build --target builder -t $BUILDER_IMAGE $TOP_DIR -f $TOP_DIR/container/Dockerfile || | ||
die "Failed to build generic builder image" | ||
arch=x86_64 && build_docker_image ${arch} || die "Failed to build ${arch} image" | ||
arch=aarch64 && build_docker_image ${arch} || die "Failed to build ${arch} image" |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
source "$(dirname $(realpath $0))/common.sh" | ||
|
||
main() { | ||
ecr_login | ||
|
||
docker manifest create --amend $ECR_URL/$IMAGE \ | ||
$ECR_URL/$REPOSITORY_NAME:$RELEASE-x86_64 \ | ||
$ECR_URL/$REPOSITORY_NAME:$RELEASE-aarch64 || | ||
die "Cannot create manifest for multiarch image." \ | ||
" Please ensure that both x86_64 and aarch64 images" \ | ||
" already exist in the repository." | ||
|
||
docker manifest inspect $ECR_URL/$IMAGE || | ||
die "Cannot inspect manifest for multiarch image." | ||
|
||
is_a_public_ecr_registry && { | ||
confirm "You are about to push a $RELEASE multiarch manifest to a public repository." \ | ||
"Are you sure you want to continue? (yes/no)" | ||
} | ||
|
||
docker manifest push $ECR_URL/$REPOSITORY_NAME:$RELEASE || | ||
die "Cannot push manifest for multiarch image." | ||
} | ||
|
||
main |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
# Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
source "$(dirname $(realpath $0))/common.sh" | ||
|
||
helm lint $TOP_DIR/helm && helm package $TOP_DIR/helm || | ||
die "Helm package lint failed" | ||
|
||
# assert that packaged file is located in directory | ||
# its best practice to manage helm version and app relase version independent from each other | ||
# VERSION is sourced from packed RELEASE veriable and HELM versions are based on Chart.yaml values | ||
if [[ ! -f $TOP_DIR/aws-nitro-enclaves-k8s-device-plugin-$VERSION.tgz ]]; then | ||
die "Packaged file not found in $TOP_DIR directory" | ||
fi | ||
|
||
# change name of standard HELM archive to explicitly state that it is a packaged chart | ||
mv aws-nitro-enclaves-k8s-device-plugin-$VERSION.tgz $HELM_CHART |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
# Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
set -e | ||
source "$(dirname $(realpath $0))/common.sh" | ||
current_folder="$(dirname $(realpath $0))" | ||
|
||
# version of helm charts are based on /helm/Chart.yaml | ||
# before packaging and publishing validate that the RELEASE version, manifest.yaml | ||
# and helm chart version are in sync and pointig to the new multich arch docker manifest | ||
$current_folder/validate_artifacts_versions.sh | ||
|
||
# build and upload docker artifacts | ||
# version for docker artifacts are based on RELEASE file | ||
$current_folder/build_docker.sh | ||
$current_folder/push_docker.sh | ||
$current_folder/create_manifest_docker.sh | ||
|
||
# build and upload helm artifacts | ||
$current_folder/package_helm.sh | ||
$current_folder/push_helm.sh |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
source "$(dirname $(realpath $0))/common.sh" | ||
|
||
tag_and_push_docker_image() { | ||
local arch=$1 | ||
|
||
docker tag $IMAGE-$arch $ECR_URL/$IMAGE-$arch | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I read There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, Somehow I was convinced to have looked at all the commits, but did in fact only look at the initial 3... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Either way, that change to the variables in common should probably be put together with the changes to the user of these variables. nit: The title of commit 4 is masking that quite a few things are happening apart from formatting. Ideally I'd split the formatting part from any functional changes to make reasoning about changes easier. |
||
say "Pushing $IMAGE-$arch to $ECR_URL..." | ||
docker push $ECR_URL/$IMAGE-$arch | ||
} | ||
|
||
main() { | ||
ecr_login | ||
|
||
aws ecr-public --region $ECR_REGION describe-repositories \ | ||
--repository-names "$REPOSITORY_NAME" >/dev/null || | ||
die "There is no repository named $REPOSITORY_NAME in" \ | ||
"$ECR_REGION region." | ||
|
||
is_a_public_ecr_registry && { | ||
confirm "You are about to push $RELEASE docker images on a public repository." \ | ||
"Are you sure you want to continue?" | ||
} | ||
|
||
arch=x86_64 && tag_and_push_docker_image ${arch} || die "Failed to push $arch docker image" | ||
arch=aarch64 && tag_and_push_docker_image ${arch} || die "Failed to push $arch docker image" | ||
} | ||
|
||
main |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
# Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
source "$(dirname $(realpath $0))/common.sh" | ||
|
||
main() { | ||
helm_login | ||
|
||
aws ecr-public --region $ECR_REGION describe-repositories \ | ||
--repository-names "charts/$REPOSITORY_NAME" >/dev/null || | ||
die "There is no repository named $REPOSITORY_NAME in" \ | ||
"$ECR_REGION region." | ||
|
||
is_a_public_ecr_registry && { | ||
confirm "You are about to push a $RELEASE Helm chart on a public repository." \ | ||
"Are you sure you want to continue?" | ||
} | ||
say "Pushing $HELM_CHART to $ECR_HELM_URL..." | ||
helm push aws-nitro-enclaves-k8s-device-plugin-chart-$VERSION.tgz oci://$ECR_HELM_URL || | ||
die "Failed to push $HELM_CHART to $ECR_HELM_URL." | ||
} | ||
|
||
main |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
# Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
source "$(dirname $(realpath $0))/common.sh" | ||
|
||
# extract version of kubernetes manifest | ||
k8s_manifest=$TOP_DIR/aws-nitro-enclaves-k8s-ds.yaml | ||
k8s_version=$(yq '.spec.template.spec.containers[]?.image' "$k8s_manifest" | grep -o '[^:]*$') | ||
|
||
# extract version of helm chart, should be based on k8s manifest | ||
helm_chart=$TOP_DIR/helm/values.yaml | ||
helm_version=$(yq '.awsNitroEnclavesK8SDaemonset.awsNitroEnclavesK8SDp.image.tag' $helm_chart) | ||
|
||
echo "Release: $RELEASE" | ||
echo "Kubernetes Manifest: $k8s_version" | ||
echo "Helm Chart: $helm_version" | ||
|
||
if [ $RELEASE != $k8s_version ] || [ $k8s_version != $helm_version ]; then | ||
die "Versions in release $RELEASE are not in sync" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I read this correctly then this will expand to
$ECR_URL/aws-nitro-enclaves-k8s-device-plugin:v0.2-x86_64
when run on an x86 machine. I do not think this is what we actually want. (?)Probably better to stay with
$ECR_URL/$REPOSITORY_NAME
as it was before.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arch
got removed from image tag. Image just points at the generic image name + version tag now: https://github.com/aws/aws-nitro-enclaves-k8s-device-plugin/pull/20/files#diff-b23204e92f793e233cf28605758e6f1d4849830577492c85f00593f977527e27R17