Sha256: b0c0015c25acfec4d1897a878b280399553efa4f9bd4da5b1bf64fe1426ac3a6

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

module Sct
    class DatabasePullCommand
        def error message
            UI.error message
            exit 1
        end
        
        def execute args, options
            branch = ENV['CI_BRANCH'] || 'master'

            # We need to set this locally, so that we don't save this at the repository 
            pipeline_endpoint = ENV['CI_MERGE_REQUEST_PIPELINE']
            if not pipeline_endpoint
                error "Pipeline endpoint not set"
            end

            # We need to set this locally, so that we don't save this at the repository
            private_token = ENV['CI_PRIVATE_TOKEN']
            if not private_token
                error "Private token not set"
            end

            if options.proactive_frame
                UI.important("Requesting to pull database for proactive frame")
                process_request = `curl -X POST -F token=#{private_token} -F ref=#{branch} -F variables[DB_PULL_FRAME]=true #{pipeline_endpoint}`
            end
            
            if options.proactive_config
                UI.important("Requesting to pull database for proactive config")
                process_request = `curl -X POST -F token=#{private_token} -F ref=#{branch} -F variables[DB_PULL_CONFIG]=true #{pipeline_endpoint}`
            end
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sct-1.0.8 sct/lib/sct/commands/databasepull.rb