Skip to content

Commit

Permalink
Merge pull request #338 from SlateFoundation/develop
Browse files Browse the repository at this point in the history
Release: v2.18.8
  • Loading branch information
themightychris authored Mar 28, 2022
2 parents 77b722b + fb12546 commit a3e97f8
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 205 deletions.
51 changes: 33 additions & 18 deletions .github/workflows/k8s-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ name: Deploy K8s Preview

on:
pull_request:
branches: [develop]
types: [opened, reopened, synchronize]
branches: [ develop ]
types: [ opened, reopened, synchronize ]
push:
branches: [develop]
branches: [ develop ]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

DOCKER_REGISTRY: docker.pkg.github.com
DOCKER_PACKAGE: slate-composite
DOCKER_REGISTRY: ghcr.io
DOCKER_PACKAGE: site-composite

KUBE_NAMESPACE: ${{ secrets.kube_namespace }}
KUBE_CONFIG_DATA: ${{ secrets.kube_config }}
KUBE_HOSTNAME: ${{ secrets.kube_hostname }}
KUBE_CONFIG_DATA: ${{ secrets.KUBECONFIG_BASE64 }}
KUBE_NAMESPACE: slate
KUBE_HOSTNAME: slate.sandbox.k8s.jarv.us

DATABASE_NAME: slate

Expand Down Expand Up @@ -92,6 +92,15 @@ jobs:
fetch: false
holobranch: fixtures

- id: helm-projection
name: 'Project holobranch: helm-chart'
uses: JarvusInnovations/hologit@actions/projector/v1
with:
# use HEAD checked out above by checkout action
ref: HEAD
fetch: false
holobranch: helm-chart

- name: Build & push Docker image
uses: whoan/docker-build-with-cache-action@v5
with:
Expand All @@ -116,11 +125,9 @@ jobs:
- name: Deploy instance via Helm template
run: |
set -e
docker_image="${DOCKER_REGISTRY}/${DOCKER_REPOSITORY}/${DOCKER_PACKAGE}:${RELEASE_NAME}"
release_hostname="${RELEASE_NAME}.${KUBE_HOSTNAME}"
echo "Ensuring current context is namespace ${KUBE_NAMESPACE}"
kubectl config set-context --current --namespace="${KUBE_NAMESPACE}"
echo "Listing pods existing before deploy"
Expand All @@ -130,14 +137,22 @@ jobs:
| sort \
| tee ./.pods-before
echo "Using helm upgrade to apply ./helm-chart to release ${RELEASE_NAME}"
helm upgrade "${RELEASE_NAME}" ./helm-chart \
echo "Extracting projected helm-chart to temporary directory"
temp_dir=$(mktemp -d)
git archive --format=tar "${{ steps.helm-projection.outputs.tree }}" | ( cd "${temp_dir}" && tar -xf - )
echo "Using helm upgrade to apply helm-chart to release ${RELEASE_NAME}"
helm upgrade "${RELEASE_NAME}" "${temp_dir}" \
--install \
--set name="${RELEASE_NAME}" \
--set namespace="${KUBE_NAMESPACE}" \
--set image="${docker_image}" \
--set hostname="${release_hostname}" \
--set hab.runtime.error.display=true
--namespace "${KUBE_NAMESPACE}" \
--set site.name="${RELEASE_NAME}" \
--set site.title="slate/${RELEASE_NAME}" \
--set site.image.repository="${DOCKER_REGISTRY}/${DOCKER_REPOSITORY}/${DOCKER_PACKAGE}" \
--set site.image.tag="${RELEASE_NAME}" \
--set ingress.enabled=true \
--set site.canonicalHostname="${release_hostname}" \
--set site.displayErrors=true \
--set hab.license=accept-no-persist
echo "Listing pods existing after deploy"
kubectl get pods \
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/k8s-destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: Destroy K8s Preview

on:
pull_request:
branches: [develop]
types: [closed]
branches: [ develop ]
types: [ closed ]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

KUBE_NAMESPACE: ${{ secrets.kube_namespace }}
KUBE_CONFIG_DATA: ${{ secrets.kube_config }}
KUBE_CONFIG_DATA: ${{ secrets.KUBECONFIG_BASE64 }}
KUBE_NAMESPACE: slate

RELEASE_NAME: pr-${{ github.event.number }}

Expand All @@ -21,15 +21,13 @@ jobs:

- name: Configure kubectl
run: |
set -e
test -e ~/.kube || mkdir ~/.kube
printf '%s' "$KUBE_CONFIG_DATA" | base64 -d > ~/.kube/config
- name: Delete PR Deployment
run: |
set -e
kubectl config set-context --current --namespace="${KUBE_NAMESPACE}"
kubectl delete deployment,replicaset,ingress,all -l "app.kubernetes.io/instance=${RELEASE_NAME}"
helm uninstall "${RELEASE_NAME}"
kubectl delete secret "${RELEASE_NAME}-tls"
- name: Deactivate Github Deployment
Expand Down
2 changes: 1 addition & 1 deletion .holo/sources/skeleton-v2.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[holosource]
url = "https://github.com/JarvusInnovations/emergence-skeleton-v2"
ref = "refs/tags/v2.9.3"
ref = "refs/tags/v2.9.6"
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ RUN hab pkg exec core/hab-plan-build hab-plan-build /src/habitat/composite
FROM habitat as runtime

# configure persistent volumes
RUN hab pkg exec core/coreutils mkdir -p '/hab/svc/mysql/data' '/hab/svc/slate/data' '/hab/svc/nginx/files' \
&& hab pkg exec core/coreutils chown hab:hab -R '/hab/svc/mysql/data' '/hab/svc/slate/data' '/hab/svc/nginx/files'
RUN hab pkg exec core/coreutils mkdir -p '/hab/svc/mysql/data' '/hab/svc/site/data' '/hab/svc/nginx/files' \
&& hab pkg exec core/coreutils chown hab:hab -R '/hab/svc/mysql/data' '/hab/svc/site/data' '/hab/svc/nginx/files'

# configure entrypoint
VOLUME ["/hab/svc/mysql/data", "/hab/svc/slate/data", "/hab/svc/nginx/files"]
VOLUME ["/hab/svc/mysql/data", "/hab/svc/site/data", "/hab/svc/nginx/files"]
ENTRYPOINT ["hab", "sup", "run"]
CMD ["slate/slate-composite"]
CMD ["slate/site-composite"]

# install .hart artifact from builder stage
COPY --from=projector /hab/cache/artifacts/$HAB_ORIGIN-* /hab/cache/artifacts/
Expand Down
2 changes: 1 addition & 1 deletion habitat/composite/plan.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
composite_app_pkg_name=slate
composite_app_pkg_name=site
pkg_name="${composite_app_pkg_name}-composite"
pkg_origin=slate
pkg_maintainer="Jarvus Innovations <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion habitat/plan.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pkg_name=slate
pkg_name=site
pkg_origin=slate
pkg_maintainer="Jarvus Innovations <[email protected]>"
pkg_scaffolding=emergence/scaffolding-site
Expand Down
23 changes: 0 additions & 23 deletions helm-chart/Chart.yaml

This file was deleted.

41 changes: 0 additions & 41 deletions helm-chart/templates/_helpers.tpl

This file was deleted.

92 changes: 0 additions & 92 deletions helm-chart/templates/deployment.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions helm-chart/values.yaml

This file was deleted.

0 comments on commit a3e97f8

Please sign in to comment.