diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..f583eee --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +patreon: kaiwalya +ko_fi: kaiwalya +custom: https://buymeacoffee.com/kaiwalya +github: kaiwalyakoparkar + +# open_collective: # Replace with a single Open Collective username +# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +# liberapay: # Replace with a single Liberapay username +# issuehunt: # Replace with a single IssueHunt username +# otechie: # Replace with a single Otechie username diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100755 index 0000000..c5e3ba2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '[Bug]' +labels: 'bug , Priority: High , want fix, Review Required' +assignees: '' + +--- + +### Describe the bug +**A clear and concise description of what the bug is :** + +### To Reproduce +**Steps to reproduce the behavior:** +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +### Expected behavior +**A clear and concise description of what you expected to happen.** + +### Screenshots/ Video +**If applicable, add screenshots to help explain your problem.** + +### Desktop (please complete the following information): + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +### Smartphone (please complete the following information): + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +### Additional context +**Add any other context about the problem here.** diff --git a/.github/ISSUE_TEMPLATE/doc_report.md b/.github/ISSUE_TEMPLATE/doc_report.md new file mode 100644 index 0000000..a63e51b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/doc_report.md @@ -0,0 +1,25 @@ +--- +name: Documentation request +about: Chage regarding improvising the docs to be more accessible +title: '[Doc]' +labels: 'documentation , enhancement, good first issue' +assignees: '' + +--- + +## What best describes you change + + + + +**Check List (Check all the boxes which are applicable)** + +- [ ] Information addition regarding the newest change through a PR +- [ ] Typo error. +- [ ] New category addition. +- [ ] Refractoring sentences that make more sense. +- [ ] Fixing broken links. +- [ ] Refractors / reformating of the document. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100755 index 0000000..92b2043 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '[Feature]' +labels: 'feature, Review Required' +assignees: '' + +--- + +### Is your feature request related to a problem? Please describe. +**A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]** + +### Describe the solution you'd like +**A clear and concise description of what you want to happen.** + +### Describe alternatives you've considered +**A clear and concise description of any alternative solutions or features you've considered.** + +### Additional context +**Add any other context or screenshots about the feature request here.** diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100755 index 0000000..96d65e1 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,32 @@ + + +## Fixes Issue + +This PR fixes the following issues : + +#example + + +## Changes proposed + +Here comes all the changes proposed through this PR + + + + +## Check List (Check all the boxes which are applicable) + +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. +- [ ] All new and existing tests passed. +- [ ] This PR does not contain plagarised content. +- [ ] The title of my pull request is a short description of the requested changes. + + + +## Screenshots +Add all the screenshots which support your changes diff --git a/.github/workflows/build-push-image.yaml b/.github/workflows/build-push-image.yaml new file mode 100644 index 0000000..fc65e53 --- /dev/null +++ b/.github/workflows/build-push-image.yaml @@ -0,0 +1,62 @@ +--- +name: build and push docker image +on: + push + +jobs: + release-docker: + name: Release docker image + if: "!contains(github.event.head_commit.message, '[skip ci]')" + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + tags: | + type=sha + images: kaiwalyakoparkar/busybox + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: kaiwalyakoparkar/busybox + tag_with_ref: true + add_git_labels: true + tag_with_sha: true + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: true + + - name: Generate deploy manifest from Jinja template + uses: cuchi/jinja2-action@v1.2.0 + with: + template: template/deploy.j2 + output_file: kubernetes/deploy.yaml + strict: true + variables: | + image_deploy_tag=${{ steps.meta.outputs.tags }} + + - name: Commit deploy manifest on local repo + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add . + git commit -s -m "[skip ci] Generate deployment manifests" + git pull origin main --rebase -f + + - name: Push deploy manifests to local repo + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.AUTO_COMMIT_TOKEN }} + branch: ${{ github.ref }} \ No newline at end of file diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml new file mode 100644 index 0000000..ddc80b5 --- /dev/null +++ b/.github/workflows/greetings.yml @@ -0,0 +1,31 @@ +name: Greetings + +on: [pull_request, issues] + +jobs: + welcome: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: EddieHubCommunity/gh-action-community/src/welcome@main + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: '

Hello 👋, Thank you very much for raising an issue 🙌. The maintainers will get back to you soon for discussion over the issue!

' + pr-message: '

Yeah! You did it 🎉. Now, Relax 😉 -> Grab a drink ☕ -> And wait for the maintainers views on your contribution. Meanwhile you can discuss on other issues and solve them 😀

