Skip to content

Commit

Permalink
Merge pull request #38 from ulucinar/fix-ci
Browse files Browse the repository at this point in the history
Use pull_request as the CI workflow trigger event
  • Loading branch information
ulucinar authored Oct 26, 2022
2 parents 504a78c + ea0f663 commit ff84574
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 236 deletions.
49 changes: 8 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
- release-*
pull_request_target: {}
pull_request: {}
workflow_dispatch: {}

env:
Expand All @@ -14,7 +14,10 @@ env:
GOLANGCI_VERSION: 'v1.50.0'
DOCKER_BUILDX_VERSION: 'v0.8.2'

UPBOUND_BOT_GITHUB_TOKEN: ${{ secrets.UPBOUND_BOT_GITHUB_TOKEN }}
# Common users. We can't run a step 'if secrets.XXX != ""' but we can run a
# step 'if env.XXX' != ""', so we copy these to succinctly test whether
# credentials have been provided before trying to run steps that need them.
UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
jobs:
detect-noop:
runs-on: ubuntu-22.04
Expand All @@ -29,6 +32,7 @@ jobs:
paths_ignore: '["**.md", "**.png", "**.jpg"]'
do_not_skip: '["workflow_dispatch", "schedule", "push"]'


lint:
runs-on: ubuntu-22.04
needs: detect-noop
Expand All @@ -45,12 +49,6 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

# git needs to be able to access private repositories under upbound.
- name: Login to Github
run: |
git config --global user.name "upbound-bot"
echo "machine github.com login upbound-bot password $UPBOUND_BOT_GITHUB_TOKEN" > ~/.netrc
- name: Find the Go Build Cache
id: go
run: echo "::set-output name=cache::$(make go.cachedir)"
Expand All @@ -69,12 +67,6 @@ jobs:
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-

# git needs to be able to access private repositories under upbound.
- name: Login to Github
run: |
git config --global user.name "upbound-bot"
echo "machine github.com login upbound-bot password $UPBOUND_BOT_GITHUB_TOKEN" > ~/.netrc
- name: Vendor Dependencies
run: make vendor vendor.check

Expand All @@ -101,12 +93,6 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

# git needs to be able to access private repositories under upbound.
- name: Login to Github
run: |
git config --global user.name "upbound-bot"
echo "machine github.com login upbound-bot password $UPBOUND_BOT_GITHUB_TOKEN" > ~/.netrc
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports

Expand Down Expand Up @@ -153,12 +139,6 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}

# git needs to be able to access private repositories under upbound.
- name: Login to Github
run: |
git config --global user.name "upbound-bot"
echo "machine github.com login upbound-bot password $UPBOUND_BOT_GITHUB_TOKEN" > ~/.netrc
- name: Find the Go Build Cache
id: go
run: echo "::set-output name=cache::$(make go.cachedir)"
Expand Down Expand Up @@ -193,10 +173,6 @@ jobs:
runs-on: ubuntu-22.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
env:
GOOGLE_APPLICATION_CREDENTIALS_JSON_ENCODED: ${{ secrets.UPBOUND_MARKETPLACE_DOCS_BUCKET_PROD_SA_JSON_ENCODED }}
BUCKET_NAME: ${{ secrets.UPBOUND_MARKETPLACE_DOCS_BUCKET_PROD_NAME }}
CDN_DOMAIN: ${{ secrets.UPBOUND_MARKETPLACE_DOCS_BUCKET_PROD_CDN }}

steps:
- name: Setup QEMU
Expand All @@ -210,22 +186,14 @@ jobs:
version: ${{ env.DOCKER_BUILDX_VERSION }}
install: true

# git needs to be able to access private repositories under upbound.
- name: Login to Github
run: |
git config --global user.name "upbound-bot"
echo "machine github.com login upbound-bot password $UPBOUND_BOT_GITHUB_TOKEN" > ~/.netrc
- name: Login to Upbound
uses: docker/login-action@v1
if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != ''
with:
registry: xpkg.upbound.io
username: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
password: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_PSW }}

- name: Prepare to Upload Docs
run: echo "${GOOGLE_APPLICATION_CREDENTIALS_JSON_ENCODED}" | base64 -d > /tmp/gcp_sa.json

- name: Checkout
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -274,6 +242,5 @@ jobs:
path: _output/**

- name: Publish Artifacts
env:
GOOGLE_APPLICATION_CREDENTIALS: /tmp/gcp_sa.json
if: env.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR != ''
run: make publish BRANCH_NAME=${GITHUB_REF##*/}
10 changes: 1 addition & 9 deletions .github/workflows/uptest-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ env:
GO_VERSION: '1.19'
DOCKER_BUILDX_VERSION: 'v0.8.2'

UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
UPBOUND_BOT_GITHUB_TOKEN: ${{ secrets.UPBOUND_BOT_GITHUB_TOKEN }}

jobs:
detect-api-groups:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -81,12 +78,6 @@ jobs:
key: ${{ runner.os }}-build-uptest-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-uptest-

# git needs to be able to access private repositories under upbound.
- name: Login to Github
run: |
git config --global user.name "upbound-bot"
echo "machine github.com login upbound-bot password $UPBOUND_BOT_GITHUB_TOKEN" > ~/.netrc
- name: Cache Go Dependencies
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -119,6 +110,7 @@ jobs:
UPTEST_GCP_CREDS: ${{ secrets.UPTEST_GCP_CREDS }}
EXAMPLE_LIST: ${{ needs.get-example-list.outputs.example_list }}
UPTEST_EXAMPLE_VALUE_REPLACEMENTS: ${{ secrets.UPTEST_EXAMPLE_VALUE_REPLACEMENTS }}
DUMP_DIRECTORY: "./_output/cluster-dump"
run: make uptest

