diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml new file mode 100644 index 0000000..5b23d5d --- /dev/null +++ b/.github/workflows/blank.yml @@ -0,0 +1,59 @@ +# This is a basic workflow to help you get started with Actions + +name: use matrix + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + paths: + - .github/workflows/blank.yml + pull_request: + branches: [ master ] + paths: + - .github/workflows/blank.yml + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + strategy: + matrix: + cpu: ["amd64"] + service: ["controller-manager", "admission-webhook", "metrics-apiserver", "keepalived-manager", "corefile-manager"] + include: + - cpu: "arm64" + service: "keepalived-manager" + - cpu: "arm64" + service: "corefile-manager" + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + #- uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Run a one-line script + run: echo Hello, world! + + # Runs a set of commands using the runners shell + - name: Run a multi-line script + run: | + if [ ${{ matrix.cpu }} == "amd64" ];then + echo "::set-output name=targetImageTag::v1.0.0-${{ github.sha }}-${{ matrix.cpu }}" + echo "::set-output name=dockerFilePath::./build/Dockerfile.${{ matrix.service }}.${{ matrix.cpu }}" + else + echo "::set-output name=targetImageTag::v1.0.0-${{ github.sha }}" + echo "::set-output name=dockerFilePath::./build/Dockerfile.${{ matrix.service }}-ci.${{ matrix.cpu }}" + fi + id: prepare + - run: | + echo "targetImageTag is ${{ steps.prepare.outputs.targetImageTag }}" + echo "dockerFilePath is ${{ steps.prepare.outputs.dockerFilePath }}" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74a7c04..7717bb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,16 +1,18 @@ # This is a basic workflow to help you get started with Actions -name: main - # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: push: branches: - '**' + paths: + - .github/workflows/ci.yml pull_request_target: branches: - 'master' + paths: + - .github/workflows/ci.yml issues: types: [opened] @@ -27,11 +29,15 @@ jobs: - uses: actions/checkout@v2 # Runs a single command using the runners shell - - name: 查看文件 - run: ls -l + - name: 查看文件,set d + id: s1 + run: | + ls -l + echo "::set-output name=d::这是个d" # Runs a set of commands using the runners shell - - name: GITHUB envs + - name: GITHUB envs,set a|b|c + id: s2 run: | echo "GITHUB_SHA is ${GITHUB_SHA}" echo "GITHUB_REF is ${GITHUB_REF}" @@ -49,7 +55,13 @@ jobs: echo "my TEST_PWD is ${{secrets.TEST_PWD}}" > "test.txt" cat test.txt + echo "::set-output name=a::test___${{secrets.TEST_PWD}}" + echo "::set-output name=b::test___123456}}" + echo "::set-output name=c::这是个c" + echo "===========================" + echo "github.head_ref is ${{ github.head_ref }}" + - uses: actions/upload-artifact@v2 with: name: my-artifact @@ -69,6 +81,7 @@ jobs: echo "job.status is ${{job.status}}" echo "job.container.id is ${{job.container.id}}" echo "job.container.network is ${{job.container.network}}" + if: ${{ job.status }} == 'success' && ${{ github.workflow }} == 'main' - name: Dump GitHub context env: @@ -86,13 +99,27 @@ jobs: env: RUNNER_CONTEXT: ${{ toJson(runner) }} run: echo "$RUNNER_CONTEXT" + outputs: + a: ${{ steps.s2.outputs.a }} + b: ${{ steps.s2.outputs.b }} + c: ${{ steps.s2.outputs.c }} + d: ${{ steps.s1.outputs.d }} test: runs-on: ubuntu-latest - name: test + name: show pre-step output + needs: build steps: - - run: echo "hello"; ls -l + - run: | + echo "hello" + ls -l + echo " needs.build.outputs.a is ${{ needs.build.outputs.a }}" + echo " needs.build.outputs.b is ${{ needs.build.outputs.b }}" + echo " needs.build.outputs.c is ${{ needs.build.outputs.c }}" + + echo " needs.build.outputs.d is ${{ needs.build.outputs.d }}" + commentOnNewIssues: name: Comment On New Issues diff --git a/.github/workflows/command.yml b/.github/workflows/command.yml new file mode 100644 index 0000000..1e71f65 --- /dev/null +++ b/.github/workflows/command.yml @@ -0,0 +1,26 @@ +name: use command + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + paths: + - .github/workflows/command.yml + pull_request: + branches: [ master] +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: | + content=$(ls -l ..) + echo "$content" + content="${content//'%'/'%25'}" + content="${content//$'\n'/'%0A'}" + content="${content//$'\r'/'%0D'}" + echo "::set-output name=content::$content" + id: prepare + - run: | + echo "steps.prepare.outputs.content is ${{ steps.prepare.outputs.content }}" + diff --git a/.github/workflows/concurrency.yml b/.github/workflows/concurrency.yml new file mode 100644 index 0000000..736870a --- /dev/null +++ b/.github/workflows/concurrency.yml @@ -0,0 +1,19 @@ +name: use concurrency + +concurrency: ${{ github.ref }} + + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + paths: + - .github/workflows/concurrency.yml + pull_request: + branches: [ master] +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: echo "hello 100" diff --git a/.github/workflows/concurrency_1.yml b/.github/workflows/concurrency_1.yml new file mode 100644 index 0000000..8413379 --- /dev/null +++ b/.github/workflows/concurrency_1.yml @@ -0,0 +1,25 @@ +name: use concurrency_1 + +concurrency: ${{ github.ref }} + + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + paths: + - .github/workflows/concurrency_1.yml + pull_request: + branches: [ master ] + paths: + - .github/workflows/concurrency_1.yml + + +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: | + echo "hello concurrency_1.yml" + sleep 120s diff --git a/.github/workflows/context-1.yml b/.github/workflows/context-1.yml index a4d087d..eb0c5e4 100644 --- a/.github/workflows/context-1.yml +++ b/.github/workflows/context-1.yml @@ -1,15 +1,26 @@ name: P1 -on: push +on: + push: + branches: + - "**" + paths: + - .github/workflows/context-1.yml jobs: one: - runs-on: ubuntu-16.04 + runs-on: ubuntu-latest steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - name: Dump job context + run: | + # echo "$GITHUB_CONTEXT" + echo "111111111111" + echo ${{ github.aaaaa }} + echo ${{ github['aaaaa'] }} + echo "2222222222222" + + - name: Dump job context1 env: JOB_CONTEXT: ${{ toJson(job) }} run: echo "$JOB_CONTEXT" diff --git a/.github/workflows/delete.yml b/.github/workflows/delete.yml new file mode 100644 index 0000000..8eaa944 --- /dev/null +++ b/.github/workflows/delete.yml @@ -0,0 +1,20 @@ +on: delete + +jobs: + test: + runs-on: ubuntu-latest + steps: + - run: | + echo github.action is ${{ github.action }} + echo github.actor is ${{ github.actor }} + echo github.base_ref is ${{ github.base_ref }} + echo github.event_name is ${{ github.event_name }} + echo github.head_ref is ${{ github.head_ref }} + echo github.ref is ${{ github.ref }} + echo github.ref_name is ${{ github.ref_name }} + echo github.ref_protected is ${{ github.ref_protected }} + echo github.ref_type is ${{ github.ref_type }} + echo github.repository is ${{ github.repository }} + echo github.repository_owner is ${{ github.repository_owner }} + echo github.sha is ${{ github.sha }} + echo github.workflow is ${{ github.workflow }} diff --git a/.github/workflows/issue.yml b/.github/workflows/issue.yml new file mode 100644 index 0000000..09c4642 --- /dev/null +++ b/.github/workflows/issue.yml @@ -0,0 +1,22 @@ +on: + issues: + types: [opened, edited, milestoned] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - run: | + echo github.action is ${{ github.action }} + echo github.actor is ${{ github.actor }} + echo github.base_ref is ${{ github.base_ref }} + echo github.event_name is ${{ github.event_name }} + echo github.head_ref is ${{ github.head_ref }} + echo github.ref is ${{ github.ref }} + echo github.ref_name is ${{ github.ref_name }} + echo github.ref_protected is ${{ github.ref_protected }} + echo github.ref_type is ${{ github.ref_type }} + echo github.repository is ${{ github.repository }} + echo github.repository_owner is ${{ github.repository_owner }} + echo github.sha is ${{ github.sha }} + echo github.workflow is ${{ github.workflow }} diff --git a/.github/workflows/matrix_2.yml b/.github/workflows/matrix_2.yml new file mode 100644 index 0000000..4ffebcf --- /dev/null +++ b/.github/workflows/matrix_2.yml @@ -0,0 +1,50 @@ +name: use matrix-2 + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master, dev ] + paths: + - .github/workflows/matrix_2.yml + pull_request: + branches: [ master, dev ] + paths: + - .github/workflows/matrix_2.yml + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + prepare: + runs-on: ubuntu-latest + steps: + - id: output_data + run: echo "::set-output name=matrix::{\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}" + outputs: + matrix: ${{ steps.output_data.outputs.matrix }} + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + needs: prepare + strategy: + matrix: + a: [a1, a2] + b: [b1, b2] + include: + - d: d1 + c: c1 + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + #- uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Run a one-line script + run: | + echo a is ${{ matrix.a }} + echo b is ${{ matrix.b }} + echo c is ${{ matrix.c }} + echo d is ${{ matrix.d }} diff --git a/.github/workflows/matrix_3.yml b/.github/workflows/matrix_3.yml new file mode 100644 index 0000000..b13a38e --- /dev/null +++ b/.github/workflows/matrix_3.yml @@ -0,0 +1,66 @@ +# This is a basic workflow to help you get started with Actions + +name: use matrix-3 + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + paths: + - .github/workflows/matrix_3.yml + pull_request: + branches: [ master ] + paths: + - .github/workflows/matrix_3.yml + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + prepare: + runs-on: ubuntu-latest + steps: + - id: output_data + run: echo "::set-output name=matrix::{\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}" + outputs: + matrix: ${{ steps.output_data.outputs.matrix }} + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + needs: prepare + strategy: + matrix: ${{fromJSON(needs.prepare.outputs.matrix)}} + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + #- uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Run a one-line script + run: echo project is ${{ matrix.project }} + + # Runs a set of commands using the runners shell + - name: Run a multi-line script + run: | + if [ ${{ matrix.cpu }} == "amd64" ];then + echo "::set-output name=targetImageTag::v1.0.0-${{ github.sha }}-${{ matrix.cpu }}" + echo "::set-output name=dockerFilePath::./build/Dockerfile.${{ matrix.service }}.${{ matrix.cpu }}" + else + echo "::set-output name=targetImageTag::v1.0.0-${{ github.sha }}" + echo "::set-output name=dockerFilePath::./build/Dockerfile.${{ matrix.service }}-ci.${{ matrix.cpu }}" + fi + id: prepare + - run: | + echo "targetImageTag is ${{ steps.prepare.outputs.targetImageTag }}" + echo "dockerFilePath is ${{ steps.prepare.outputs.dockerFilePath }}" + test: + runs-on: ubuntu-latest + needs: build + steps: + - run: | + echo ${{ toJson(needs.build.outputs) }} + echo ${{ needs.build.outputs.targetImageTag }} diff --git a/.github/workflows/matrix_4.yml b/.github/workflows/matrix_4.yml new file mode 100644 index 0000000..b00f1a2 --- /dev/null +++ b/.github/workflows/matrix_4.yml @@ -0,0 +1,24 @@ +on: + push: + branches: [ master ] + paths: + - .github/workflows/matrix_4.yml + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - id: set-matrix + run: "echo ::set-output name=matrix::{\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}" + job2: + needs: job1 + runs-on: ubuntu-latest + steps: + - id: set-matrix + run: echo ${{needs.job1.outputs.matrix}} + job3: + needs: job2 + runs-on: ubuntu-latest + strategy: ${{fromJSON(needs.job1.outputs.matrix)}} + steps: + - run: echo "project is ${{ matrix.project }}, config is ${{ matrix.config }}" diff --git a/.github/workflows/timer.yml b/.github/workflows/timer.yml new file mode 100644 index 0000000..13f672d --- /dev/null +++ b/.github/workflows/timer.yml @@ -0,0 +1,34 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the workflow will run +on: + push: + branches: + - '**' + paths: + - .github/workflows/timer.yml + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Run a one-line script + run: | + echo github.event_name is ${{ github.event_name }} + echo github.event_path is ${{ github.event_path }} + echo github.actor is ${{ github.actor }} + echo github.ref is ${{ github.ref }} + echo github.repository is ${{ github.repository }} + echo github.repository_owner is ${{ github.repository_owner }} + echo github.sha is ${{ github.sha }} diff --git a/.github/workflows/workflow_call.yml b/.github/workflows/workflow_call.yml new file mode 100644 index 0000000..fbd4bc2 --- /dev/null +++ b/.github/workflows/workflow_call.yml @@ -0,0 +1,6 @@ +on: workflow_call + +jobs: + test: + steps: + - run: echo github.event is ${{ github.event }} diff --git a/.github/workflows/workflow_dispatch.yml b/.github/workflows/workflow_dispatch.yml new file mode 100644 index 0000000..a2ea3c0 --- /dev/null +++ b/.github/workflows/workflow_dispatch.yml @@ -0,0 +1,20 @@ +name: Manually triggered workflow +on: + workflow_dispatch: + inputs: + name: + description: 'Person to greet' + required: true + default: 'Mona the Octocat' + home: + description: 'location' + required: false + default: 'The Octoverse' + +jobs: + say_hello: + runs-on: ubuntu-latest + steps: + - run: | + echo "Hello ${{ github.event.inputs.name }}!" + echo "- in ${{ github.event.inputs.home }}!" diff --git a/ReadMe.md b/ReadMe.md index 0c05efb..2f97d1f 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,5 +1,13 @@ +[![license](https://img.shields.io/badge/license-mit-brightgreen.svg?style=flat)](https://github.com/Tencent/bk-ci/blob/master/LICENSE.txt) [![Release Version](https://img.shields.io/github/v/release/Tencent/bk-ci?include_prereleases)](https://github.com/Tencent/bk-ci/releases) [![Backend CI](https://github.com/Tencent/bk-ci/workflows/Backend%20C/badge.svg?branch=master)](https://img.shields.io/github/workflow/status/Tencent/bk-ci/Tag%20Rease) + hello hello, it is me. hello, it is 20200904. hello, it is release. -Require status checks to pass before merging \ No newline at end of file +111 +Require status checks to pass before merging + + +![stream](https://ci.tencent.com/pipeline/stream/api/external/stream/projects/github_189153491/pipelines/badge?file_path=.ci/pr_check.yml&branch=master) + + diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..c4b74a6 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,20 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: +- test + +pool: + vmImage: ubuntu-latest + +steps: +- script: echo Hello, world! + displayName: 'Run a one-line script' + +- script: | + echo Add other tasks to build, test, and deploy your project. + echo See https://aka.ms/yaml + echo 111 + displayName: 'Run a multi-line script11' diff --git a/azure-pipelines1.yml b/azure-pipelines1.yml new file mode 100644 index 0000000..bd2dc51 --- /dev/null +++ b/azure-pipelines1.yml @@ -0,0 +1,20 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: +- master + +pool: + vmImage: ubuntu-latest + +steps: +- script: echo Hello, world! + displayName: 'Run a one-line script' + +- script: | + echo Add other tasks to build, test, and deploy your project. + echo See https://aka.ms/yaml + echo 111 + displayName: 'Run a multi-line script' diff --git a/requirements.txt b/requirements.txt index d373a14..78cbc84 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -requests>=2.10.0 +requests==2.10.0