diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..273cec8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +--- +# This workflow will combine the experiment CRs for different +# Categories of experiments into the experiment.yaml in respective +# Chart directory. It will only build and not push the changes. + +name: ChaosCharts +on: + pull_request: + types: [ opened, synchronize, reopened ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + + # Install golang + - uses: actions/setup-go@v2 + with: + go-version: '^1.13.1' + + # Setup gopath + - name: Setting up GOPATH + run: | + echo "GOPATH=${GITHUB_WORKSPACE}/go" >> $GITHUB_ENV + + # Checkout to the latest commit + # On specific directory/path + - uses: actions/checkout@v2 + with: + ref: ${{steps.getcommit.outputs.sha}} + path: go/src/github.com/${{github.repository}} + + # Combine the experiment CRs + - name: Combine experiment CR + run: | + export PATH=$PATH:$(go env GOPATH)/bin + cd ${GOPATH}/src/github.com/${{github.repository}} + make combineExpCR + shell: bash diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..4f8d813 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,54 @@ +--- +# This workflow will combine the experiment CRs for different +# Categories of experiments into the experiment.yaml in respective +# Chart directory and push the changes. + +name: ChaosCharts +on: [ push ] + +jobs: + push: + runs-on: ubuntu-latest + if: github.repository == 'litmuschaos/chaos-charts' + steps: + + # Install golang + - uses: actions/setup-go@v2 + with: + go-version: '^1.13.1' + + # Setup gopath + - name: Setting up GOPATH + run: | + echo "GOPATH=${GITHUB_WORKSPACE}/go" >> $GITHUB_ENV + + # Checkout to the latest commit + # On specific directory/path + - uses: actions/checkout@v2 + with: + ref: ${{steps.getcommit.outputs.sha}} + path: go/src/github.com/${{github.repository}} + + # Combine the experiment CRs + - name: Combine experiment CR + run: | + export PATH=$PATH:$(go env GOPATH)/bin + cd ${GOPATH}/src/github.com/${{github.repository}} + make combineExpCR + shell: bash + + # Commit the changes from the chart directory + - name: Commit the changes + run: | + cd ${GOPATH}/src/github.com/${{github.repository}} + make push + shell: bash + + # Push the changes + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} + directory: go/src/github.com/${{github.repository}} + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 674c05e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -dist: bionic -language: go -go: - - 1.14.2 -script: - # Install dependencies - - make deps - # It will ignore if travis ci committed, else works as it is. - #- author=`git log -1 --pretty=format:'%an'` && if [[ "$author" != "Travis CI" ]]; then make versionmaker; fi - - make combineExpCR -after_success: - # runs only when PR is merged and push the version file to master version - - if [[ $TRAVIS_PULL_REQUEST == 'false' ]]; then make push; fi diff --git a/charts/generic/experiments.yaml b/charts/generic/experiments.yaml index 18f99e6..af909de 100644 --- a/charts/generic/experiments.yaml +++ b/charts/generic/experiments.yaml @@ -2116,4 +2116,4 @@ spec: app.kubernetes.io/component: experiment-job app.kubernetes.io/version: latest ---- +--- \ No newline at end of file diff --git a/charts/kafka/experiments.yaml b/charts/kafka/experiments.yaml index 0356db1..c241dfb 100644 --- a/charts/kafka/experiments.yaml +++ b/charts/kafka/experiments.yaml @@ -248,4 +248,4 @@ spec: mountPath: /tmp/ ---- +--- \ No newline at end of file diff --git a/charts/kube-aws/experiments.yaml b/charts/kube-aws/experiments.yaml index dfeaeed..b715cc4 100644 --- a/charts/kube-aws/experiments.yaml +++ b/charts/kube-aws/experiments.yaml @@ -260,4 +260,4 @@ spec: - name: cloud-secret mountPath: /tmp/ ---- +--- \ No newline at end of file diff --git a/charts/openebs/experiments.yaml b/charts/openebs/experiments.yaml index 7d3b2cd..ab0b5c9 100644 --- a/charts/openebs/experiments.yaml +++ b/charts/openebs/experiments.yaml @@ -1094,4 +1094,4 @@ spec: app.kubernetes.io/component: experiment-job app.kubernetes.io/version: latest ---- +--- \ No newline at end of file diff --git a/scripts/version/push.sh b/scripts/version/push.sh index c3aaadb..d395855 100644 --- a/scripts/version/push.sh +++ b/scripts/version/push.sh @@ -1,23 +1,17 @@ #!/bin/sh setup_git() { - git config --global user.email "travis@travis-ci.org" - git config --global user.name "Travis CI" - git remote set-url origin https://${GITHUB_TOKEN}@github.com/litmuschaos/community-charts.git > /dev/null 2>&1 + git config --global user.email "litmusbotci@gmail.com" + git config --global user.name "litmus[bot]" } commit_updated_changes() { git checkout master git status git add . - git commit --message " $TRAVIS_BUILD_NUMBER: version upgraded for chaos-charts" + git commit --message " $GITHUB_RUN_ID: version upgraded for chaos-charts" git status } -upload_files() { - git remote -v - git push origin master -} - setup_git commit_updated_changes -upload_files +