validateSchemaVersion validates if the plugin's schemaVersion is supported. The current schema-version is "0.1.0", but we don't want to break compatibility until v2.0.0 of the schema version. Check for the major version to be < 2.0.0. Note that CLI versions before 28.4.1 may not support these vers
(version string)
| 136 | // Note that CLI versions before 28.4.1 may not support these versions as they were |
| 137 | // hard-coded to only accept "0.1.0". |
| 138 | func validateSchemaVersion(version string) error { |
| 139 | if version == "0.1.0" { |
| 140 | return nil |
| 141 | } |
| 142 | if version == "" { |
| 143 | return errors.New("plugin SchemaVersion version cannot be empty") |
| 144 | } |
| 145 | major, _, ok := strings.Cut(version, ".") |
| 146 | majorVersion, err := strconv.Atoi(major) |
| 147 | if !ok || err != nil { |
| 148 | return fmt.Errorf("plugin SchemaVersion %q has wrong format: must be <major>.<minor>.<patch>", version) |
| 149 | } |
| 150 | if majorVersion > 1 { |
| 151 | return fmt.Errorf("plugin SchemaVersion %q is not supported: must be lower than 2.0.0", version) |
| 152 | } |
| 153 | return nil |
| 154 | } |
| 155 | |
| 156 | // RunHook executes the plugin's hooks command |
| 157 | // and returns its unprocessed output. |
no outgoing calls
no test coverage detected
searching dependent graphs…