executePipeline static method

Future<void> executePipeline()

Execute Pipeline

Implementation

static Future<void> executePipeline() async {
  final config = Config().config;

  final List<PipelineStepModel>? stages = config.pipelineSteps;

  for (final stage in stages!) {
    final String stageName = stage.name;
    print('\nšŸš€ Starting stage: $stageName');

    final success = await _executeStep(
      stage,
    );

    if (!success) {
      print('āŒ Pipeline failed at step: $stageName');
      return;
    }

    /// Upload artifact, if `outputPath != null && uploadOutput = true`.
    if (stage.uploadOutput && stage.outputPath != null) {
      // Upload artifact to Cloud.
      await promptUploadOption(stage.outputPath!);

      /// Generate QR code and link.
      await generateQrCodeAndLink();
    }

    /// Notify slack, if `notifySlack = true`.
    if (stage.notifySlack) {
      /// Notify Slack.
      await notifySlack();
    }

    print('āœ… Stage completed: $stageName \n');
  }

  print('šŸŽ‰ Pipeline executed successfully!');
}