@@ -13,25 +13,14 @@ inputs:
1313 domain :
1414 required : false
1515 description : The domain to use for the deployment.
16- metro :
17- required : false
18- description : Unikraft Cloud Metro.
19- default : http://api.dal2.unikraft.cloud/v1
2016 memory :
2117 required : false
2218 description : Set the memory size.
23- default : 1536Mi
24- args :
25- required : false
26- description : Optional arguments you pass to kraft cloud deploy.
19+ default : 1536M
2720 port :
2821 required : false
2922 description : The port the service listens on.
3023 default : " 3000"
31- log-level :
32- required : false
33- default : error
34- description : Set the logging level.
3524
3625outputs :
3726 domain :
@@ -58,39 +47,39 @@ runs:
5847 set -e;
5948
6049 # Create the service if it does not exist.
61- _SVC=$(kraft cloud --metro "${{ inputs.metro }}" service get "${{ inputs.name }}" -o raw | jq -r '.data.service_groups[].error')
62- if [[ "${_SVC}" == "8" ]]; then
63- if [[ "${{ inputs.domain }}" == "" ]]; then
64- kraft cloud --metro "${{ inputs.metro }}" service create \
65- --subdomain "${{ inputs.name }}" \
66- --name "${{ inputs.name }}" \
67- "443:${{ inputs.port }}" \
68- ;
69- else
70- kraft cloud --metro "${{ inputs.metro }}" service create \
71- --domain "${{ inputs.domain }}" \
72- --name "${{ inputs.name }}" \
73- "443:${{ inputs.port }}" \
74- ;
75- fi
50+ if ! unikraft service get "${{ inputs.name }}" -o quiet 2>/dev/null; then
51+ unikraft service create \
52+ --domains "${{ inputs.domain || inputs.name }}" \
53+ --name "${{ inputs.name }}" \
54+ --services "443:${{ inputs.port }}/http+tls" \
55+ ;
7656 fi
7757
7858 # Save the generated domain as an output variable
79- echo "domain=$(kraft cloud --metro ${{ inputs.metro }} service get ${{ inputs.name }} -o raw | jq -r '.data.service_groups [0].domains[0].fqdn')" >> $GITHUB_OUTPUT
59+ echo "domain=$(unikraft service get ${{ inputs.name }} -o json | jq -r '.[0].domains[0].fqdn')" >> $GITHUB_OUTPUT
8060
8161 - name : Deploy
8262 id : deploy
8363 shell : bash
8464 run : |
85- kraft cloud deploy \
86- --rollout remove \
87- --rollout-qualifier all \
65+ unikraft build \
66+ --output "oci://internal/${{ inputs.name }}:latest" \
67+ .;
68+
69+ # Remove any existing instance(s) on this service before running the
70+ # new one, so the service always ends up with just the latest build.
71+ unikraft instance delete \
72+ --filter "service.name==${{ inputs.name }}" \
73+ --force \
74+ 2>/dev/null || true;
75+
76+ unikraft run \
77+ --autostart \
78+ --restart always \
8879 --memory "${{ inputs.memory }}" \
8980 --service "${{ inputs.name }}" \
90- --image "${{ inputs.name }}" \
91- --as kraftfile-runtime \
92- ${{ inputs.args }} \
93- .;
81+ --image "internal/${{ inputs.name }}:latest" \
82+ ;
9483
9584 - name : Test liveliness
9685 id : liveliness
10493 if : ${{ steps.liveliness.outcome == 'failure' }}
10594 shell : bash
10695 run : |
107- kraft cloud service logs "${{ inputs.name }}"
96+ _INST=$(unikraft service get "${{ inputs.name }}" -o json | jq -r '.[0].instances[0].name')
97+ unikraft instance logs "${_INST}"
10898 exit 1
10999
110100 - name : Update Deployment
0 commit comments