' + footer: 'If you would like to continue contributing to open source and would like to do it with an awesome inclusive community, you should join our Discord Server- we help and encourage each other to contribute to open source little and often 🤓 . Any questions let us know.' + + + +# name: Greetings + +# on: [pull_request, issues] + +# jobs: +# greeting: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/first-interaction@v1 +# with: +# repo-token: ${{ secrets.GITHUB_TOKEN }} +# issue-message: 'Hello 👋, Thank you very much for raising an issue 🙌. The maintainers will get back to you soon for discussion over the issue!' +# pr-message: 'Yeah! You did it 🎉. Now, Relax 😉 -> Grab a drink ☕ -> And wait for the maintainers views on your contribution. Meanwhile you can discuss on other issues and solve them 😀' \ No newline at end of file diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml new file mode 100644 index 0000000..8708bd0 --- /dev/null +++ b/.github/workflows/labels.yml @@ -0,0 +1,16 @@ +name: Import open source standard labels +on: + push: + branches: [ main ] +jobs: + labels: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v2 + with: + node-version: '14' + - uses: EddieHubCommunity/gh-action-open-source-labels@v0.2.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + owner-name: ${{ github.repository_owner }} + repository-name: ${{ github.event.repository.name }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bcc3031 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Changelog +on: + push: + branches: + - main +jobs: + changelog: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Conventional Changelog Action + id: changelog + uses: TriPSs/conventional-changelog-action@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + output-file: "false" + - name: Create Release + uses: actions/create-release@v1 + if: ${{ steps.changelog.outputs.skipped == 'false' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.changelog.outputs.tag }} + release_name: ${{ steps.changelog.outputs.tag }} + body: ${{ steps.changelog.outputs.clean_changelog }} diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml new file mode 100644 index 0000000..654a470 --- /dev/null +++ b/.github/workflows/stale.yaml @@ -0,0 +1,15 @@ +name: Mark stale issues and pull requests +on: + schedule: + - cron: "30 1 * * *" +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'Stale issue message' + stale-pr-message: 'Stale pull request message' + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..a5a3227 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +kaiwalyakoparkar@gmail.com. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..48fdd28 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +# Use the BusyBox base image +FROM busybox + +# Run the "Hello, World!" command in an infinite loop +CMD ["/bin/sh", "-c", "while true; do echo 'Hello, World v2!'; sleep 1; done"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..596dd16 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Kaiwalya Koparkar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..1a6e38d --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# gitops-ci-cd +A complete CI/CD pipeline with GitOps as a practice. diff --git a/argocd/application.yaml b/argocd/application.yaml new file mode 100644 index 0000000..8b150ad --- /dev/null +++ b/argocd/application.yaml @@ -0,0 +1,22 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-application + namespace: argocd +spec: + project: default + source: + #Your repo link here + repoURL: https://github.com/kaiwalyakoparkar/gitops-ci-cd.git + targetRevision: HEAD + #Location where the manifests are stored + path: kubernetes/ + destination: + server: https://kubernetes.default.svc + namespace: default + syncPolicy: + syncOptions: + - CreateNamespace=true + automated: + selfHeal: true + prune: true diff --git a/config/argo.yaml b/config/argo.yaml new file mode 100644 index 0000000..5349441 --- /dev/null +++ b/config/argo.yaml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo-pipeline + namespace: argocd +spec: + project: default + source: + repoURL: https://github.com/kaiwalyakoparkar/gitops-ci-cd + targetRevision: HEAD + path: kubernetes/ + destination: + server: https://kubernetes.default.svc + namespace: cicd-pipeline + syncPolicy: + syncOptions: + - CreateNamespace=true + automated: + selfHeal: true + prune: true \ No newline at end of file diff --git a/kubernetes/deploy.yaml b/kubernetes/deploy.yaml new file mode 100644 index 0000000..ff6f4b4 --- /dev/null +++ b/kubernetes/deploy.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: cicd-deployment + labels: + app: cicd +spec: + replicas: 2 + selector: + matchLabels: + app: cicd + template: + metadata: + labels: + app: cicd + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: busybox + imagePullPolicy: Always + image: kaiwalyakoparkar/busybox:sha-038873f + ports: + - containerPort: 8080 + env: + - name: PORT + value: "8080" +--- +apiVersion: v1 +kind: Service +metadata: + name: cicd-service +spec: + selector: + app: cicd + ports: + - protocol: TCP + port: 80 + targetPort: 8080 + type: NodePort diff --git a/package.json b/package.json new file mode 100644 index 0000000..17aba91 --- /dev/null +++ b/package.json @@ -0,0 +1,3 @@ +{ + "version": "0.7.0" +} \ No newline at end of file diff --git a/template/deploy.j2 b/template/deploy.j2 new file mode 100644 index 0000000..dcf674a --- /dev/null +++ b/template/deploy.j2 @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: cicd-deployment + labels: + app: cicd +spec: + replicas: 2 + selector: + matchLabels: + app: cicd + template: + metadata: + labels: + app: cicd + spec: + terminationGracePeriodSeconds: 5 + containers: + - name: busybox + imagePullPolicy: Always + image: {{ image_deploy_tag }} + ports: + - containerPort: 8080 + env: + - name: PORT + value: "8080" +--- +apiVersion: v1 +kind: Service +metadata: + name: cicd-service +spec: + selector: + app: cicd + ports: + - protocol: TCP + port: 80 + targetPort: 8080 + type: NodePort \ No newline at end of file