Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies V2 Playground #2099

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d3d11c9
Convert a depsv2 porter.yaml into bundle.json
carolynvs Aug 31, 2022
9b1a5e5
Remove name field from CNAB dependency representation in bundle.json
carolynvs Feb 5, 2023
ad6f58b
Consolidate testdata so we don't have a bunch of similar bundles
carolynvs Feb 2, 2023
d476874
wip: stub structs and logic for a bundle workflow
carolynvs Sep 11, 2022
8610bfa
wip
carolynvs Dec 24, 2022
701d725
wip: test passes with stuff commented out because dry-run prints the …
carolynvs Dec 24, 2022
54251e3
yes we should inject dependency defs into a bundle
carolynvs Feb 12, 2023
aae9178
Manually hydrate deps name in cnab representation of depsv2
carolynvs Feb 12, 2023
a9702df
make vet and lint happy
carolynvs Feb 12, 2023
1424fad
Fix schema test to work with beefier mybuns testdata
carolynvs Feb 12, 2023
2d33418
HACK: DO NOT MERGE: Optionally load bundle dependency.json until we f…
carolynvs Feb 12, 2023
44f76d7
laptop sync
carolynvs Feb 13, 2023
4e111db
wip: made better testdata but now I want the workflow dump to look right
carolynvs Feb 15, 2023
cdeede0
Add DisplayWorkflow structure
carolynvs Feb 15, 2023
6449cd9
laptop sync
carolynvs Feb 16, 2023
f16161d
do not keep without editing
carolynvs Feb 16, 2023
74a2381
Add imported workflow testdata
carolynvs Feb 22, 2023
bbfd048
laptop sync
carolynvs Feb 24, 2023
d95a8f6
Fix display workflow tests to use stable data
carolynvs Feb 28, 2023
b5988e3
this commit will go away when I rebase on depsv2 because the test dat…
carolynvs Feb 28, 2023
4271af3
wip
carolynvs Mar 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
this commit will go away when I rebase on depsv2 because the test dat…
…a should match then

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
carolynvs committed Feb 28, 2023
commit b5988e35f690c0c91456afcfd0b2b78a79d22d55
6 changes: 6 additions & 0 deletions tests/testdata/helpers.go
Original file line number Diff line number Diff line change
@@ -25,6 +25,12 @@ const (
// MyInfraRef is the full reference to the myinfra test bundle.
MyInfraRef = "localhost:5000/myinfra:v0.1.0"

// MySQLDb is the test bundle that is a dependency of the myinfra test bundle.
MySQLDb = "mysqldb"

// MySQLDbRef is the full reference to the mysqldb test bundle.
MySQLDbRef = "localhost:5000/mysqldb:v0.1.0"

// MyApp is the root test bundle that exercises dependencies.
MyApp = "myapp"

11 changes: 1 addition & 10 deletions tests/testdata/mybuns/porter.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is a test bundle that makes no logical sense, but it does exercise lots of different bundle features

#schemaType: Bundle
schemaVersion: 1.0.0
name: mybuns
version: 0.1.2
@@ -173,17 +173,8 @@ dependencies:
- name: db
bundle:
reference: "localhost:5000/mydb:v0.1.0"
# TODO(PEP003): Implement in https://github.com/getporter/porter/issues/2548
#interface:
# document:
# outputs:
# - name: connstr
# $id: "getporter.org/interfaces/mysql.connection-string"
parameters:
database: bigdb
collation: ${bundle.parameters.db-collation}
credentials:
username: ${bundle.credentials.username}

images:
whalesayd:
15 changes: 3 additions & 12 deletions tests/testdata/mydb/porter.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This is a test bundle that can be used as a dependency
# TODO(PEP003): Do not depend on this bundle from mybuns, and move testcases like installerImage out of here

schemaVersion: 1.0.0
name: mydb
version: 0.1.0
@@ -9,16 +9,7 @@ registry: localhost:5000
parameters:
- name: database
type: string
default: "mydb"
- name: collation
type: string
default: "Latin1_General_100_CS_AS"
- name: logLevel
type: string

credentials:
- name: token
env: CLOUD_TOKEN
default: "(default)"

outputs:
- name: connStr
@@ -50,7 +41,7 @@ install:
description: "Debug"
command: echo
arguments:
- "image: ${ bundle.installerImage }"
- "image:${ bundle.installerImage }"

status:
- exec:
2 changes: 1 addition & 1 deletion tests/testdata/myinfra/porter.yaml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ dependencies:
requires:
- name: db
bundle:
reference: "localhost:5000/mydb:v0.1.0"
reference: "localhost:5000/mysqldb:v0.1.0"
credentials:
token: ${bundle.credentials.token}
parameters:
4 changes: 4 additions & 0 deletions tests/testdata/mysqldb/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Put files here that you don't want copied into your bundle's invocation image
.gitignore
Dockerfile.tmpl
1 change: 1 addition & 0 deletions tests/testdata/mysqldb/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.cnab/
1 change: 1 addition & 0 deletions tests/testdata/mysqldb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a modified copy of the mydb bundle so that we can make changes for the dependencies v2 feature without breaking existing tests that use mybuns/mydb.
1 change: 1 addition & 0 deletions tests/testdata/mysqldb/connection-string.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this is a connection string
72 changes: 72 additions & 0 deletions tests/testdata/mysqldb/porter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This is a test bundle that can be used as a dependency
# TODO(PEP003): Do not depend on this bundle from mybuns, and move testcases like installerImage out of here
schemaVersion: 1.0.0
name: mysqldb
version: 0.1.0
description: "A test bundle dependency"
registry: localhost:5000

parameters:
- name: database
type: string
default: "mysqldb"
- name: collation
type: string
default: "Latin1_General_100_CS_AS"
- name: logLevel
type: string
default: error

credentials:
- name: token
env: CLOUD_TOKEN

outputs:
- name: connStr
type: file
path: /cnab/app/connection-string.txt
applyTo:
- install
- upgrade

mixins:
- exec

dry-run:
- exec:
command: echo
arguments:
- "ready to install mysqldb"

install:
- exec:
command: echo
arguments:
- "installing mysqldb"
- exec:
command: echo
arguments:
- "database: ${ bundle.parameters.database }"
- exec:
description: "Debug"
command: echo
arguments:
- "image: ${ bundle.installerImage }"

status:
- exec:
command: echo
arguments:
- "mysqldb is looking great!"

upgrade:
- exec:
command: echo
arguments:
- "upgrading mysqldb"

uninstall:
- exec:
command: echo
arguments:
- "uninstalling mysqldb"