- name: Collect Cluster Dump
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/uptest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@ env:
GO_VERSION: '1.19'
DOCKER_BUILDX_VERSION: 'v0.8.2'

UPBOUND_MARKETPLACE_PUSH_ROBOT_USR: ${{ secrets.UPBOUND_MARKETPLACE_PUSH_ROBOT_USR }}
UPBOUND_BOT_GITHUB_TOKEN: ${{ secrets.UPBOUND_BOT_GITHUB_TOKEN }}

jobs:
get-example-list:
runs-on: ubuntu-22.04
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/test-examples') }}
outputs:
provider_name: ${{ steps.get-example-list-name.outputs.provider-name }}
example_list: ${{ steps.get-example-list-name.outputs.example-list }}
example_hash: ${{ steps.get-example-list-name.outputs.example-hash }}
steps:
Expand All @@ -32,6 +28,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr checkout ${{ github.event.issue.number }}
git submodule update --init --recursive
OUTPUT=$(git log -1 --format='%H')
echo "::set-output name=commit-sha::$OUTPUT"
Expand Down Expand Up @@ -68,7 +65,7 @@ jobs:
uptest:
runs-on: ubuntu-22.04
needs: get-example-list
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/test-examples') }}
if: ${{ github.event.comment.author_association == 'MEMBER' && github.event.issue.pull_request && contains(github.event.comment.body, '/test-examples') }}
steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
Expand All @@ -92,6 +89,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr checkout ${{ github.event.issue.number }}
git submodule update --init --recursive
OUTPUT=$(git log -1 --format='%H')
echo "::set-output name=commit-sha::$OUTPUT"
Expand All @@ -114,12 +112,6 @@ jobs:
key: ${{ runner.os }}-build-uptest-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-uptest-

# git needs to be able to access private repositories under upbound.
- name: Login to Github
run: |
git config --global user.name "upbound-bot"
echo "machine github.com login upbound-bot password $UPBOUND_BOT_GITHUB_TOKEN" > ~/.netrc
- name: Cache Go Dependencies
uses: actions/cache@v2
with:
Expand All @@ -143,6 +135,7 @@ jobs:
UPTEST_GCP_CREDS: ${{ secrets.UPTEST_GCP_CREDS }}
EXAMPLE_LIST: ${{ needs.get-example-list.outputs.example_list }}
UPTEST_EXAMPLE_VALUE_REPLACEMENTS: ${{ secrets.UPTEST_EXAMPLE_VALUE_REPLACEMENTS }}
DUMP_DIRECTORY: "./_output/cluster-dump"
run: make uptest

- name: Create Successful Status Check
Expand Down Expand Up @@ -190,4 +183,4 @@ jobs:
-f state='failure' \
-f target_url='https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' \
-f description='Failed' \
-f context="Uptest-${EXAMPLE_HASH}"
-f context="Uptest-${EXAMPLE_HASH}"
6 changes: 0 additions & 6 deletions apis/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ limitations under the License.
// Generate crossplane-runtime methodsets (resource.Claim, etc)
//go:generate go run -tags generate github.com/crossplane/crossplane-tools/cmd/angryjet generate-methodsets --header-file=../hack/boilerplate.go.txt ./...

// Run UpDoc generator
//go:generate go run github.com/upbound/official-providers/updoc/cmd generate --docs-dir=../docs

package apis

import (
Expand All @@ -53,7 +50,4 @@ import (
_ "github.com/crossplane/crossplane-tools/cmd/angryjet" //nolint:typecheck

_ "github.com/upbound/upjet/cmd/scraper"

_ "github.com/upbound/official-providers/testing/cmd"
_ "github.com/upbound/official-providers/updoc/cmd"
)
14 changes: 0 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ require (
github.com/crossplane/crossplane-tools v0.0.0-20220310165030-1f43fc12793e
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0
github.com/pkg/errors v0.9.1
github.com/upbound/official-providers/testing v0.0.0-20221007091039-7542108227b1
github.com/upbound/official-providers/updoc v0.0.0-20221004155610-463bb1c3b2c0
github.com/upbound/upjet v0.7.0
gopkg.in/alecthomas/kingpin.v2 v2.2.6
k8s.io/apimachinery v0.25.0
Expand All @@ -18,16 +16,9 @@ require (
)

require (
cloud.google.com/go v0.102.1 // indirect
cloud.google.com/go/compute v1.7.0 // indirect
cloud.google.com/go/iam v0.3.0 // indirect
cloud.google.com/go/storage v1.24.0 // indirect
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/adrg/frontmatter v0.2.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/alecthomas/kong v0.6.1 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/antchfx/htmlquery v1.2.4 // indirect
Expand Down Expand Up @@ -60,8 +51,6 @@ require (
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
Expand Down Expand Up @@ -122,7 +111,6 @@ require (
github.com/vmihailenco/tagparser v0.1.1 // indirect
github.com/yuin/goldmark v1.4.13 // indirect
github.com/zclconf/go-cty v1.11.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.19.1 // indirect
Expand All @@ -135,9 +123,7 @@ require (
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
golang.org/x/tools v0.1.12 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/api v0.85.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad // indirect
google.golang.org/grpc v1.48.0 // indirect
Expand Down
Loading

0 comments on commit ff84574

Please sign in to comment.