Skip to content

Commit 6c9b307

Browse files
committed
DevRel CI based on Cloud Build
1 parent 624be50 commit 6c9b307

27 files changed

+274
-167
lines changed

.gcloudignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
**/node_modules/**
2+
**/generated/**
3+
**/target/**
4+
/tools/hybrid-quickstart/**/tools
5+
/service-accounts
6+
.settings
7+
.project
8+
.classpath
9+
.vscode
10+
.git

.github/workflows/devrel-full.yml .github/workflows/devrel-linter.yml

+10-36
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: DevRel All Projects Pipeline
15+
name: DevRel Linter Pipeline
1616
on:
17+
push:
18+
branches:
19+
- main
20+
pull_request:
21+
branches:
22+
- main
1723
workflow_dispatch:
1824
schedule:
1925
- cron: "0 0 * * *"
20-
env:
21-
APIGEE_USER: ${{ secrets.APIGEE_USER }}
22-
APIGEE_PASS: ${{ secrets.APIGEE_PASS }}
23-
APIGEE_ORG: ${{ secrets.APIGEE_ORG }}
24-
APIGEE_ENV: ${{ secrets.APIGEE_ENV }}
25-
# Component specific secrets
26-
REF_GCP_SA_SF: ${{ secrets.REF_GCP_SA_SF }}
2726
jobs:
2827

2928
static-analysis:
@@ -44,36 +43,11 @@ jobs:
4443
MARKDOWN_CONFIG_FILE: .markdown-lint.yml
4544

4645
- name: Check all files are licensed
47-
uses: ./tools/pipeline-runner
46+
uses: ./tools/pipeline-linter
4847
with:
4948
pipeline-action: check-license.sh
5049

5150
- name: Check README and CODEOWNER index
52-
uses: ./tools/pipeline-runner
51+
uses: ./tools/pipeline-linter
5352
with:
54-
pipeline-action: check-readme.sh
55-
56-
project-pipelines:
57-
58-
name: Run Pipelines
59-
runs-on: ubuntu-latest
60-
61-
steps:
62-
- name: Checkout Code
63-
uses: actions/checkout@v2
64-
65-
- name: Turnstyle
66-
uses: softprops/turnstyle@v1
67-
with:
68-
same-branch-only: false
69-
poll-interval-seconds: 10
70-
continue-after-seconds: 120
71-
env:
72-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73-
74-
- name: Run Pipelines
75-
uses: ./tools/pipeline-runner
76-
with:
77-
pipeline-action: run-pipelines.sh
78-
79-
53+
pipeline-action: check-readme.sh

.github/workflows/devrel-single.yml

-86
This file was deleted.

