Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

Commit d24242a

Browse files
committed
Continuous Deployment via Github action to build public Graphene Docker image.
Add Github action that logs into Docker Hub via Github Secrets, builds the Graphene base Docker image (currently only for AKS), and pushes the resulting image to Docker Hub. Signed-off-by: Anjo Vahldiek-Oberwagner <anjovahldiek@gmail.com>
1 parent 1102fee commit d24242a

File tree

4 files changed

+72
-39
lines changed

4 files changed

+72
-39
lines changed

.ci/gsc.jenkinsfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ pipeline {
1717
'''
1818
}
1919
}
20+
stage('Test_CD') {
21+
steps {
22+
sh '''
23+
# Test the build of Graphene base images which are automatically
24+
# pushed to Docker Hub after a merge. This does not test the actual
25+
# continuous deployment Github action, instead only tests the
26+
# underlying script.
27+
cd Tools/gsc
28+
make build-images
29+
make distclean
30+
'''
31+
}
32+
}
2033
stage('Test') {
2134
steps {
2235
sh '''
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Graphene Docker Image CD
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
9+
build:
10+
if: ${{ github.repository == 'oscarlab/graphene' }}
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python 3.8
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.8
18+
- name: Install Python dependencies
19+
run: |
20+
pip install jinja2 pyyaml docker
21+
- name: Build the Graphene Docker image
22+
env: # Set Docker Hub account information to environment variables
23+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
24+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
25+
run: |
26+
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
27+
cd Tools/gsc
28+
make build-images
29+
make push-images

Tools/gsc/Makefile

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
# templates/Dockerfile.*.compile.template changes), these automatically generated files need to be
66
# updated. Generally, changes to Graphene do not require rebuilding these Docker files.
77

8-
IMAGES=graphene_aks
8+
IMAGES=aks
99
VERSIONS=latest
10+
# Official Docker Hub organization name. In case of a name change in Docker Hub, this name must be
11+
# changed.
12+
DOCKERHUB_ORGANIZATION=graphenelibos
1013

11-
all: $(addsuffix .dockerfile, $(addprefix $(addprefix images/, ${IMAGES}), .${VERSIONS}))
14+
all: generate-dockerfiles build-images
1215

1316
config.aks.%.yaml:
1417
printf \
@@ -20,10 +23,30 @@ config.aks.%.yaml:
2023
Repository: \"https://github.com/intel/SGXDataCenterAttestationPrimitives.git\"\n\
2124
Branch: \"DCAP_1.7 && cp -r driver/linux/* .\"\n" > $@
2225

23-
images/graphene_aks.latest.dockerfile: config.aks.master.yaml
26+
images:
27+
mkdir -p images
28+
29+
images/graphene_aks.latest.dockerfile: config.aks.master.yaml images
2430
./gsc build-graphene -f -c $< graphene-aks
2531
mv build/gsc-graphene-aks/Dockerfile.compile $@
2632

33+
.PHONY: generate-dockerfiles
34+
generate-dockerfiles: $(addsuffix .dockerfile, $(addprefix $(addprefix images/, graphene_${IMAGES}), .${VERSIONS}))
35+
36+
.PHONY: build-images
37+
build-images: $(addprefix $(addprefix build-, $(IMAGES))-, $(VERSIONS))
38+
39+
.PHONY: build-aks-%
40+
build-aks-%: images/graphene_aks.%.dockerfile
41+
docker build --rm --no-cache -t $(DOCKERHUB_ORGANIZATION)/aks:$* -f images/graphene_aks.$*.dockerfile images/
42+
43+
.PHONY: push-images
44+
push-images: $(addprefix $(addprefix push-, $(IMAGES))-, $(VERSIONS))
45+
46+
.PHONY: push-aks-%
47+
push-aks-%:
48+
docker push $(DOCKERHUB_ORGANIZATION)/aks:$*
49+
2750
.PHONY: distclean
2851
distclean: clean
2952
$(RM) images/*
@@ -32,3 +55,7 @@ distclean: clean
3255
.PHONY: clean
3356
clean:
3457
$(RM) config.aks.*.yaml
58+
59+
.PHONY: clean-images
60+
clean-images:
61+
docker rmi -f $(addprefix $(addprefix $(DOCKERHUB_ORGANIZATION)/, $(IMAGES)):, $(VERSIONS))

Tools/gsc/images/graphene_aks.latest.dockerfile

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)