Skip to content

Commit

Permalink
Merge pull request #45 from thehyve/devops/FAIRSPC-57_github_actions
Browse files Browse the repository at this point in the history
Devops/fairspc 57 GitHub actions
  • Loading branch information
tgreenwood authored Apr 8, 2024
2 parents 1858071 + 5aeac88 commit ac15020
Show file tree
Hide file tree
Showing 18 changed files with 147 additions and 227 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/build_and_upload_docker_image_on_push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build & Upload Fairspace-Jupyter Docker image

on:
push:

jobs:
build-and-upload-jupyterhub:
name: Build & Upload Fairspace-Jupyter (K8s Hub) Docker image
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Get version tag for artifact
run: |
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
echo "Building images from the branch: $BRANCH"
VER=$(cat ./VERSION)
echo "Building images of version: $VER"
if [ $BRANCH != "release" ]
then
VER=$VER-SNAPSHOT
fi
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ vars.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}/jupyterhub-hub

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./projects/jupyterhub-hub/
push: ${{github.ref == 'refs/heads/release' || github.ref == 'refs/heads/dev'}}
tags: ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}/jupyterhub-hub:${{ env.VERSION }}
labels: ${{ steps.meta.outputs.labels }}

build-and-upload-jupyterhub-singleuser:
name: Build & Upload Fairspace-Jupyter (Single User) Docker image
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Get version tag for artifact
run: |
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
echo "Building images from the branch: $BRANCH"
VER=$(cat ./VERSION)
echo "Building images of version: $VER"
if [ $BRANCH != "release" ]
then
VER=$VER-SNAPSHOT
fi
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ vars.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}/jupyterhub-singleuser

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./projects/jupyterhub-singleuser/
push: ${{github.ref == 'refs/heads/release' || github.ref == 'refs/heads/dev'}}
tags: ${{ vars.DOCKER_REGISTRY }}/${{ github.repository }}/jupyterhub-singleuser:${{ env.VERSION }}
labels: ${{ steps.meta.outputs.labels }}
59 changes: 59 additions & 0 deletions .github/workflows/package_and_push_helm_chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Package and Push Helm Chart

on:
push:
workflow_dispatch:
inputs:
version:
description: "Version of the Helm chart to push"
required: false

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Prepare version
run: |
VERSION=$(cat ./VERSION)
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
echo "Building images from the branch: $BRANCH"
if [ $BRANCH != "release" ]; then
VERSION=$VERSION-SNAPSHOT
fi
# override version of custom input is provided
if [[ -n "${{ github.event.inputs.version }}" ]]; then
VERSION=${{ github.event.inputs.version }}
fi
echo "Helm charts version to be deployed: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Setup Helm
uses: azure/[email protected]
with:
version: ${{ vars.HELM_VERSION }}

- name: Login with Helm
run: |
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ${{ vars.HELM_REGISTRY }} --username ${{ github.repository_owner }} --password-stdin
- name: Add/update Helm dependencies
run: |
helm repo add jupyterhub https://jupyterhub.github.io/helm-chart
helm dependency update "charts/jupyter"
- name: Lint Helm chart
run: |
helm lint "charts/jupyter"
- name: Package Helm chart
run: |
helm package "charts/jupyter" --version ${{ env.VERSION }}
- name: Push Helm chart to repository
if: github.ref == 'refs/heads/release' || github.ref == 'refs/heads/dev'
run: |
helm push "fairspace-jupyter-${{ env.VERSION }}.tgz" "oci://${{ vars.HELM_REGISTRY }}"
92 changes: 0 additions & 92 deletions .travis.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .travis/build-condition.sh

This file was deleted.

52 changes: 0 additions & 52 deletions .travis/build.sh

This file was deleted.

Binary file removed .travis/ci-service-account.json.enc
Binary file not shown.
8 changes: 0 additions & 8 deletions charts/.travis/build.sh

This file was deleted.

16 changes: 0 additions & 16 deletions charts/.travis/install.sh

This file was deleted.

2 changes: 1 addition & 1 deletion charts/jupyter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
appVersion: "1.0"
description: Helm chart to install Jupyter along with a Fairspace workspace
name: jupyter
name: fairspace-jupyter
version: 0.0.0-RELEASEVERSION

dependencies:
Expand Down
4 changes: 2 additions & 2 deletions charts/jupyter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ The connection to the workspace should be configured in the `values.yaml` file.

Install [the Google Cloud SDK](https://cloud.google.com/sdk/install), ensure
that your Google account has access to the fairspace-207108 GCP project,
log in using `gcloud auth login`, and configure Docker for access to the GCP
registries using `gcloud auth configure-docker`.
log in using `gcloud auth login`. Make sure you have access to the [docker registry](ghcr.io/thehyve/fairspace-jupyter)
and [Helm Chart repository](ghcr.io/thehyve/fairspace-jupyter/helm-charts).

A working instance of a fairspace workspace should be setup. Relevant parameters must be
used for configuration of JupyterHub.
Expand Down
3 changes: 0 additions & 3 deletions projects/jupyterhub-hub/.travis/build.sh

This file was deleted.

2 changes: 0 additions & 2 deletions projects/jupyterhub-hub/.travis/env.sh

This file was deleted.

3 changes: 0 additions & 3 deletions projects/jupyterhub-hub/.travis/release.sh

This file was deleted.

1 change: 0 additions & 1 deletion projects/jupyterhub-hub/VERSION

This file was deleted.

3 changes: 0 additions & 3 deletions projects/jupyterhub-singleuser/.travis/build.sh

This file was deleted.

2 changes: 0 additions & 2 deletions projects/jupyterhub-singleuser/.travis/env.sh

This file was deleted.

Loading

0 comments on commit ac15020

Please sign in to comment.