name: inverse class: title Using Github action with ArgoCD ## anarcher@gmail.com ## 2019-10-05 --- # Github action https://github.com/features/actions Pros: - Github native CI (Don't need CI setup) - Reusable job step pacakge (github action) Cons: - Still beta - Missing features - Job step caching - Approvals & other checks (e.g. Release control using approvals) - https://docs.microsoft.com/ko-kr/azure/devops/pipelines/release/approvals/approvals?view=azure-devops - ... --- class: pic  --- # .github/workflows/build.yml ```yaml name: skaffold-build on: push: branches: - '**' tags-ignore: - 'v*' paths-ignore: - 'k8s/**' jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: skaffold build uses: anarcher/skaffold-action@master with: skaffold: build -p test ``` --- # workflows A configurable automated process that you can set up in your repository to build,test,package,relase, or deploy any project on GitHub. Workflows are made up of one or more kjobs and can be scheduled or activated by an event. # jobs A defined task made up of steps. Each job is run in a fresh instance of the virtual environment. You can define the dependency rules for how jobs run in a workflow file. Jobs can run at the same time in parallel or be dependent on the status of a previous job and run sequenially. # steps A Step is a set of tasks performed by a job. Each step in a job executes in the same virtual environment,allowing the actions in that job to share information using the filesystem. Steps can run commands or actions. --- # Actions Actions are ther smallest portable building block of a workflow. # How do make github action? - Docker action: https://help.github.com/en/articles/creating-a-docker-container-action - JS action: https://help.github.com/en/articles/creating-a-javascript-action - Example: https://github.com/anarcher/skaffold-action --- class: pic # Separate of concerns  --- ```sh - name: skaffold build & publish - ${{ github.ref }} uses: anarcher/skaffold-action@master with: skaffold: build -p publish kustomize: edit set image anarcher/hello-ghact-argocd:${IMAGE_TAG} kustomize_path: ./k8s/prod/ docker_username: ${{ secrets.DOCKER_GITHUB_USERNAME }} docker_password: ${{ secrets.DOCKER_GITHUB_PASSWORD }} ``` ```sh anarch@vacuum-2 ~/git/anarcher/skaffold-action (master) Dockerfile LICENSE README.md action.yml entrypoint.sh ``` ```sh #!/bin/sh -l if [ -n "${INPUT_DOCKER_PASSWORD}" ]; then echo "[DOCKER_LOGIN]" sh -c "echo ${INPUT_DOCKER_PASSWORD} | docker login -u ${INPUT_DOCKER_USERNAME} --password-stdin ${INPUT_DOCKER_REGISTRY}" fi ``` --- # Skaffold https://skaffold.dev/ Skaffold is __a command line tool__ that facilitates continuous development for __Kubernetes applications__. You can iterate on your application source code locally then deploy to local or remote Kubernetes clusters. Skaffold handles the workflow for building, pushing and deploying your application. It also provides __building blocks__ and describe customizations for a __CI/CD pipeline__. https://asciinema.org/a/DQXtaDVquXmg6jdCxuLfodSJ4 --- class: pic  --- class: pic  --- # ArgoCD Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. - https://github.com/argoproj/argo-cd  --- class: pic  --- class: pic # Architecture  --- class: pic  --- class: pic  --- class: pic  --- # Demo --- class: pic .interstitial[]