Skip to content

GitOps-Tasks

GitOps-Tasks #117

Workflow file for this run

name: GitOps-Tasks
on:
workflow_run:
workflows:
- Deploy
types:
- completed
branches:
- main
workflow_dispatch:
jobs:
Setup:
name: GitOps Day2 Tasks
runs-on: ubuntu-latest
steps:
- name: Checkout r3dact3d/gitops external repo
uses: actions/checkout@v2
with:
repository: r3dact3d/gitops
path: gitops
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Create AWS S3 Bucket for AAP HA DB
run: |
aws s3 mb s3://${{secrets.OCP_CLUSTER_NAME}}-aap-ha-db-bucket --region ${{secrets.AWS_REGION}}
aws s3 ls | grep -i aap-ha-db-bucket
- name: Install OpenShift CLI tools
uses: redhat-actions/openshift-tools-installer@v1
with:
openshift-install: "${{secrets.OCP_CLIENT_VERSION}}"
oc: "${{secrets.OCP_CLIENT_VERSION}}"
- name: Download Artifacts from Cluster Deploy
uses: dawidd6/action-download-artifact@v2
with:
workflow: deploy.yaml
name: ocp-artifact
path: ocp-artifact
- name: Create GitOps
run: |
cp ocp-artifact/auth/kubeconfig $GITHUB_WORKSPACE/kubeconfig
export KUBECONFIG=$GITHUB_WORKSPACE/kubeconfig
oc apply -f https://raw.githubusercontent.com/r3dact3d/gitops/main/gitops-cluster/gitops-operator.yaml
oc create namespace aap
oc create secret generic s3-secret --namespace aap \
--from-literal=s3-access-key-id=${{secrets.AWS_ACCESS_KEY_ID}} \
--from-literal=s3-secret-access-key=${{secrets.AWS_SECRET_ACCESS_KEY}} \
--from-literal=s3-bucket-name=${{secrets.OCP_CLUSTER_NAME}}-aap-ha-db-bucket \
--from-literal=s3-region=${{secrets.AWS_REGION}} | oc apply -f
sleep 300
oc project openshift-gitops
oc adm policy add-cluster-role-to-user cluster-admin -z openshift-gitops-argocd-application-controller
oc create -f https://raw.githubusercontent.com/r3dact3d/gitops/main/gitops-cluster/day2-app.yaml
oc create -f https://raw.githubusercontent.com/r3dact3d/gitops/main/gitops-cluster/appset-app.yaml
#oc create -f https://raw.githubusercontent.com/r3dact3d/gitops/main/gitops-cluster/cluster-onboarding-app.yaml