Skip to content

Commit

Permalink
Automate manifest update out of README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
isimluk committed Nov 26, 2021
1 parent 3767ad8 commit 3a48ebe
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/operator-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: |
export PATH=$HOME/go/bin:$PATH
make manifests generate
make bundle
touch README.md ; make bundle
rm deploy/falcon-operator.yaml && make deploy/falcon-operator.yaml
find ./bundle* -type f -exec sed -i -e 's/operator-sdk-v1.7.1+git/operator-sdk-v1.8.0/g' {} \;
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ endef

# Generate bundle manifests and metadata, then validate generated files.
.PHONY: bundle
bundle: manifests kustomize operator-sdk
bundle: manifests kustomize operator-sdk config/manifests/bases/falcon-operator.clusterserviceversion.yaml
operator-sdk generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
Expand Down Expand Up @@ -143,3 +143,6 @@ deploy/parts/crd-falconnodesensors.yaml: bundle/manifests/falcon.crowdstrike.com

deploy/falcon-operator.yaml: deploy/parts/crd-falconcontainers.yaml deploy/parts/crd-falconnodesensors.yaml deploy/parts/ns.yaml deploy/parts/role.yaml deploy/parts/service_account.yaml deploy/parts/role_binding.yaml deploy/parts/operator.yaml
cat $^ > $@

config/manifests/bases/falcon-operator.clusterserviceversion.yaml: README.md
hack/update-manifest.sh $@ $^
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ spec:
kind: FalconNodeSensor
name: falconnodesensors.falcon.crowdstrike.com
version: v1alpha1
description: |
description: |-
Falcon Operator installs CrowdStrike Falcon Container Sensor on the cluster.
Falcon Operator is an open source project, not a CrowdStrike product. As such it carries no formal support, expressed or implied.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
kind: FalconNodeSensor
name: falconnodesensors.falcon.crowdstrike.com
version: v1alpha1
description: |
description: |-
Falcon Operator installs CrowdStrike Falcon Container Sensor on the cluster.
Falcon Operator is an open source project, not a CrowdStrike product. As such it carries no formal support, expressed or implied.
Expand Down
10 changes: 10 additions & 0 deletions hack/update-manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e -o pipefail

readme="${2}"
last_banner_line=$(cat $readme | grep --line-number '\[!\[' | tail -n 1 | sed 's/:.*$//g')
let "first_readme_line=last_banner_line+1"
export content="$(tail -n +${first_readme_line} ${readme} | sed 's/(docs\//(https:\/\/github.com\/CrowdStrike\/falcon-operator\/tree\/main\/docs\//g' )"
yq -i e '.spec.description=strenv(content)' "${1}"
operator-sdk generate kustomize manifests -q

0 comments on commit 3a48ebe

Please sign in to comment.