-
Notifications
You must be signed in to change notification settings - Fork 144
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
feat(serialization): Use friendly names for artifact types #560
feat(serialization): Use friendly names for artifact types #560
Conversation
DEB | ||
enum class ArtifactType(@JsonValue val friendlyName: String) { | ||
DEB("deb"), | ||
DOCKER_IMAGE("docker"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a1f1425
to
1b0f12b
Compare
@emjburns @erikmunson Please review. |
this is great! thanks Luis. FWIW, it appears Emily switched the enum value to |
Hey @erikmunson, yes, I noticed that after I made my change. I'll remove the line to convert from |
ea59644
to
cafd4c2
Compare
@emjburns @erikmunson This is now rebased after Emily's PR was merged. @robfletcher If you want to take a look as well, please do! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆 looks good! This will work if you have either deb
or DEB
in the yaml, right?
Oh related question to Emily's — what will the export resource endpoint emit in its YAML for delivery artifacts after this change? Ideally it would prefer the lower case form. |
@emjburns Right, it will work with both formats. I added a test for that as well.
@erikmunson Yes, JSON output will be using the friendly format. For example: ---
metadata:
serviceAccount: "keel@spinnaker.io"
apiVersion: "ec2.spinnaker.netflix.com/v1"
kind: "cluster"
spec:
moniker:
app: "keeldemo"
stack: "main"
imageProvider:
deliveryArtifact:
name: "keeldemo"
type: "deb"
locations:
account: "test"
subnet: "internal (vpc0)"
vpc: "vpc0"
regions:
- name: "us-west-2"
launchConfiguration:
instanceType: "m5.large"
ebsOptimized: true
iamRole: "keeldemoInstanceProfile"
keyPair: "nf-test-keypair-a"
instanceMonitoring: false
capacity:
min: 1
max: 1
desired: 1
dependencies:
loadBalancerNames:
- "keeldemo-main-clb"
securityGroupNames:
- "keeldemo"
- "nf-datacenter"
- "nf-infrastructure" |
@emjburns If you're OK with it, could you please add the |
Addresses #557 by introducing "friendly names" for artifact types (i.e. lower-case names as opposed to the default enum value names). Given that all current friendly names match the upper-case enum names, this could probably be even simpler, but when I started we had a conversion between
"docker"
andDOCKER_TYPE
and so I figured it's OK to have a place to add that kind of logic if we ever have other types that don't match the friendly name. The@JsonCreator
factory method also allows for backwards-compatibility with existing specs still using the upper-as names.