.github/workflows/devrel-site.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Checkout Code
2626
uses: actions/checkout@v2
2727
- name: generate-docs
28-
uses: ./tools/pipeline-runner
28+
uses: ./tools/pipeline-linter
2929
with:
3030
pipeline-action: generate-all-docs.sh
3131
- name: Archive Generated Docs
@@ -50,6 +50,6 @@ jobs:
5050
run: |
5151
git config --global user.name "DevRel GH Pages Publish Action"
5252
git config --global user.email "[email protected]"
53-
git add .
53+
git add .
5454
git commit -m "Update GH Pages - $GITHUB_SHA" || echo "No Changes in docs"
5555
git push

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
**/node_modules/**
22
**/generated/**
3+
/service-accounts
34

45
.settings
56
.project

CODEOWNERS

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
/references/southbound-mtls @danistrebel
1515
/labs/best-practices-hackathon @laughingbiscuit @sauliuz @seymen
1616
/tools/organization-cleanup @laughingbiscuit
17-
/tools/pipeline-runner @laughingbiscuit @seymen
17+
/tools/pipeline-runner @laughingbiscuit @seymen @danistrebel
18+
/tools/pipeline-linter @laughingbiscuit @seymen @danistrebel
1819
/tools/another-apigee-client @laughingbiscuit
1920
/tools/hybrid-quickstart @danistrebel
2021
/tools/decrypt-hybrid-assets @yuriylesyuk

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ Apigee products.
5151
A tool to cleanup proxies in an Apigee organization, leveraging
5252
[Another Apigee Client](tools/another-apigee-client)
5353
- [Pipeline Runner](tools/pipeline-runner) -
54-
A tool to lint, build and test groups of Apigee projects
54+
A tool to build and test groups of Apigee projects
55+
- [Pipeline Linter](tools/pipeline-linter) -
56+
A tool to lint groups of Apigee projects
5557
- [Another Apigee Client](tools/another-apigee-client) -
5658
A lightweight Apigee Management CLI
5759
- [Apigee hybrid Quickstart GKE](tools/hybrid-quickstart) -

references/cicd-jenkins/pipeline.sh

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
# limitations under the License.
1616

1717
set -e
18-
set -x
1918

2019
# TODO figure out how to move this to apigee/devrel repo
2120
# See https://github.com/apigee/devrel/issues/76

references/gcp-sa-auth-shared-flow/pipeline.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# REQUIREMENT:
1717
# Populate a service account key into the environment variable "REF_GCP_SA_SF" e.g. by:
18-
# $ REF_GCP_SA_SF=$(cat /path/to/gcp-sa-key.json | jq '. | tostring')
18+
# $ c
1919
#
2020
# Hint:
2121
# Make sure that newline characters are properly escaped with `\\n` within
@@ -34,9 +34,9 @@ deleteKVM() {
3434
#clean up if the KVM and create cache if not already exists
3535
deleteKVM 'gcp-sa-devrel'
3636

37-
curl -XPOST -u "$APIGEE_USER:$APIGEE_PASS" "https://api.enterprise.apigee.com/v1/o/$APIGEE_ORG/e/$APIGEE_ENV/caches" \
37+
curl -XPOST -s -u "$APIGEE_USER:$APIGEE_PASS" "https://api.enterprise.apigee.com/v1/o/$APIGEE_ORG/e/$APIGEE_ENV/caches" \
3838
-H 'Content-Type: application/json; charset=utf-8' \
39-
--data-binary @- << EOF
39+
--data-binary @- > /dev/null << EOF
4040
{
4141
"name":"gcp-tokens",
4242
"description":"GCP service account tokens",
@@ -51,16 +51,16 @@ EOF
5151
#don't continue on failure
5252
set -e
5353

54-
curl -XPOST -u "$APIGEE_USER:$APIGEE_PASS" "https://api.enterprise.apigee.com/v1/o/$APIGEE_ORG/e/$APIGEE_ENV/keyvaluemaps" \
54+
curl -XPOST -s -u "$APIGEE_USER:$APIGEE_PASS" "https://api.enterprise.apigee.com/v1/o/$APIGEE_ORG/e/$APIGEE_ENV/keyvaluemaps" \
5555
-H 'Content-Type: application/json; charset=utf-8' \
56-
--data-binary @- << EOF
56+
--data-binary @- > /dev/null << EOF
5757
{
5858
"name": "gcp-sa-devrel",
5959
"encrypted": "true",
6060
"entry": [
6161
{
6262
"name": "[email protected]",
63-
"value": $REF_GCP_SA_SF
63+
"value": $(echo "$REF_GCP_SA_SF" | jq '. | tostring')
6464
}
6565
]
6666
}

references/java-callout/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ In this example, the Java code is packaged as a jar, and as such has a separate
1919
export APIGEE_USER=xxx
2020
export APIGEE_PASS=xxx
2121
export APIGEE_ORG=xxx
22-
mvn clean install -Ptest
22+
mvn clean install -Ptest -ntp
2323
```

references/java-callout/pipeline.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515

1616
set -e
17-
set -x
17+
set -x
1818

19-
mvn install -Ptest -B
19+
mvn install -Ptest -B -ntp
2020
npm test --prefix proxy-v1

references/js-callout/pipeline.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
set -e
1818
set -x
1919

20-
npm i
20+
npm i --no-fund
2121
npm run deploy
2222
npm test

references/kvm-admin-api/pipeline.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
set -e
1818
set -x
1919

20-
mvn install
20+
mvn install -ntp -B
2121
npm run test

references/oidc-mock/pipeline.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
set -e
1717

1818
# deploy Apigee API Proxy
19-
mvn install -P"$APIGEE_ENV" -Dapigee.config.options=update
19+
mvn install -ntp -P"$APIGEE_ENV" -Dapigee.config.options=update
2020

2121
# execute integration tests
2222
npm install

references/southbound-mtls/pipeline.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set -x
2020
mkdir -p ./tmp
2121
curl https://badssl.com/certs/badssl.com-client.p12 -o ./tmp/badssl.com-client.p12
2222

23-
mvn install -Ptest -Dapigee.config.options=update
23+
mvn install -ntp -B -Ptest -Dapigee.config.options=update
2424

2525
npm i
2626
npm run test

tools/pipeline-linter/Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# <http://www.apache.org/licenses/LICENSE-2.0>
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM golang:alpine3.12
16+
17+
RUN apk add --no-cache git
18+
RUN go get github.com/google/addlicense
19+
RUN export GO111MODULE=on && go get github.com/googlecodelabs/tools/[email protected]
20+
21+
# install our dependencies
22+
COPY *.sh /usr/bin/
23+
24+
# Run script
25+
WORKDIR /home
26+
CMD ["check-licenses.sh"]

tools/pipeline-runner/action.yml tools/pipeline-linter/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 Google LLC
1+
# Copyright 2021 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: "Apigee DevRel Pipeline Runner"
15+
name: "Apigee DevRel Pipeline Linter"
1616
inputs:
1717
pipeline-action:
1818
required: true

tools/pipeline-runner/check-license.sh tools/pipeline-linter/check-license.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
set -e
16+
set -e
1717

1818
addlicense -check "$PWD"
File renamed without changes.

tools/pipeline-linter/pipeline.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# <http://www.apache.org/licenses/LICENSE-2.0>
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
echo "no pipeline required"

0 commit comments

Comments
 (0)