4e20b52618
* Added Cloudrail according to instructions and existing examples * Adding Cloudrail according to documentation and examples * Oops * Add original Fortify on Demand workflow * Update Fortify on Demand workflow * Update Fortify on Demand supported languages * Add 3rd-party GitHub Actions disclaimer * Sysdig Secure Inline Scan with SARIF report to starter workflows * Added some extra comments, Github Actions V2 and changed env vars * Reviews from PR #1110 * Adding 'Dockerfile' to category list * Update according to PR review comments * File renames as requested in PR comments * Revert "Azure Data Factory CI starter workflow (#1111)" (#1146) This reverts commit7f30309cce. * use env variables for user-set values (#1117) Co-authored-by: Josh Gross <joshmgross@github.com> * Apply suggestions from nickfyson's code review Co-authored-by: Nick Fyson <nickfyson@github.com> * removing "deployment" templates from sync-ghes (#1127) * Update code-scanning/properties/sysdig-scan.properties.json Co-authored-by: Nick Fyson <nickfyson@github.com> * Update code-scanning/properties/sysdig-scan.properties.json Co-authored-by: Nick Fyson <nickfyson@github.com> * Changed svg logo * Rename sysdig.svg to sysdig-scan.svg * Switched svg logo (again) for a better fit * Rename fortify.json to fortify.properties.json * Correct character-case of "c" in Cloudrail * AWS template also used Docker * trigger on push instead of release (#1157) Co-authored-by: Josh Gross <joshmgross@github.com> * Added new templates for 3 clouds. * Revert "Added new templates for 3 clouds." This reverts commitc765d6316f. * Add workflow for Microsoft C++ Code Analysis * Updated action to meet guidelines * correct typo in msvc.properties.json Co-authored-by: Yoni Leitersdorf <y@indeni.com> Co-authored-by: Ruud Senden <ruud.senden@microfocus.com> Co-authored-by: Ruud Senden <8635138+rsenden@users.noreply.github.com> Co-authored-by: Manuel Boira Cuevas <manuel.boira@MacBook-Pro.local> Co-authored-by: manuelbcd <manuel.boira@sysdig.com> Co-authored-by: Nick Fyson <nickfyson@github.com> Co-authored-by: Sarah Edwards <skedwards88@github.com> Co-authored-by: Josh Gross <joshmgross@github.com> Co-authored-by: Aparna Ravindra <82894348+aparna-ravindra@users.noreply.github.com> Co-authored-by: manuelbcd <manuelbcd@gmail.com> Co-authored-by: Daniel Winsor <danwin@microsoft.com>
77 lines
2.7 KiB
YAML
77 lines
2.7 KiB
YAML
# This workflow will build a docker container, publish it to IBM Container Registry, and deploy it to IKS when there is a push to the $default-branch branch.
|
|
#
|
|
# To configure this workflow:
|
|
#
|
|
# 1. Ensure that your repository contains a Dockerfile
|
|
# 2. Setup secrets in your repository by going to settings: Create ICR_NAMESPACE and IBM_CLOUD_API_KEY
|
|
# 3. Change the values for the IBM_CLOUD_REGION, REGISTRY_HOSTNAME, IMAGE_NAME, IKS_CLUSTER, DEPLOYMENT_NAME, and PORT
|
|
|
|
name: Build and Deploy to IKS
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- $default-branch
|
|
|
|
# Environment variables available to all jobs and steps in this workflow
|
|
env:
|
|
GITHUB_SHA: ${{ github.sha }}
|
|
IBM_CLOUD_API_KEY: ${{ secrets.IBM_CLOUD_API_KEY }}
|
|
IBM_CLOUD_REGION: us-south
|
|
ICR_NAMESPACE: ${{ secrets.ICR_NAMESPACE }}
|
|
REGISTRY_HOSTNAME: us.icr.io
|
|
IMAGE_NAME: iks-test
|
|
IKS_CLUSTER: example-iks-cluster-name-or-id
|
|
DEPLOYMENT_NAME: iks-test
|
|
PORT: 5001
|
|
|
|
jobs:
|
|
setup-build-publish-deploy:
|
|
name: Setup, Build, Publish, and Deploy
|
|
runs-on: ubuntu-latest
|
|
environment: production
|
|
steps:
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
# Download and Install IBM Cloud CLI
|
|
- 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
|
|
|
|
# Authenticate with IBM Cloud CLI
|
|
- name: Authenticate with IBM Cloud CLI
|
|
run: |
|
|
ibmcloud login --apikey "${IBM_CLOUD_API_KEY}" -r "${IBM_CLOUD_REGION}" -g default
|
|
ibmcloud cr region-set "${IBM_CLOUD_REGION}"
|
|
ibmcloud cr login
|
|
|
|
# Build the Docker image
|
|
- name: Build with Docker
|
|
run: |
|
|
docker build -t "$REGISTRY_HOSTNAME"/"$ICR_NAMESPACE"/"$IMAGE_NAME":"$GITHUB_SHA" \
|
|
--build-arg GITHUB_SHA="$GITHUB_SHA" \
|
|
--build-arg GITHUB_REF="$GITHUB_REF" .
|
|
|
|
# Push the image to IBM Container Registry
|
|
- name: Push the image to ICR
|
|
run: |
|
|
docker push $REGISTRY_HOSTNAME/$ICR_NAMESPACE/$IMAGE_NAME:$GITHUB_SHA
|
|
|
|
# Deploy the Docker image to the IKS cluster
|
|
- name: Deploy to IKS
|
|
run: |
|
|
ibmcloud ks cluster config --cluster $IKS_CLUSTER
|
|
kubectl config current-context
|
|
kubectl create deployment $DEPLOYMENT_NAME --image=$REGISTRY_HOSTNAME/$ICR_NAMESPACE/$IMAGE_NAME:$GITHUB_SHA --dry-run -o yaml > deployment.yaml
|
|
kubectl apply -f deployment.yaml
|
|
kubectl rollout status deployment/$DEPLOYMENT_NAME
|
|
kubectl create service loadbalancer $DEPLOYMENT_NAME --tcp=80:$PORT --dry-run -o yaml > service.yaml
|
|
kubectl apply -f service.yaml
|
|
kubectl get services -o wide
|