Skip to content

Commit c7ab06b

Browse files
committed
yamllinting
1 parent 69a70c5 commit c7ab06b

File tree

12 files changed

+279
-281
lines changed

12 files changed

+279
-281
lines changed

.cspell.json

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
"cicd",
3232
"cloudbuild",
3333
"CODEOWNERS",
34+
"conversionresult",
35+
"conversiontable",
3436
"Coursera",
3537
"Dapigee",
3638
"devrel",
@@ -42,6 +44,7 @@
4244
"entrypoint",
4345
"envgroups",
4446
"eval",
47+
"fintech",
4548
"gcloud",
4649
"googleapi",
4750
"gserviceaccount",
@@ -76,6 +79,8 @@
7679
"sourcerepo",
7780
"statuscode",
7881
"templating",
82+
"traceid",
83+
"Turnstyle",
7984
"urlencode",
8085
"Userinfo"
8186
]

.github/workflows/devrel-image.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ jobs:
5050
org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/devrel
5151
cache-from: type=local,src=/tmp/.buildx-cache
5252
cache-to: type=local,dest=/tmp/.buildx-cache
53-
push: true
53+
push: true

.github/workflows/devrel-static-checks.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on:
2020
- main
2121
workflow_dispatch:
2222
schedule:
23-
- cron: "0 0 * * *"
23+
- cron: "0 0 * * *"
2424
jobs:
2525

2626
license:

.hadolint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
# limitations under the License.
1414

1515
ignored:
16-
- DL3018 # Pin versions in apk add
17-
- DL3059 # Multiple consecutive RUN instructions
16+
- DL3018 # Pin versions in apk add
17+
- DL3059 # Multiple consecutive RUN instructions

.shellcheckrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
disable=SC1090
1+
# relative paths and dynamic paths cannot be resolved by the tool
2+
disable=SC1090,SC1091

.yamllint

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
extends: default
2+
rules:
3+
document-start: disable
4+
line-length:
5+
level: warning
6+
new-line-at-end-of-file:
7+
level: warning
8+
ignore: |
9+
node_modules

labs/best-practices-hackathon/assets/currency-conversion-spec.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ info:
2020
url: https://github.com/apigee/devrel
2121
description: Mock API Specification for a Currency Converter
2222
servers:
23-
- url: /mock/v1
23+
- url: /mock/v1
2424
tags:
25-
- name: mock
26-
- name: currency
27-
- name: fintech
25+
- name: mock
26+
- name: currency
27+
- name: fintech
2828
paths:
2929
/currency/latest:
3030
get:
3131
summary: Get latest exchange rates
3232
operationId: get-latest-exchange-rates
3333
description: Get latest exchange rates
3434
tags:
35-
- currency
35+
- currency
3636
responses:
3737
"200":
3838
description: OK
@@ -59,7 +59,7 @@ paths:
5959
operationId: convert-currency
6060
description: Convert amount from base to target currency
6161
tags:
62-
- currency
62+
- currency
6363
parameters:
6464
- name: from
6565
in: query

references/cicd-pipeline/.eslintrc-jsc.yml

-18
This file was deleted.

references/cicd-pipeline/apiproxy/resources/jsc/.eslintrc.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@
1515
extends:
1616
- google
1717
- prettier
18-
rules: { no-var: 0 }
18+
rules:
19+
no-var: 0

references/cicd-pipeline/ci-config/cloudbuild/cloudbuild.yaml

+124-124
Original file line numberDiff line numberDiff line change
@@ -13,132 +13,132 @@
1313
# limitations under the License.
1414

