(cmd *cobra.Command, args []string)
| 175 | } |
| 176 | |
| 177 | func sync(cmd *cobra.Command, args []string) error { |
| 178 | cqDir, err := cmd.Flags().GetString("cq-dir") |
| 179 | if err != nil { |
| 180 | return err |
| 181 | } |
| 182 | |
| 183 | noMigrate, err := cmd.Flags().GetBool("no-migrate") |
| 184 | if err != nil { |
| 185 | return err |
| 186 | } |
| 187 | |
| 188 | licenseFile, err := cmd.Flags().GetString("license") |
| 189 | if err != nil { |
| 190 | return err |
| 191 | } |
| 192 | |
| 193 | shard, err := parseShard(cmd) |
| 194 | if err != nil { |
| 195 | return err |
| 196 | } |
| 197 | |
| 198 | cqColumnsNotNull, err := cmd.Flags().GetBool("cq-columns-not-null") |
| 199 | if err != nil { |
| 200 | return err |
| 201 | } |
| 202 | |
| 203 | // in the cloud sync environment, we pass only the relevant environment variables to the plugin |
| 204 | isolatePluginEnvironment := env.IsCloud() |
| 205 | |
| 206 | ctx := cmd.Context() |
| 207 | log.Info().Strs("args", args).Msg("Loading spec(s)") |
| 208 | fmt.Printf("Loading spec(s) from %s\n", strings.Join(args, ", ")) |
| 209 | // Validate after injection so a source-only spec isn't rejected before the |
| 210 | // platform destination is added. |
| 211 | specReader, err := specs.NewSpecReaderWithoutValidation(args) |
| 212 | if err != nil { |
| 213 | return fmt.Errorf("failed to load spec(s) from %s. Error: %w", strings.Join(args, ", "), err) |
| 214 | } |
| 215 | |
| 216 | sources := specReader.Sources |
| 217 | destinations := specReader.Destinations |
| 218 | transformers := specReader.Transformers |
| 219 | |
| 220 | tableMetricsLocation, err := cmd.Flags().GetString("tables-metrics-location") |
| 221 | if err != nil { |
| 222 | return err |
| 223 | } |
| 224 | |
| 225 | summaryLocation, err := cmd.Flags().GetString("summary-location") |
| 226 | if err != nil { |
| 227 | return err |
| 228 | } |
| 229 | |
| 230 | var otelReceiver *otel.OtelReceiver |
| 231 | |
| 232 | // dlToken/teamName authenticate plugin download + usage against cloud |
| 233 | // (headless cqpd_ token, else cloud login). See cqplatform.DownloadAuth. |
| 234 | dlToken, teamName, err := cqplatform.DownloadAuth(ctx, log.Logger, sources, destinations, transformers) |
no test coverage detected