Disable e2e #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: '- helper (image deployment)' | ||
on: workflow_call | ||
env: | ||
APP_IMAGE: europeana/statistics-dashboard:${{ github.event.inputs.tag_name || 'develop' }} | ||
jobs: | ||
deploy-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: env | ||
- uses: actions/checkout@v4 | ||
ref: develop | ||
- name: Get Env File | ||
uses: actions/download-artifact@master | ||
with: | ||
name: envFile | ||
path: env_file | ||
- run: | | ||
mv env_file/env_file deployment/${{ github.event.inputs.deploy_environment }} | ||
- name: Inject Variables 1 | ||
uses: cschleiden/replace-tokens@v1 | ||
with: | ||
tokenPrefix: '#{' | ||
tokenSuffix: '}#' | ||
files: '["deployment/${{ github.event.inputs.deploy_environment }}/*.yaml"]' | ||
env: | ||
APP_IMAGE: ${{ env.APP_IMAGE }} | ||
MAX_REPLICAS: '4' | ||
MIN_REPLICAS: '2' | ||
UTILISATION_AVERAGE_PERCENT: '75' | ||
- run: | | ||
ls -l deployment/${{ github.event.inputs.deploy_environment }} | ||
echo APP_IMAGE ${{ env.APP_IMAGE }} | ||
- run: cat deployment/${{ github.event.inputs.deploy_environment }}/deployment.yaml | ||
- run: cat deployment/${{ github.event.inputs.deploy_environment }}/hpa.yaml | ||
- name: Install IBM Cloud CLI | ||
run: | | ||
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh | ||
ibmcloud --version | ||
ibmcloud config --check-version=false | ||
ibmcloud plugin install -f kubernetes-service | ||
ibmcloud plugin install -f container-registry | ||
- name: Login to IBM | ||
run: | | ||
ibmcloud login -a "${{ secrets.IBM_CLOUD_API_ENDPOINT}}" -r "${{ secrets.IBM_CLOUD_REGION}}" --apikey "${{ secrets.IBM_CLOUD_API_KEY }}" | ||
echo 'logged in to IBM' | ||
- name: Configure Cluster | ||
run: | | ||
ibmcloud ks cluster config --cluster "${{ secrets.IBM_CLOUD_K8S_CLUSTER_NAME }}" | ||
echo 'configured cluster' | ||
sleep 5 | ||
- name: Push image | ||
run: | | ||
if ${{ github.event.inputs.delete }} == 'true' | ||
then | ||
kubectl --context ${{ secrets.TEST_K8S_CONTEXT }} delete -n ${{ github.event.inputs.deploy_environment }} -k deployment/${{ github.event.inputs.deploy_environment }} | ||
else | ||
kubectl --context ${{ secrets.TEST_K8S_CONTEXT }} apply -n ${{ github.event.inputs.deploy_environment }} -k deployment/${{ github.event.inputs.deploy_environment }} | ||
fi | ||
# kubectl --context ${{ secrets.TEST_K8S_CONTEXT }} delete -k deployment/${{ github.event.inputs.deploy_environment }} | ||
#- name: Set the Kubernetes context | ||
# uses: azure/k8s-set-context@v2 | ||
# with: | ||
# method: service-account | ||
# from https://nicwortel.nl/blog/2022/continuous-deployment-to-kubernetes-with-github-actions | ||
# Replace <server-url> with the URL of the cluster's API server, which can be found using the following command: | ||
# kubectl config view --minify -o 'jsonpath={.clusters[0].cluster.server}' | ||
# k8s-url: '<server-url>' | ||
# k8s-secret: ${{ secrets.KUBERNETES_SECRET }} | ||
# service-account approach | ||
#- name: Set the Kubernetes context | ||
# uses: azure/k8s-set-context@v2 | ||
# with: | ||
# method: service-account | ||
#k8s-url: <URL of the cluster's API server> | ||
# k8s-url: ${{ secrets.IBM_CLOUD_K8S_CLUSTER_NAME }} | ||
#k8s-secret: <secret associated with the service account> | ||
# k8s-secret: ${{ secrets.IBM_CLOUD_API_KEY }} | ||
# id: setcontext | ||
# Kubeconfig approach | ||
#- uses: azure/k8s-set-context@v1 | ||
# with: | ||
# method: kubeconfig | ||
# kubeconfig: <your kubeconfig> # Use secret (https://developer.github.com/actions/managing-workflows/storing-secrets/) | ||
# context: <context name> #If left unspecified, current-context from kubeconfig is used as default | ||
# id: setcontext | ||
#- name: Deploy to the Kubernetes cluster | ||
# uses: azure/k8s-deploy@v1 | ||
# with: | ||
# namespace: default | ||
# manifests: | | ||
# deployment/${{ github.event.inputs.deploy_environment }} | ||
# deployment/${{ github.event.inputs.deploy_environment }}/deployment.yaml | ||
# deployment/${{ github.event.inputs.deploy_environment }}/hpa.yaml | ||
# deployment/${{ github.event.inputs.deploy_environment }}/ingress.yaml | ||
# deployment/${{ github.event.inputs.deploy_environment }}/kustomization.yaml | ||
# deployment/${{ github.event.inputs.deploy_environment }}/statistics-dashboard-ui-service.yaml | ||
# #deployment/${{ github.event.inputs.deploy_environment }}/nginx.conf | ||
# images: | | ||
# ${{ env.APP_IMAGE }} | ||
# action: deploy | ||
#env: | ||
# APP_IMAGE: europeana/statistics-dashboard:${{ github.event.inputs.tag_name || 'develop' }} |