Skip to content

Commit

Permalink
Sync render-helm-chart/v0.2 with the latest changes in master (#1026)
Browse files Browse the repository at this point in the history
Co-authored-by: Bharath KKB <bharathkrishnakb@gmail.com>
Co-authored-by: Awais Malik <awmalik@google.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: g-awmalik <malik.awais@gmail.com>
Co-authored-by: zyy98 <45323482+zyy98@users.noreply.github.com>
Co-authored-by: Natasha Sarkar <natashasarkar@google.com>
Co-authored-by: Snyk bot <snyk-bot@snyk.io>
Co-authored-by: Mengqi Yu <mengqiy@google.com>
Co-authored-by: Justin Santa Barbara <justinsb@google.com>
Co-authored-by: Wietse Muizelaar <wietse@wietsemuizelaar.nl>
Co-authored-by: Christopher Fry <ChristopherFry2008@gmail.com>
Co-authored-by: sdowell <sdowell@google.com>
Co-authored-by: Anthony Poschen <2253299+AnthonyPoschen@users.noreply.github.com>
Co-authored-by: Christopher Fry <christopherfry@google.com>
Co-authored-by: Andrew Peabody <andrewpeabody@google.com>
Co-authored-by: Morten Torkildsen <mortent@google.com>
Co-authored-by: wvl <nlwilliam@icloud.com>
fix:adds log-sink writer id to the export-terraform fn (#884)
fix: upgrade prettier from 2.6.0 to 2.7.1 (#896)
fix: upgrade @types/jasmine from 3.10.5 to 3.10.6 (#897)
fix: upgrade typescript from 4.5.2 to 4.7.4 (#894)
fix: upgrade prettier from 2.6.1 to 2.7.1 (#900)
fix a git ref conflict caused by HEAD hard reset (#860)
Fix some incorrect/duplicate go.mod paths (#920)
fix function (#925)
Fix several issues on `set-labels` (#928)
fix error message (#932)
fix: GitHub Action deprecates Node.js 12 (#940)
fix: Revert the Gob cleanup for `preview-hierarchy` function (#942)
fix fn (#945)
fix: make 'gcloud' as optional in Makefile for ko push (#947)
fix: Add ko installation in Makefile (#948)
fix: guarantee ko installation in fn Makefile (#950)
fix: guarantee ko installation in fn Makefile (#951)
fix (#949)
fix branch when generating the function catalog (#955)
fix CLI example (#968)
fix issue with parsing helm output (#1024)
  • Loading branch information
yuwenma committed Mar 2, 2023
1 parent d4fde00 commit 7b8e0bd
Show file tree
Hide file tree
Showing 85 changed files with 599 additions and 110 deletions.
4 changes: 2 additions & 2 deletions .github/hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

echo "Updating docs..."
make generate;
diff=`git diff`
diff=$(git diff)

if [[ $diff != "" ]];
then
echo "Found unstaged changes [$diff]. Make sure to run `make generate` for updating the docs before you commit the changes."
echo "Found unstaged changes [$diff]. Make sure to run \`make generate\` for updating the docs before you commit the changes."
exit 1
else
exit 0
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/after-push-to-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Run the CD script after pushes to branches
on:
push:
branches:
- "master"

jobs:
build:
name: after-push-to-branch
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '1.19.3'
- run: go version
- name: dev/cd/after-branch-push
run: GIT_REF=${GITHUB_REF} IMAGE_REPO=ghcr.io/${{ github.repository }} dev/cd/after-push-to-branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/after-tag-with-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Run the CD script after tags that look like versions
on:
push:
tags:
- "**/v[0-9]+.*"

jobs:
build:
name: after-tag-with-version
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: '1.19.3'
- run: go version
- name: dev/cd/after-tag-push
run: GIT_REF=${GITHUB_REF} IMAGE_REPO=ghcr.io/${{ github.repository }} dev/cd/after-tag-with-version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dispute. If you are unable to resolve the matter for any reason, or if the
behavior is threatening or harassing, report it. We are dedicated to providing
an environment where participants feel welcome and safe.

Reports should be directed to Frank Farzan frankf@google.com, the
Reports should be directed to Yuwen Ma yuwenma@google.com, the
Project Steward(s) for KPT Functions. It is the Project Steward’s duty to
receive and address reported violations of the code of conduct. They will then
work with a committee consisting of representatives from the Open Source
Expand All @@ -90,4 +90,4 @@ harassment or threats to anyone's safety, we may take action without notice.

This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
9 changes: 5 additions & 4 deletions MAINTAINERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Donny Xia <donnyxia@google.com>
Eyob Tefera <extaeger@google.com>
Frank Farzan <frankf@google.com>
Mengqi Yu <mengqiy@google.com>
Morten Torkildsen <mortent@google.com>
Sunil Arora <sunilarora@google.com>
Yuwen Ma <yuwenma@google.com>
Natasha Sarkar <natasha41575@google.com>
Justin Santa Barbara <justinsb@google.com>
44 changes: 44 additions & 0 deletions dev/cd/after-push-to-branch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

if [ -z "${GIT_REF}" ]; then
echo "GIT_REF must be set"
exit 1
fi

if [[ ! "${GIT_REF}" =~ ^refs/heads/.* ]]; then
echo "GIT_REF=${GIT_REF} is not of the expected format refs/heads/*"
exit 1
fi

BRANCH=${GIT_REF/refs\/heads\//}
echo "BRANCH is ${BRANCH}"

REF=$(git rev-parse --short HEAD)
echo "REF is ${REF}"

# We push two tags, <branchname>-latest and <branchname>-git-$GITSHA
# The idea is that if you want the latest version from that branch,
# you'll use the first form, if you want a particular version
# you can use the second form.
#
# We also map main-latest to just "latest" (another reason for people to rename master -> main)
BRANCH_IMAGE_TAG="${BRANCH}-latest"
if [[ "${BRANCH_IMAGE_TAG}" == "main-latest" ]]; then
BRANCH_IMAGE_TAG="latest"
fi
REF_IMAGE_TAG="${BRANCH}-git-${REF}"
export IMAGE_TAG="${REF_IMAGE_TAG},${BRANCH_IMAGE_TAG}"
echo "IMAGE_TAG is ${IMAGE_TAG}"

# We identify functions that follow this new approach by the presence of the krm-fn-metadata.yaml file.
find . -type f -name "krm-fn-metadata.yaml" -print0 | while IFS= read -r -d '' f; do
dir=$(dirname "${f}")
echo "directory: ${dir}"
pushd "${dir}"
make push
popd
done
31 changes: 31 additions & 0 deletions dev/cd/after-tag-with-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

if [ -z "${GIT_REF}" ]; then
echo "GIT_REF must be set"
exit 1
fi

if [[ ! "${GIT_REF}" =~ ^refs/tags/.* ]]; then
echo "GIT_REF=${GIT_REF} is not of the expected format refs/tags/*"
exit 1
fi

TAG=${GIT_REF/refs\/tags\//}
echo "TAG is ${TAG}"

VERSION=${TAG##*/}
PREFIX=${TAG%/*}
echo "PREFIX is ${PREFIX}, VERSION is ${VERSION}"

if [[ ! -d "${PREFIX}" ]]; then
echo "Directory ${PREFIX} is not found"
exit 1
fi

export IMAGE_TAG=${VERSION}
cd "${PREFIX}"
make push
2 changes: 2 additions & 0 deletions examples/apply-replacements-simple/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
mutators:
- image: gcr.io/kpt-fn/apply-replacements:unstable
Expand Down
2 changes: 2 additions & 0 deletions examples/apply-setters-simple/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
mutators:
- image: gcr.io/kpt-fn/apply-setters:unstable
Expand Down
2 changes: 2 additions & 0 deletions examples/create-setters-simple/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
mutators:
- image: gcr.io/kpt-fn/create-setters:unstable
Expand Down
2 changes: 2 additions & 0 deletions examples/enable-gcp-services-advanced/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: enable-gcp-services-advanced
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
mutators:
- image: gcr.io/kpt-fn/enable-gcp-services:unstable
2 changes: 2 additions & 0 deletions examples/enable-gcp-services-simple/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: enable-gcp-services-simple
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
mutators:
- image: gcr.io/kpt-fn/enable-gcp-services:unstable
8 changes: 4 additions & 4 deletions examples/ensure-name-substring-advanced/.expected/diff.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/fn-config.yaml b/fn-config.yaml
index 12939e5..0ee2f64 100644
index d0a96a3..c191e3d 100644
--- a/fn-config.yaml
+++ b/fn-config.yaml
@@ -1,7 +1,7 @@
Expand All @@ -8,9 +8,9 @@ index 12939e5..0ee2f64 100644
metadata:
- name: my-config
+ name: prod-my-config
annotations:
config.kubernetes.io/local-config: "true"
additionalNameFields:
- kind: MyResource
group: dev.example.com
diff --git a/resources.yaml b/resources.yaml
index 8e037c3..ffd583b 100644
--- a/resources.yaml
Expand Down Expand Up @@ -58,4 +58,4 @@ index 8e037c3..ffd583b 100644
namespace: the-namespace
spec:
- name: foo
+ name: prod-foo
+ name: prod-foo
2 changes: 2 additions & 0 deletions examples/ensure-name-substring-advanced/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
mutators:
- image: gcr.io/kpt-fn/ensure-name-substring:unstable
Expand Down
2 changes: 2 additions & 0 deletions examples/ensure-name-substring-advanced/fn-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: fn.kpt.dev/v1alpha1
kind: EnsureNameSubstring
metadata:
name: my-config
annotations:
config.kubernetes.io/local-config: "true"
additionalNameFields:
- kind: MyResource
group: dev.example.com
Expand Down
2 changes: 2 additions & 0 deletions examples/ensure-name-substring-depends-on/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
mutators:
- image: gcr.io/kpt-fn/ensure-name-substring:unstable
Expand Down
2 changes: 2 additions & 0 deletions examples/ensure-name-substring-prefix/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
mutators:
- image: gcr.io/kpt-fn/ensure-name-substring:unstable
Expand Down
2 changes: 2 additions & 0 deletions examples/ensure-name-substring-suffix/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
mutators:
- image: gcr.io/kpt-fn/ensure-name-substring:unstable
Expand Down
8 changes: 5 additions & 3 deletions examples/fix-simple/.expected/diff.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
diff --git a/Kptfile b/Kptfile
index a8e7f27..30e5250 100644
index 1cc6b93..a0041c1 100644
--- a/Kptfile
+++ b/Kptfile
@@ -1,20 +1,24 @@
@@ -1,22 +1,26 @@
-apiVersion: kpt.dev/v1alpha1
+apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: nginx
annotations:
config.kubernetes.io/local-config: "true"
-packageMetadata:
- shortDescription: describe this package
upstream:
Expand Down Expand Up @@ -61,4 +63,4 @@ index 0000000..b67bc21
+metadata:
+ name: setters
+data:
+ name: the-map
+ name: the-map
2 changes: 2 additions & 0 deletions examples/fix-simple/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1alpha1
kind: Kptfile
metadata:
name: nginx
annotations:
config.kubernetes.io/local-config: "true"
packageMetadata:
shortDescription: describe this package
upstream:
Expand Down
2 changes: 2 additions & 0 deletions examples/gatekeeper-disallow-root-user/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
validators:
- image: gcr.io/kpt-fn/gatekeeper:unstable
2 changes: 2 additions & 0 deletions examples/gatekeeper-invalid-configmap/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
validators:
- image: gcr.io/kpt-fn/gatekeeper:unstable
2 changes: 2 additions & 0 deletions examples/gatekeeper-warning-only/Kptfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kpt.dev/v1
kind: Kptfile
metadata:
name: example
annotations:
config.kubernetes.io/local-config: "true"
pipeline:
validators:
- image: gcr.io/kpt-fn/gatekeeper:unstable
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
diff --git a/Kptfile b/Kptfile
index bfbf712..6dd3f52 100644
index d8e547b..dadae4c 100644
--- a/Kptfile
+++ b/Kptfile
@@ -4,4 +4,4 @@ metadata:
@@ -3,7 +3,7 @@ kind: Kptfile
metadata:
name: example
annotations:
- config.kubernetes.io/local-config: "true"
+ config.kubernetes.io/local-config: 'true'
pipeline:
mutators:
- - image: gcr.io/kpt-fn/generate-folders:unstable
Expand Down Expand Up @@ -97,4 +101,4 @@ index 0000000..c7e3f01
+ cnrm.cloud.google.com/organization-id: test-organization
+ cnrm.cloud.google.com/blueprint: 'kpt-fn'
+spec:
+ displayName: Prod
+ displayName: Prod
Loading

0 comments on commit 7b8e0bd

Please sign in to comment.