1515
steps:
16-
# Install node dependencies for linting and testing
17-
- name: node
18-
id: "Install Dependencies"
19-
entrypoint: npm
20-
args:
21-
- "install"
22-
- "--silent"
23-
- "--no-fund"
24-
# Run static code analysis and linting
25-
- name: node
26-
id: "Static Code Analysis"
27-
entrypoint: "bash"
28-
args:
29-
- "-c"
30-
- |-
31-
npm run apigeelint | tee report.apigeelint.html && \
32-
if [ ${PIPESTATUS[0]} -ne "0" ]; then exit -1; fi && \
33-
npm run eslint | tee report.eslint.html && \
34-
if [ ${PIPESTATUS[0]} -ne "0" ]; then exit -1; fi
35-
# Run unit tests for custom policy implementations
36-
- name: node
37-
id: "Unit Test"
38-
entrypoint: "bash"
39-
args:
40-
- "-c"
41-
- "npm run unit-test"
42-
# Fetch Apigee credentials
43-
# and set branch specific config parameters
44-
- name: gcr.io/cloud-builders/gcloud
45-
entrypoint: "bash"
46-
id: "Fetch Credentials"
47-
args:
48-
- "-c"
49-
- |-
50-
# Config based on branch name
51-
if [ "$BRANCH_NAME" = "main" ]
52-
then
53-
echo "export APIGEE_ENV=$_APIGEE_TEST_ENV" >> env.txt
54-
echo "export APIGEE_DEPLOYMENT_SUFFIX=''" >> env.txt
55-
elif [ "$BRANCH_NAME" = "prod" ]
56-
then
57-
echo "export APIGEE_ENV=$_APIGEE_PROD_ENV" >> env.txt
58-
echo "export APIGEE_DEPLOYMENT_SUFFIX=''" >> env.txt
59-
else
60-
echo "export APIGEE_ENV=$_APIGEE_TEST_ENV" >> env.txt
61-
echo "export APIGEE_DEPLOYMENT_SUFFIX=\"-$(echo $BRANCH_NAME | \
62-
sed "s/[^A-Za-z0-9]/-/g")\"" >> env.txt
63-
fi
16+
# Install node dependencies for linting and testing
17+
- name: node
18+
id: "Install Dependencies"
19+
entrypoint: npm
20+
args:
21+
- "install"
22+
- "--silent"
23+
- "--no-fund"
24+
# Run static code analysis and linting
25+
- name: node
26+
id: "Static Code Analysis"
27+
entrypoint: "bash"
28+
args:
29+
- "-c"
30+
- |-
31+
npm run apigeelint | tee report.apigeelint.html && \
32+
if [ ${PIPESTATUS[0]} -ne "0" ]; then exit -1; fi && \
33+
npm run eslint | tee report.eslint.html && \
34+
if [ ${PIPESTATUS[0]} -ne "0" ]; then exit -1; fi
35+
# Run unit tests for custom policy implementations
36+
- name: node
37+
id: "Unit Test"
38+
entrypoint: "bash"
39+
args:
40+
- "-c"
41+
- "npm run unit-test"
42+
# Fetch Apigee credentials
43+
# and set branch specific config parameters
44+
- name: gcr.io/cloud-builders/gcloud
45+
entrypoint: "bash"
46+
id: "Fetch Credentials"
47+
args:
48+
- "-c"
49+
- |-
50+
# Config based on branch name
51+
if [ "$BRANCH_NAME" = "main" ]
52+
then
53+
echo "export APIGEE_ENV=$_APIGEE_TEST_ENV" >> env.txt
54+
echo "export APIGEE_DEPLOYMENT_SUFFIX=''" >> env.txt
55+
elif [ "$BRANCH_NAME" = "prod" ]
56+
then
57+
echo "export APIGEE_ENV=$_APIGEE_PROD_ENV" >> env.txt
58+
echo "export APIGEE_DEPLOYMENT_SUFFIX=''" >> env.txt
59+
else
60+
echo "export APIGEE_ENV=$_APIGEE_TEST_ENV" >> env.txt
61+
echo "export APIGEE_DEPLOYMENT_SUFFIX=\"-$(echo $BRANCH_NAME | \
62+
sed "s/[^A-Za-z0-9]/-/g")\"" >> env.txt
63+
fi
6464
65-
if [ "$_API_VERSION" = "apigee" ]
66-
then
67-
echo "export APIGEE_BUILD_PASS=\"$(gcloud secrets versions access latest \
68-
--secret=devrel_apigee_pass --format="get(payload.data)" | \
69-
base64 -d)\"" >> env.txt &&
70-
echo "export APIGEE_BUILD_USER=\"$(gcloud secrets versions access latest \
71-
--secret=devrel_apigee_user --format="get(payload.data)" | \
72-
base64 -d)\"" >> env.txt
73-
else
74-
echo "export APIGEE_BUILD_TOKEN=\"$(gcloud auth application-default print-access-token)\"" >> env.txt
75-
fi
65+
if [ "$_API_VERSION" = "apigee" ]
66+
then
67+
echo "export APIGEE_BUILD_PASS=\"$(gcloud secrets versions access latest \
68+
--secret=devrel_apigee_pass --format="get(payload.data)" | \
69+
base64 -d)\"" >> env.txt &&
70+
echo "export APIGEE_BUILD_USER=\"$(gcloud secrets versions access latest \
71+
--secret=devrel_apigee_user --format="get(payload.data)" | \
72+
base64 -d)\"" >> env.txt
73+
else
74+
echo "export APIGEE_BUILD_TOKEN=\"$(gcloud auth application-default print-access-token)\"" >> env.txt
75+
fi
7676
77-
echo "[BUILD CONFIG]"
78-
echo
79-
cat env.txt | sed "s/APIGEE_BUILD_PASS=.*/APIGEE_BUILD_PASS=[hidden]/g" | \
80-
sed "s/APIGEE_BUILD_TOKEN=.*/APIGEE_BUILD_TOKEN=[hidden]/g"
77+
echo "[BUILD CONFIG]"
78+
echo
79+
cat env.txt | sed "s/APIGEE_BUILD_PASS=.*/APIGEE_BUILD_PASS=[hidden]/g" | \
80+
sed "s/APIGEE_BUILD_TOKEN=.*/APIGEE_BUILD_TOKEN=[hidden]/g"
8181
82-
# Deploy using the Apigee credentials from above
83-
- name: "gcr.io/cloud-builders/mvn"
84-
id: "Proxy Deployment"
85-
entrypoint: "bash"
86-
args:
87-
- "-c"
88-
- |-
89-
if [ "$_API_VERSION" = "apigee" ]
90-
then
82+
# Deploy using the Apigee credentials from above
83+
- name: "gcr.io/cloud-builders/mvn"
84+
id: "Proxy Deployment"
85+
entrypoint: "bash"
86+
args:
87+
- "-c"
88+
- |-
89+
if [ "$_API_VERSION" = "apigee" ]
90+
then
91+
source env.txt && \
92+
mvn clean install -ntp \
93+
-P"apigeeapi" \
94+
-Denv="$${APIGEE_ENV}" \
95+
-Dpassword="$${APIGEE_BUILD_PASS}" \
96+
-Dusername="$${APIGEE_BUILD_USER}" \
97+
-Dorg="$_DEPLOYMENT_ORG" \
98+
-Ddeployment.suffix="$${APIGEE_DEPLOYMENT_SUFFIX}" \
99+
-Ddeployment.description="CloudRun Build: $BUILD_ID"
100+
else
101+
source env.txt && \
102+
mvn clean install -ntp \
103+
-P"googleapi" \
104+
-Denv="$${APIGEE_ENV}" \
105+
-Dtoken="$${APIGEE_BUILD_TOKEN}" \
106+
-Dorg="$_DEPLOYMENT_ORG" \
107+
-Ddeployment.suffix="$${APIGEE_DEPLOYMENT_SUFFIX}" \
108+
-Ddeployment.description="CloudRun Build: $BUILD_ID"
109+
fi
110+
# Run integration tests
111+
- name: node
112+
id: "Integration Test"
113+
entrypoint: "bash"
114+
args:
115+
- "-c"
116+
- |-
91117
source env.txt && \
92-
mvn clean install -ntp \
93-
-P"apigeeapi" \
94-
-Denv="$${APIGEE_ENV}" \
95-
-Dpassword="$${APIGEE_BUILD_PASS}" \
96-
-Dusername="$${APIGEE_BUILD_USER}" \
97-
-Dorg="$_DEPLOYMENT_ORG" \
98-
-Ddeployment.suffix="$${APIGEE_DEPLOYMENT_SUFFIX}" \
99-
-Ddeployment.description="CloudRun Build: $BUILD_ID"
100-
else
101-
source env.txt && \
102-
mvn clean install -ntp \
103-
-P"googleapi" \
104-
-Denv="$${APIGEE_ENV}" \
105-
-Dtoken="$${APIGEE_BUILD_TOKEN}" \
106-
-Dorg="$_DEPLOYMENT_ORG" \
107-
-Ddeployment.suffix="$${APIGEE_DEPLOYMENT_SUFFIX}" \
108-
-Ddeployment.description="CloudRun Build: $BUILD_ID"
109-
fi
110-
# Run integration tests
111-
- name: node
112-
id: "Integration Test"
113-
entrypoint: "bash"
114-
args:
115-
- "-c"
116-
- |-
117-
source env.txt && \
118-
npm run integration-test | tee report.e2e.html && \
119-
if [ ${PIPESTATUS[0]} -ne "0" ]; then exit -1; fi
120-
env:
121-
- "TEST_HOST=$_INT_TEST_HOST"
122-
# Copy coverage reports and other deployment artifacts to a storage bucket
123-
- name: "gcr.io/cloud-builders/gsutil"
124-
id: "Archive Report"
125-
entrypoint: "bash"
126-
args:
127-
- "-c"
128-
- |-
129-
gsutil cp -r coverage* \
130-
gs://${PROJECT_ID}_cloudbuild/reports/$BUILD_ID/coverage && \
131-
gsutil cp ./report.*.html \
132-
gs://${PROJECT_ID}_cloudbuild/reports/$BUILD_ID
118+
npm run integration-test | tee report.e2e.html && \
119+
if [ ${PIPESTATUS[0]} -ne "0" ]; then exit -1; fi
120+
env:
121+
- "TEST_HOST=$_INT_TEST_HOST"
122+
# Copy coverage reports and other deployment artifacts to a storage bucket
123+
- name: "gcr.io/cloud-builders/gsutil"
124+
id: "Archive Report"
125+
entrypoint: "bash"
126+
args:
127+
- "-c"
128+
- |-
129+
gsutil cp -r coverage* \
130+
gs://${PROJECT_ID}_cloudbuild/reports/$BUILD_ID/coverage && \
131+
gsutil cp ./report.*.html \
132+
gs://${PROJECT_ID}_cloudbuild/reports/$BUILD_ID
133133
substitutions:
134-
# Apigee Org for where to deploy to
135-
_DEPLOYMENT_ORG: my-org
136-
# (Optional) Apigee Environment overrides
137-
_APIGEE_TEST_ENV: test
138-
_APIGEE_PROD_ENV: prod
139-
# Management API version use:
140-
# 'apigee' for current Apigee Edge
141-
# 'google' for Apigee X and hybrid
142-
_API_VERSION: apigee #apigee|google
143-
# Host name for the integration test
144-
_INT_TEST_HOST: org-env.apigee.net
134+
# Apigee Org for where to deploy to
135+
_DEPLOYMENT_ORG: my-org
136+
# (Optional) Apigee Environment overrides
137+
_APIGEE_TEST_ENV: test
138+
_APIGEE_PROD_ENV: prod
139+
# Management API version use:
140+
# 'apigee' for current Apigee Edge
141+
# 'google' for Apigee X and hybrid
142+
_API_VERSION: apigee #apigee|google
143+
# Host name for the integration test
144+
_INT_TEST_HOST: org-env.apigee.net

0 commit comments

Comments
 (0)