Skip to content

updates for workflow #3

updates for workflow

updates for workflow #3

Workflow file for this run

name: build
on:
push:
branches:
- vNext
pull_request:
branches:
- vNext
jobs:
build:
runs-on: ubuntu-latest
env:
HELM_VERSION: "3.16.3"
KUBECTL_VERSION: "1.31.0"
ISTIO_VERSION: "1.24.1"
LB_CONTROLLER_HELM_VERSION: "1.10.1"
LB_CONTROLLER_CONTAINER_VERSION: "2.8.1"
CDK_LOCATION: "cdk"
PROJECT_NAME: "multi-az-workshop"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Install node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Install dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0'
- name: Install cdk
run: |
npm install aws-cdk -g
cdk --version
- name: Create tmp
run: mkdir -p ${{ github.workspace }}/tmp
- name: Create assets
run: mkdir -p ${{ github.workspace }}/assets
- name: Create helm lambda layer
run: |
file=helm-v$HELM_VERSION-linux-arm64.tar.gz
curl --location https://get.helm.sh/$file --output /tmp/$file
tar -zxvf /tmp/$file --directory /tmp
mkdir -p ${{ github.workspace }}/$CDK_LOCATION/layer/helm
cp /tmp/linux-arm64/helm ${{ github.workspace }}/$CDK_LOCATION/layer/helm/
chmod 0755 ${{ github.workspace }}/$CDK_LOCATION/layer/helm/helm
cd ${{ github.workspace }}/$CDK_LOCATION/layer/layer
zip -r ${{ github.workspace }}/$CDK_LOCATION/helm-layer.zip .
- name: Get kubectl
run: |
$file=kubectl
curl --location https://dl.k8s.io/release/v$KUBECTL_VERSION/bin/linux/arm64/$file --output ${{ github.workspace }}/assets/$file
- name: Get istio
run: |
BASE=https://istio-release.storage.googleapis.com/charts
istio_deps=$("base-$ISTIO_VERSION.tgz" "istiod-$ISTIO_VERSION.tgz" "gateway-$ISTIO_VERSION.tgz" "cni-$ISTIO_VERSION.tgz")
for file in ${istio_deps[@]}; do
curl --location $BASE/$file --output ${{ github.workspace }}/assets/$file
done
- name: Get AWS load balancer controller
run: |
$file=aws-load-balancer-controller-$LB_CONTROLLER_HELM_VERSION.tgz
curl --location https://aws.github.io/eks-charts/$file --output ${{ github.workspace }}/assets/$file
- name: Pull istio container images
run: |
istio_containers=$("istio/install-cni:$ISTIO_VERSION" "istio/pilot:$ISTIO_VERSION" "istio/proxyv2:$ISTIO_VERSION")
for file in ${istio_containers[@]}; do
docker pull $file
name=$(echo $file | cut -d '/' -f2 | cut -d ':' -f1)
docker save $file | gzip > ${{ github.workspace }}/assets/$name.tar.gz
done
- name: Pull AWS container images
run: |
aws_containers=$("eks/aws-load-balancer-controller:v$LB_CONTROLLER_CONTAINER_VERSION-linux_arm64" "cloudwatch-agent/cloudwatch-agent:latest")
BASE=public.ecr.aws
for file in ${aws_containers[@]}; do
docker pull $BASE/$file
name=$(echo $file | cut -d '/' -f2 | cut -d ':' -f1)
docker save $file | gzip > ${{ github.workspace }}/assets/$name.tar.gz
done
- name: Build arm64 web app
run: |
rm -rf ${{ github.workspace }}/app-src/output
mkdir -p ${{ github.workspace }}/app-src/output
mkdir -p ${{ github.workspace }}/app-src/output/src
cd ${{ github.workspace }}/app-src
dotnet publish --configuration Release --runtime linux-arm64 --output ${{ github.workspace }}/app-src/output/src -p:PublishReadyToRun=true -p:PublishReadyToRunShowWarnings=true --self-contained
cd ${{ github.workspace }}/app-src/output
zip -r ${{ github.workspace }}/assets/app_arm64.zip src/
cd ${{ github.workspace }}/app-src
zip -r ${{ github.workspace }}/assets/app_arm64.zip apache/ scripts/ appspec.yml
rm -rf ${{ github.workspace }}/app-src/output
- name: Build failing arm64 web app
run: |
rm -rf ${{ github.workspace }}/app-src/output
mkdir -p ${{ github.workspace }}/app-src/output
mkdir -p ${{ github.workspace }}/app-src/output/src
cd ${{ github.workspace }}/app-src
dotnet publish --configuration Release --runtime linux-arm64 --output ${{ github.workspace }}/app-src/output/src -p:DefineConstants="FAIL" -p:PublishReadyToRun=true -p:PublishReadyToRunShowWarnings=true --self-contained
cd ${{ github.workspace }}/app-src/output
zip -r ${{ github.workspace }}/assets/app_arm64_fail.zip src/
cd ${{ github.workspace }}/app-src
zip -r ${{ github.workspace }}/assets/app_arm64_fail.zip apache/ scripts/ appspec.yml
rm -rf ${{ github.workspace }}/app-src/output
- name: Build arm64 container
run: |
rm -rf ${{ github.workspace }}/app-src/output
mkdir -p ${{ github.workspace }}/app-src/output
mkdir -p ${{ github.workspace }}/app-src/output/src
cd ${{ github.workspace }}/app-src
dotnet publish --configuration Release --runtime linux-musl-arm64 --output ${{ github.workspace }}/app-src/output/src -p:PublishReadyToRun=true -p:PublishReadyToRunShowWarnings=true --self-contained
cd ${{ github.workspace }}/app-src/output
docker build --tag $PROJECT_NAME/app:latest --platform linux/arm64 --build-arg SRC=${{ github.workspace }}/app-src/output/src .
docker save $PROJECT_NAME/app:latest | gzip > ${{ github.workspace }}/assets/container.tar.gz
rm -rf ${{ github.workspace }}/app-src/output
- name: Build assets
run: |
cd ${{ github.workspace }}/$CDK_LOCATION
cdk synth --quiet
${{ github.workspace }}/build/package.py $PROJECT_NAME ${{ github.workspace }} $CDK_LOCATION
cd ${{ github.workspace }}/assets
zip -r ${{ github.workspace }}/content.zip .
cp ${{ github.workspace }}/static/$PROJECT_NAME.json ${{ github.workspace }}/$PROJECT_NAME.template
cd ${{ github.workspace }}
zip ${{ github.workspace }}/content.zip $PROJECT_NAME.template
cp ${{ github.workspace }}/content.zip ${{ github.workspace }}/assets
- name: Upload workshop artifact
uses: actions/upload-artifact@v4
with:
name: WorkshopArtifact
path: |
${{ github.workspace }}/static/**/* \
${{ github.workspace }}/content/**/* \
${{ github.workspace }}/contentspec.yaml
- name: Upload assets artifact
uses: actions/upload-artifact@v4
with:
name: AssetsArtifact
path: ${{ github.workspace }}/assets/**/*
- name: Upload content artifact
uses: actions/upload-artifact@v4
with:
name: ContentArtifact
path: ${{ github.workspace }}/content.zip