Skip to content

Commit 19a0614

Browse files
committed
feat: add sconify-release workflow
1 parent fd73419 commit 19a0614

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Sconify and push TEE image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
sconify_version:
7+
default: 5.9.1-v16
8+
required: true
9+
10+
jobs:
11+
prepare:
12+
name: Determine image tag
13+
if: github.repository_owner == 'iExecBlockchainComputing'
14+
runs-on: ubuntu-latest
15+
outputs:
16+
image_tag: ${{ steps.determine-tag.outputs.image_tag }}
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Determine base tag
24+
id: determine-tag
25+
run: |
26+
if [ "${{ github.ref_type }}" != "tag" ]; then
27+
echo "Error: This workflow must be run on a tag"
28+
echo "Current ref type: ${{ github.ref_type }}"
29+
echo "Current ref: ${{ github.ref }}"
30+
exit 1
31+
fi
32+
33+
TAG_ON_MAIN=$(git branch -r --contains ${{ github.sha }} 'origin/main')
34+
35+
if [ -z "$TAG_ON_MAIN" ] ; then
36+
echo "Error: Tag ${{ github.ref_name }} is not on main branch"
37+
echo "Tags must be created on main branch to generate X.Y.Z image tags"
38+
exit 1
39+
fi
40+
41+
GITHUB_REF_NAME="${{ github.ref_name }}"
42+
echo "Processing tag on main branch: ${{ github.ref_name }}"
43+
echo "image_tag=${GITHUB_REF_NAME#v}" | tee -a $GITHUB_OUTPUT
44+
45+
build-tee-image:
46+
name: Sconify TEE image
47+
needs: prepare
48+
runs-on: ubuntu-latest
49+
env:
50+
IMG_FROM: docker-regis.iex.ec/python-hello-world:${{ needs.prepare.outputs.image_tag }}
51+
IMG_TO: docker-regis.iex.ec/python-hello-world:${{ needs.prepare.outputs.image_tag }}-sconify-${{ inputs.sconify_version }}-production
52+
SCONIFY_IMAGE: registry.scontain.com/scone-production/iexec-sconify-image:${{ inputs.sconify_version }}
53+
steps:
54+
- name: Login to Scontain registry
55+
uses: docker/login-action@v3
56+
with:
57+
registry: registry.scontain.com
58+
username: ${{ secrets.SCONTAIN_REGISTRY_USERNAME }}
59+
password: ${{ secrets.SCONTAIN_REGISTRY_PAT }}
60+
- name: Login to Docker regis
61+
uses: docker/login-action@v3
62+
with:
63+
registry: docker-regis.iex.ec
64+
username: ${{ secrets.NEXUS_USERNAME }}
65+
password: ${{ secrets.NEXUS_PASSWORD }}
66+
- name: Pull sconification tools
67+
run: docker pull ${{ env.SCONIFY_IMAGE }}
68+
- name: Pull native image
69+
run: docker pull ${{ env.IMG_FROM }}
70+
- name: Sconify
71+
run: |
72+
TEMP_KEY=$(mktemp)
73+
echo "${{ secrets.SCONIFY_SIGNING_PRIVATE_KEY }}" > "$TEMP_KEY"
74+
chmod 600 "$TEMP_KEY"
75+
trap "rm -f $TEMP_KEY" EXIT
76+
77+
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "$TEMP_KEY:/sig.pem:ro" ${{ env.SCONIFY_IMAGE }} \
78+
sconify_iexec --cli=${{ env.SCONIFY_IMAGE }} --crosscompiler=${{ env.SCONIFY_IMAGE }} \
79+
--from=${{ env.IMG_FROM }} --to=${{ env.IMG_TO }} --binary-fs --fs-dir=/app --binary=/usr/local/bin/python3.7 \
80+
--heap=1G --host-path=/etc/hosts --host-path=/etc/resolv.conf --no-color --verbose \
81+
--scone-signer=/sig.pem
82+
echo
83+
docker run --rm -e SCONE_HASH=1 ${{ env.IMG_TO }}
84+
- name: Push TEE image
85+
run: docker push ${{ env.IMG_TO }}
86+
- name: Clean OCI images
87+
if: always()
88+
run: docker image rm -f ${{ env.IMG_FROM }} ${{ env.IMG_TO }} ${{ env.SCONIFY_IMAGE }}
89+

0 commit comments

Comments
 (0)