Skip to content

Commit 3204d38

Browse files
authored
Move examples into example-bundles repository (getporter#2015)
* Move examples into example-bundles repository Remove the example bundles in /examples/ and point to the relocated example bundles in https://github.com/getporter/example-bundles Signed-off-by: Carolyn Van Slyck <[email protected]> * Remove examples from the CI pipeline Now that the examples are moved into example-bundles, remove targets for building and publishing example bundles from Porter's build. Signed-off-by: Carolyn Van Slyck <[email protected]> * Copy exec-outputs as a test bundle Signed-off-by: Carolyn Van Slyck <[email protected]> * Update references to moved examples The example bundles were moved to github.com/getporter/examples, and are now published to ghcr.io/getporter/examples/NAME. The version number of most bundles was bumped as well to avoid confusing with existing bundles. Signed-off-by: Carolyn Van Slyck <[email protected]>
1 parent 5ca26b5 commit 3204d38

File tree

167 files changed

+180
-3268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+180
-3268
lines changed

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ It can be very helpful when figuring out why a command failed because you can se
446446
In development, you can use the [otel-jaeger bundle] to set up a development instance of Jaeger, which gives you a nice website to see each command run.
447447

448448
```
449-
porter install --reference carolynvs/otel-jaeger:v0.1.0 --allow-docker-host-access
449+
porter install --reference ghcr.io/getporter/examples/otel-jaeger:v0.1.0 --allow-docker-host-access
450450
```
451451

452452
Then to turn on tracing in Porter, set the following environment variables.
@@ -472,7 +472,7 @@ Next run a Porter command to generate some trace data, such as `porter list`.
472472
Then go to the Jaeger website to see your data: http://localhost:16686.
473473
On the Jaeger dashboard, select "porter" from the service drop down, and click "Find Traces".
474474

475-
[otel-jaeger bundle]: https://github.com/getporter/example-bundles/tree/main/otel-jaeger
475+
[otel-jaeger bundle]: https://getporter.org/examples/src/otel-jaeger
476476

477477
## Command Documentation
478478

Makefile

-58
Original file line numberDiff line numberDiff line change
@@ -74,64 +74,6 @@ define all-bundles
7474
done
7575
endef
7676

77-
EXAMPLES_DIR := examples
78-
79-
.PHONY: lint-examples
80-
lint-examples:
81-
ifndef BUNDLE
82-
$(call all-bundles,$(EXAMPLES_DIR),lint-examples)
83-
else
84-
cd $(EXAMPLES_DIR)/$(BUNDLE) && $(LOCAL_PORTER) lint
85-
endif
86-
87-
.PHONY: build-examples
88-
build-examples:
89-
ifndef BUNDLE
90-
$(call all-bundles,$(EXAMPLES_DIR),build-examples)
91-
else
92-
cd $(EXAMPLES_DIR)/$(BUNDLE) && $(LOCAL_PORTER) build --debug
93-
endif
94-
95-
.PHONY: publish-examples
96-
publish-examples:
97-
ifndef BUNDLE
98-
$(call all-bundles,$(EXAMPLES_DIR),publish-examples)
99-
else
100-
cd $(EXAMPLES_DIR)/$(BUNDLE) && $(LOCAL_PORTER) publish --registry $(PORTER_REGISTRY) --debug
101-
endif
102-
103-
SCHEMA_VERSION := cnab-core-1.0.1
104-
BUNDLE_SCHEMA := bundle.schema.json
105-
DEFINITIONS_SCHEMA := definitions.schema.json
106-
107-
define fetch-schema
108-
@curl -L --fail --silent --show-error -o /tmp/$(1) \
109-
https://cnab.io/schema/$(SCHEMA_VERSION)/$(1)
110-
endef
111-
112-
fetch-schemas: fetch-bundle-schema fetch-definitions-schema
113-
114-
fetch-bundle-schema:
115-
$(call fetch-schema,$(BUNDLE_SCHEMA))
116-
117-
fetch-definitions-schema:
118-
$(call fetch-schema,$(DEFINITIONS_SCHEMA))
119-
120-
HAS_AJV := $(shell command -v ajv)
121-
ajv:
122-
ifndef HAS_AJV
123-
npm install -g [email protected]
124-
endif
125-
126-
.PHONY: validate-bundle
127-
validate-examples: fetch-schemas ajv
128-
ifndef BUNDLE
129-
$(call all-bundles,$(EXAMPLES_DIR),validate-examples)
130-
else
131-
cd $(EXAMPLES_DIR)/$(BUNDLE) && \
132-
ajv test -s /tmp/$(BUNDLE_SCHEMA) -r /tmp/$(DEFINITIONS_SCHEMA) -d .cnab/bundle.json --valid
133-
endif
134-
13577
install:
13678
go run mage.go install
13779

build/azure-pipelines.canary.yml

-4
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@ parameters:
1414
- name: skipTests
1515
type: boolean
1616
default: false
17-
- name: publishExamples
18-
type: boolean
19-
default: false
2017

2118
extends:
2219
template: azure-pipelines.release-template.yml
2320
parameters:
2421
skipTests: ${{parameters.skipTests}}
2522
shouldPublish: ${{parameters.shouldPublish}}
26-
publishExamples: ${{parameters.publishExamples}}
2723
registry: ghcr.io/getporter

build/azure-pipelines.pr-automatic.yml

-26
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ pool:
1313
variables:
1414
GOVERSION: "1.18"
1515

16-
parameters:
17-
- name: buildExamples
18-
type: boolean
19-
default: false
20-
2116
stages:
2217
- stage: Setup
2318
jobs:
@@ -77,27 +72,6 @@ stages:
7772
displayName: "Configure Agent"
7873
- bash: mage TestUnit
7974
displayName: "Unit Test"
80-
- job: validate_examples
81-
displayName: "Validate Examples"
82-
dependsOn: build
83-
steps:
84-
- task: DownloadPipelineArtifact@2
85-
displayName: "Download Native Porter Binaries"
86-
inputs:
87-
source: current
88-
artifact: build-bin
89-
path: bin
90-
- task: GoTool@0
91-
displayName: "Set Go Version"
92-
inputs:
93-
version: "$(GOVERSION)"
94-
- script: go run mage.go SetBinExecutable
95-
displayName: "Setup Bin"
96-
- bash: make lint-examples
97-
displayName: "Lint Examples"
98-
- bash: make build-examples
99-
displayName: "Build Examples"
100-
condition: ${{parameters.buildExamples}}
10175
- job: build_docker
10276
dependsOn: xbuild
10377
steps:

build/azure-pipelines.release-template.yml

-35
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ parameters:
1717
- name: skipTests
1818
type: boolean
1919
default: false
20-
- name: publishExamples
21-
type: boolean
22-
default: true
2320

2421
stages:
2522
- stage: Validate
@@ -180,35 +177,3 @@ stages:
180177
command: login
181178
- script: PORTER_REGISTRY=${{parameters.registry}} mage PublishImages
182179
displayName: "Publish Docker Images to ${{parameters.registry}}"
183-
184-
- job: publish_example_bundles
185-
displayName: "Publish Example Bundles"
186-
condition: and(succeeded(), ${{ parameters.publishExamples }})
187-
pool:
188-
vmImage: ${{variables.vmImage}}
189-
steps:
190-
- task: GoTool@0
191-
displayName: "Set Go Version"
192-
inputs:
193-
version: ${{parameters.goVersion}}
194-
- task: DownloadPipelineArtifact@2
195-
displayName: "Download Native Porter Binaries"
196-
inputs:
197-
source: current
198-
artifact: build-bin
199-
path: bin
200-
- script: go run mage.go ConfigureAgent SetBinExecutable
201-
displayName: "Setup Bin"
202-
- bash: |
203-
set -e
204-
sudo make ajv
205-
make build-examples validate-examples
206-
displayName: "Build Example Bundles"
207-
- task: Docker@1
208-
displayName: Docker Login
209-
inputs:
210-
containerRegistryType: Container Registry
211-
dockerRegistryEndpoint: ${{parameters.registry}} # Log in with the saved credentials for the destination registry
212-
command: login
213-
- script: PORTER_REGISTRY=${{parameters.registry}} make publish-examples
214-
displayName: "Publish Example Bundles"

build/azure-pipelines.test-release.yml

-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ parameters:
88
- name: skipTests
99
type: boolean
1010
default: true
11-
- name: publishExamples
12-
type: boolean
13-
default: false
1411

1512
extends:
1613
template: azure-pipelines.release-template.yml
1714
parameters:
1815
skipTests: ${{ parameters.skipTests }}
1916
shouldPublish: ${{ parameters.shouldPublish }}
2017
registry: ghcr.io/getporter/test
21-
publishExamples: ${{ parameters.publishExamples }}

cmd/porter/bundle.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ Once a bundle has been successfully installed, the install action cannot be repe
140140
Porter uses the Docker driver as the default runtime for executing a bundle's invocation image, but an alternate driver may be supplied via '--driver/-d' or the PORTER_RUNTIME_DRIVER environment variable.
141141
For example, the 'debug' driver may be specified, which simply logs the info given to it and then exits.`,
142142
Example: ` porter bundle install
143-
porter bundle install MyAppFromReference --reference getporter/kubernetes:v0.1.0 --namespace dev
144-
porter bundle install --reference localhost:5000/getporter/kubernetes:v0.1.0 --insecure-registry --force
143+
porter bundle install MyAppFromReference --reference ghcr.io/getporter/examples/kubernetes:v0.2.0 --namespace dev
144+
porter bundle install --reference localhost:5000/ghcr.io/getporter/examples/kubernetes:v0.2.0 --insecure-registry --force
145145
porter bundle install MyAppInDev --file myapp/bundle.json
146146
porter bundle install --parameter-set azure --param test-mode=true --param header-color=blue
147147
porter bundle install --cred azure --cred kubernetes
@@ -198,8 +198,8 @@ The first argument is the installation name to upgrade. This defaults to the nam
198198
Porter uses the Docker driver as the default runtime for executing a bundle's invocation image, but an alternate driver may be supplied via '--driver/-d' or the PORTER_RUNTIME_DRIVER environment variable.
199199
For example, the 'debug' driver may be specified, which simply logs the info given to it and then exits.`,
200200
Example: ` porter bundle upgrade --version 0.2.0
201-
porter bundle upgrade --reference getporter/kubernetes:v0.1.0
202-
porter bundle upgrade --reference localhost:5000/getporter/kubernetes:v0.1.0 --insecure-registry --force
201+
porter bundle upgrade --reference ghcr.io/getporter/examples/kubernetes:v0.2.0
202+
porter bundle upgrade --reference localhost:5000/ghcr.io/getporter/examples/kubernetes:v0.2.0 --insecure-registry --force
203203
porter bundle upgrade MyAppInDev --file myapp/bundle.json
204204
porter bundle upgrade --parameter-set azure --param test-mode=true --param header-color=blue
205205
porter bundle upgrade --cred azure --cred kubernetes
@@ -255,8 +255,8 @@ The first argument is the installation name upon which to invoke the action. Thi
255255
Porter uses the Docker driver as the default runtime for executing a bundle's invocation image, but an alternate driver may be supplied via '--driver/-d' or the PORTER_RUNTIME_DRIVER environment variable.
256256
For example, the 'debug' driver may be specified, which simply logs the info given to it and then exits.`,
257257
Example: ` porter bundle invoke --action ACTION
258-
porter bundle invoke --reference getporter/kubernetes:v0.1.0
259-
porter bundle invoke --reference localhost:5000/getporter/kubernetes:v0.1.0 --insecure-registry --force
258+
porter bundle invoke --reference ghcr.io/getporter/examples/kubernetes:v0.2.0
259+
porter bundle invoke --reference localhost:5000/ghcr.io/getporter/examples/kubernetes:v0.2.0 --insecure-registry --force
260260
porter bundle invoke --action ACTION MyAppInDev --file myapp/bundle.json
261261
porter bundle invoke --action ACTION --parameter-set azure --param test-mode=true --param header-color=blue
262262
porter bundle invoke --action ACTION --cred azure --cred kubernetes
@@ -312,8 +312,8 @@ The first argument is the installation name to uninstall. This defaults to the n
312312
Porter uses the Docker driver as the default runtime for executing a bundle's invocation image, but an alternate driver may be supplied via '--driver/-d'' or the PORTER_RUNTIME_DRIVER environment variable.
313313
For example, the 'debug' driver may be specified, which simply logs the info given to it and then exits.`,
314314
Example: ` porter bundle uninstall
315-
porter bundle uninstall --reference getporter/kubernetes:v0.1.0
316-
porter bundle uninstall --reference localhost:5000/getporter/kubernetes:v0.1.0 --insecure-registry --force
315+
porter bundle uninstall --reference ghcr.io/getporter/examples/kubernetes:v0.2.0
316+
porter bundle uninstall --reference localhost:5000/ghcr.io/getporter/examples/kubernetes:v0.2.0 --insecure-registry --force
317317
porter bundle uninstall MyAppInDev --file myapp/bundle.json
318318
porter bundle uninstall --parameter-set azure --param test-mode=true --param header-color=blue
319319
porter bundle uninstall --cred azure --cred kubernetes
@@ -406,8 +406,8 @@ func buildBundleArchiveCommand(p *porter.Porter) *cobra.Command {
406406
Use: "archive FILENAME --reference PUBLISHED_BUNDLE",
407407
Short: "Archive a bundle from a reference",
408408
Long: "Archives a bundle by generating a gzipped tar archive containing the bundle, invocation image and any referenced images.",
409-
Example: ` porter bundle archive mybun.tgz --reference getporter/porter-hello:v0.1.0
410-
porter bundle archive mybun.tgz --reference localhost:5000/getporter/porter-hello:v0.1.0 --force
409+
Example: ` porter bundle archive mybun.tgz --reference ghcr.io/getporter/examples/porter-hello:v0.2.0
410+
porter bundle archive mybun.tgz --reference localhost:5000/ghcr.io/getporter/examples/porter-hello:v0.2.0 --force
411411
`,
412412
PreRunE: func(cmd *cobra.Command, args []string) error {
413413
return opts.Validate(cmd.Context(), args, p)

cmd/porter/bundle_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ func TestValidateInstallCommand(t *testing.T) {
1717
args string
1818
wantError string
1919
}{
20-
{"no args", "install -r getporter/porter-hello:v0.1.1", ""},
21-
{"invalid param", "install --param A:B -r getporter/porter-hello:v0.1.1", "invalid parameter (A:B), must be in name=value format"},
20+
{"no args", "install -r ghcr.io/getporter/examples/porter-hello:v0.2.0", ""},
21+
{"invalid param", "install --param A:B -r ghcr.io/getporter/examples/porter-hello:v0.2.0", "invalid parameter (A:B), must be in name=value format"},
2222
}
2323

2424
for _, tc := range testcases {

cmd/porter/copy.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Destination can be either a registry, a registry/repository, or a fully tagged b
1919
If the source bundle is a digest reference, destination must be a tagged reference.
2020
`,
2121
Example: ` porter bundle copy
22-
porter bundle copy --source getporter/porter-hello:v0.1.0 --destination portersh
23-
porter bundle copy --source getporter/porter-hello:v0.1.0 --destination portersh --insecure-registry
22+
porter bundle copy --source ghcr.io/getporter/examples/porter-hello:v0.2.0 --destination portersh
23+
porter bundle copy --source ghcr.io/getporter/examples/porter-hello:v0.2.0 --destination portersh --insecure-registry
2424
`,
2525
PreRunE: func(cmd *cobra.Command, args []string) error {
2626
return opts.Validate()

cmd/porter/explain.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ func buildBundleExplainCommand(p *porter.Porter) *cobra.Command {
1414
Short: "Explain a bundle",
1515
Long: "Explain how to use a bundle by printing the parameters, credentials, outputs, actions.",
1616
Example: ` porter bundle explain
17-
porter bundle explain --reference getporter/porter-hello:v0.1.0
18-
porter bundle explain --reference localhost:5000/getporter/porter-hello:v0.1.0 --insecure-registry --force
17+
porter bundle explain --reference ghcr.io/getporter/examples/porter-hello:v0.2.0
18+
porter bundle explain --reference localhost:5000/ghcr.io/getporter/examples/porter-hello:v0.2.0 --insecure-registry --force
1919
porter bundle explain --file another/porter.yaml
2020
porter bundle explain --cnab-file some/bundle.json
2121
porter bundle explain --action install

cmd/porter/inspect.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ If you would like more information about the bundle, the porter explain command
1717
like parameters, credentials, outputs and custom actions available.
1818
`,
1919
Example: ` porter bundle inspect
20-
porter bundle inspect --reference getporter/porter-hello:v0.1.0
21-
porter bundle inspect --reference localhost:5000/getporter/porter-hello:v0.1.0 --insecure-registry --force
20+
porter bundle inspect --reference ghcr.io/getporter/examples/porter-hello:v0.2.0
21+
porter bundle inspect --reference localhost:5000/ghcr.io/getporter/examples/porter-hello:v0.2.0 --insecure-registry --force
2222
porter bundle inspect --file another/porter.yaml
2323
porter bundle inspect --cnab-file some/bundle.json
2424
`,

docs/content/administrators/diagnostics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ See [Telemetry Settings][telemetry] for all the supported configuration settings
4242
[Log Settings]: /configuration/#logs
4343
[structured-logs]: /configuration/#structured-logs
4444
[OpenTelemetry]: https://opentelemetry.io
45-
[otel-jaeger bundle]: https://github.com/getporter/example-bundles/tree/main/otel-jaeger
45+
[otel-jaeger bundle]: /examples/src/otel-jaeger

docs/content/author-bundles.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The manifest is made up of multiple components. See the [Manifest File Format] f
2626
* [Required](#required)
2727
* [Generated Files](#generated-files)
2828

29-
We have full [examples](https://porter.sh/src/examples) of Porter manifests in the Porter repository.
29+
We have full [examples](https://github.com/getporter/examples) of Porter manifests in the Porter repository.
3030

3131
[templates]: /authors/templates/
3232
[Manifest File Format]: /reference/file-formats/#manifest
@@ -55,12 +55,10 @@ maintainers:
5555
* `description`: A description of the bundle
5656
* `version`: The version of the bundle, uses [semver](https://semver.org). A leading v prefix may optionally be used.
5757
* `registry`: The registry to use for publishing the bundle. The format is `REGISTRY_HOST/ORG`.
58-
Both the final bundle reference and invocation image name will be based on this value.
58+
The final bundle reference will be based on this value.
5959
For example, if the bundle name is `porter-hello`, registry is `getporter` and the version is `0.1.0`,
60-
the bundle reference will be `getporter/porter-hello:v0.1.0` and the invocation image name will be `getporter/porter-hello-installer:v0.1.0`
60+
the bundle reference will be `ghcr.io/getporter/examples/porter-hello:v0.2.0`.
6161
* `reference`: OPTIONAL. The bundle reference, taking precedence over any values set for the `registry`, `name` fields. The format is `REGISTRY_HOST/ORG/NAME`. The recommended pattern is to let the Docker tag be auto-derived from the `version` field. However, a full reference with a Docker tag included may also be specified.
62-
The invocation image name will also be based on this value when set. For example, if the `reference` is
63-
`getporter/porter-hello`, then the final invocation image name will be `getporter/porter-hello-installer:v0.1.0`.
6462

6563
When the version is used to default the tag, and it contains a plus sign (+), the plus sign is replaced with an underscore because while + is a valid semver delimiter for the build metadata, it is not an allowed character in a tag.
6664
* `dockerfile`: OPTIONAL. The relative path to a Dockerfile to use as a template during `porter build`.

docs/content/best-practices/exec-mixin.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ install:
7575
- generate-users
7676
```
7777
78-
[exec-outputs]: https://porter.sh/src/examples/exec-outputs/
78+
[exec-outputs]: /examples/src/exec-outputs/
7979
8080
## Quoting, Escaping, Bash and YAML
8181

docs/content/best-practices/gke.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ description: How to connect to a GKE cluster inside a Porter bundle.
66
GKE cluster authentication requires more than just a kubeconfig, it also needs a
77
service account configured.
88

9-
See the [GKE example][example] for a full working example bundle.
9+
See [ghcr.io/getporter/examples/gke][example] for a full working example bundle.
1010

11-
[example]: https://porter.sh/src/examples/gke-example
11+
[example]: /examples/src/gke
1212

1313
1. [Generate a kubeconfig](#generate-a-kubeconfig).
1414
1. [Create a service account](#create-a-service-account).

docs/content/blog/migrate-from-docker-app.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ We will use the [docker-compose mixin] to migrate an existing Docker App to Port
135135

136136
1. So far we have been working inside the "developer iteration loop", where you can edit the bundle on your local filesystem and deploy it to your developer environment to test it.
137137
Once the bundle is stable, the next step is to publish it to an OCI registry so that others can install your bundle using its reference.
138-
All of the porter commands accept a flag, \--reference, for example `porter install --reference getporter/porter-hello:v0.1.1` so that you do not need to distribute the bundle files themselves.
138+
All of the porter commands accept a flag, \--reference, for example `porter install --reference ghcr.io/getporter/examples/porter-hello:v0.2` so that you do not need to distribute the bundle files themselves.
139139

140140
1. When you are ready to share your bundle with others, select which OCI registry where you will host the bundle, for example, `ghcr.io/getporter` or on Docker Hub under your username `carolynvs`.
141141
Edit your porter.yaml and set the registry field to the destination registry.
@@ -144,7 +144,7 @@ We will use the [docker-compose mixin] to migrate an existing Docker App to Port
144144
name: my-docker-app
145145
version: 0.1.0
146146
description: My amazing docker app
147-
registry: ghcr.io/getporter
147+
registry: carolynvs
148148
```
149149

150150
1. Publish your bundle to the destination registry with `porter publish`.

0 commit comments

Comments
 (0)