upbound / up

The @upbound CLI
Apache License 2.0
52 stars 41 forks source link

Latest up version doesn't add regexp patch transforms to the package.yaml file #329

Closed ezgidemirel closed 1 year ago

ezgidemirel commented 1 year ago

What happened?

I tried to build platform-ref-gcp with up version v.0.16.1 and noticed that patch command is missing the reg expression rule like below:

      - fromFieldPath: status.atProvider.id
        policy:
          fromFieldPath: Required
        toFieldPath: status.gke.project
        transforms:
        - string:
            type: Regexp
          type: string
        type: ToCompositeFieldPath

correct patch:

        - type: ToCompositeFieldPath
          fromFieldPath: status.atProvider.id
          toFieldPath: status.gke.project
          transforms:
            - type: string
              string:
                type: Regexp
                regexp:
                  match: projects\/(.+)\/serviceAccounts\/.*
                  group: 1
          policy:
            fromFieldPath: Required

Epic #

How can we reproduce it?

Build the configuration with the command below:

up xpkg build --name ezgi-platform-ref-gcp.xpkg --package-root=package --examples-root=examples

What environment did it happen in?

up cli version v0.16.1

phisco commented 1 year ago

My guess is that it's due to the old version of crossplane being used, v1.6.0, which didn't have regexp as a field in transforms and therefore it gets lost in the serialisation. I didn't have time to check though.

phisco commented 1 year ago

Same goes for match type transforms, and in general for any field added later than 1.6.0