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

[GSC] Adding Github action to build Graphene Docker image #1857

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .ci/gsc.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ pipeline {
'''
}
}
stage('Test_CD') {
steps {
sh '''
# Test the build of Graphene base images which are automatically
# pushed to Docker Hub after a merge. This does not test the actual
# continuous deployment Github action, instead only tests the
# underlying script.
cd Tools/gsc
make build-images
make distclean
'''
}
}
stage('Test') {
steps {
sh '''
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/graphene-base-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Graphene Docker Image CD

on:
push:
branches: [ master ]

jobs:

build:
if: ${{ github.repository == 'oscarlab/graphene' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Python dependencies
run: |
pip install jinja2 pyyaml docker
- name: Build the Graphene Docker image
env: # Set Docker Hub account information to environment variables
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
cd Tools/gsc
make build-images
make push-images
33 changes: 30 additions & 3 deletions Tools/gsc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
# templates/Dockerfile.*.compile.template changes), these automatically generated files need to be
# updated. Generally, changes to Graphene do not require rebuilding these Docker files.

IMAGES=graphene_aks
IMAGES=aks
VERSIONS=latest
# Official Docker Hub organization name. In case of a name change in Docker Hub, this name must be
# changed.
DOCKERHUB_ORGANIZATION=graphenelibos

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

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

images/graphene_aks.latest.dockerfile: config.aks.master.yaml
images:
mkdir -p images

images/graphene_aks.latest.dockerfile: config.aks.master.yaml images
./gsc build-graphene -f -c $< graphene-aks
mv build/gsc-graphene-aks/Dockerfile.compile $@

.PHONY: generate-dockerfiles
generate-dockerfiles: $(addsuffix .dockerfile, $(addprefix $(addprefix images/, graphene_${IMAGES}), .${VERSIONS}))

.PHONY: build-images
build-images: $(addprefix $(addprefix build-, $(IMAGES))-, $(VERSIONS))

.PHONY: build-aks-%
build-aks-%: images/graphene_aks.%.dockerfile
docker build --rm --no-cache -t $(DOCKERHUB_ORGANIZATION)/aks:$* -f images/graphene_aks.$*.dockerfile images/

.PHONY: push-images
push-images: $(addprefix $(addprefix push-, $(IMAGES))-, $(VERSIONS))

.PHONY: push-aks-%
push-aks-%:
docker push $(DOCKERHUB_ORGANIZATION)/aks:$*

.PHONY: distclean
distclean: clean
$(RM) images/*
Expand All @@ -32,3 +55,7 @@ distclean: clean
.PHONY: clean
clean:
$(RM) config.aks.*.yaml

.PHONY: clean-images
clean-images:
docker rmi -f $(addprefix $(addprefix $(DOCKERHUB_ORGANIZATION)/, $(IMAGES)):, $(VERSIONS))
36 changes: 0 additions & 36 deletions Tools/gsc/images/graphene_aks.latest.dockerfile

This file was deleted.