Skip to content

Commit 3c794eb

Browse files
fix policy generation by using genpolicy new release (#42)
* fix policy generation by using genpolicy new release
1 parent e31bdc1 commit 3c794eb

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

.github/workflows/_deploy_kafka_test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,33 @@ jobs:
8888
run: |
8989
az aks get-credentials --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --overwrite-existing
9090
cd main/kafka
91+
92+
sudo cat /root/.docker/config.json
93+
sudo mv ~/.docker/config.json /root/.docker/config.json
94+
echo "docker config.json looks like the following: "
95+
sudo cat /root/.docker/config.json
96+
curl -LO https://github.com/microsoft/kata-containers/releases/download/3.2.0.azl1.genpolicy0/genpolicy --fail-with-body
97+
curl -LO https://github.com/microsoft/kata-containers/releases/download/3.2.0.azl1.genpolicy0/genpolicy-settings.json --fail-with-body
98+
curl -LO https://github.com/microsoft/kata-containers/releases/download/3.2.0.azl1.genpolicy0/rules.rego --fail-with-body
99+
chmod +x genpolicy
100+
chmod +x genpolicy-settings.json
101+
chmod +x rules.rego
102+
echo "Containerd Status"
103+
systemctl status containerd
104+
echo "Check toml File Status"
105+
sudo cat /etc/containerd/config.toml
106+
echo "Repalce toml File Content"
107+
sudo sed -i 's/disabled_plugins = \["cri"\]/disabled_plugins = \[\]/' /etc/containerd/config.toml
108+
echo "Check toml File Status Again"
109+
sudo cat /etc/containerd/config.toml
110+
echo "Restart Containerd"
111+
sudo systemctl restart containerd
112+
echo "Sleep for 60 Seconds"
113+
sleep 60
114+
echo "Check to see whether containerd is running"
115+
sudo systemctl is-active containerd
116+
117+
91118
chmod +x test-setup.sh
92119
randomid=$(openssl rand -hex 8 | tr -d '\n')
93120
export SkrClientKID=kafka-demo-pipeline-${randomid}

.github/workflows/kafka_demo_test.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,20 @@ on:
2020
options:
2121
- mcr.microsoft.com
2222
- confidentialsidecars.azurecr.io
23+
- accsamplesmcr.azurecr.io
2324
key-release-image:
2425
description: "The image of the SKR sidecar to use"
2526
required: true
2627
default: "aci/skr:2.7"
2728
type: string
2829
consumer-image:
2930
description: "Consumer Image"
30-
default: "mcr.microsoft.com/acc/samples/kafka/consumer:2.0"
31+
default: "public/acc/samples/kafka/consumer:2.0"
3132
required: true
3233
type: string
3334
producer-image:
3435
description: "Producer Image"
35-
default: "mcr.microsoft.com/acc/samples/kafka/producer:2.0"
36+
default: "public/acc/samples/kafka/consumer:2.0"
3637
required: true
3738
type: string
3839
merge_group:
@@ -130,7 +131,7 @@ jobs:
130131

131132
cleanup:
132133
name: Clean Up
133-
if: always() && needs.create-aks-cluster.result == 'success' && (needs.push_images.result == 'success' || needs.push_images.result == 'skipped')
134+
if: always() && needs.create-aks-cluster.result == 'success' && needs.push_images.result == 'success'
134135
uses: ./.github/workflows/_cleanup.yml
135136
needs: [push_images, create-aks-cluster, deploy-kafka-test, test-workload]
136137
secrets: inherit

kafka/test-setup.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ sed -i 's/$EVENTHUB_NAMESPACE/'"$EVENTHUB_NAMESPACE"'/g; s/$EVENTHUB/'"$EVENTHUB
5252
echo "Generating Security Policy for consumer"
5353

5454

55-
export WORKLOAD_MEASUREMENT=$(az confcom katapolicygen -y consumer/consumer.yaml --print-policy | base64 --decode | sha256sum | cut -d' ' -f1)
55+
#export WORKLOAD_MEASUREMENT=$(az confcom katapolicygen -y consumer/consumer.yaml --print-policy | base64 --decode | sha256sum | cut -d' ' -f1)
56+
# This is a workaround before confcom extension picks up the Genpolicy new release where it introduces the -d flag
57+
export WORKLOAD_MEASUREMENT=$(sudo $(pwd)/genpolicy -y consumer/consumer.yaml -p $(pwd)/rules.rego -j $(pwd)/genpolicy-settings.json -d --raw-out | sha256sum | cut -d' ' -f1)
5658
cat consumer/consumer.yaml
5759
if [[ -z "${WORKLOAD_MEASUREMENT}" ]]; then
5860
echo "Warning: Env WORKLOAD_MEASUREMENT is not set. Set this to condition releasing your key on your security policy matching the expected value. Recommended for production workloads."

0 commit comments

Comments
 (0)