<commit_before>pipeline {
    agent {
        label 'docker01'
    }

    options {
        ansiColor colorMapName: 'XTerm'
    }

    parameters {
        string(
                name: 'APP_SERVER',
                defaultValue: '10.10.10.185',
                description: 'Deploy container to this server.'
        )
        string(
                name: 'DATABASE_HOST',
                defaultValue: '10.10.10.122',
                description: 'Postgresql DB host.'
        )
        string(
                name: 'DATABASE_PORT',
                defaultValue: '55432',
                description: 'Postgresql DB port.'
        )
        string(
                name: "COMMAND",
                defaultValue: "python -m gold_digger --help",
                description: "One time command to be executed"
        )
    }

    stages {
        stage('Run container') {
            steps {
                withCredentials([
                    string(credentialsId: 'docker-registry-azure', variable: 'DRpass'),
                    string(
                        credentialsId: 'gold_digger_master_secrets_currency_layer_access_key',
                        variable: 'gold_digger_master_secrets_currency_layer_access_key'
                    ),
                    string(
                        credentialsId: 'gold_digger_master_secrets_fixer_access_key',
                        variable: 'gold_digger_master_secrets_fixer_access_key'
                    ),
                    usernamePassword(
                        credentialsId: 'gold_digger_master_database',
                        usernameVariable: 'gold_digger_master_db_user',
                        passwordVariable: '<PASSWORD>'
                    )
                ]) {
                    script {
                        def server = params['APP_SERVER']
                        def database_host = params['DATABASE_HOST']
                        def database_port = params['DATABASE_PORT']
                        def command_name = getContainerName("${params.COMMAND}")
                        def command = "${params.COMMAND}"

                        sshagent(['5de2256c-107d-4e4a-a31e-2f33077619fe']) {
                            sh """ssh -oStrictHostKeyChecking=no -t -t jenkins@${server} <<EOF
                                docker login roihunter.azurecr.io -u roihunter -p "$DRpass"
                                docker pull roihunter.azurecr.io/golddigger/master
                                docker run --rm -d \
                                    -e "GOLD_DIGGER_PROFILE=master" \
                                    -e GOLD_DIGGER_DATABASE_HOST='''$database_host''' \
                                    -e GOLD_DIGGER_DATABASE_PORT='''$database_port''' \
                                    -e GOLD_DIGGER_DATABASE_USER='''$gold_digger_master_db_user''' \
                                    -e GOLD_DIGGER_DATABASE_PASSWORD='''$gold_digger_master_db_password''' \
                                    -e GOLD_DIGGER_SECRETS_CURRENCY_LAYER_ACCESS_KEY='''$gold_digger_master_secrets_currency_layer_access_key''' \
                                    -e GOLD_DIGGER_SECRETS_FIXER_ACCESS_KEY='''$gold_digger_master_secrets_fixer_access_key''' \
                                    --hostname="golddigger-one-time-${command_name}-${env.BUILD_ID}" \
                                    --name="golddigger-one-time-${command_name}-${env.BUILD_ID}" \
                                    roihunter.azurecr.io/golddigger/master \
                                    ${command}

                                yes | docker image prune || exit 1
                                exit
                                EOF"""
                        }
                    }
                }
            }
        }
    }

    post {
        always {
            // Clean Workspace
            cleanWs()
        }<commit_msg>Fix multifunctional pipeline<commit_after>pipeline {
    agent {
        label 'docker01'
    }

    options {
        ansiColor colorMapName: 'XTerm'
    }

    parameters {
        string(
                name: 'APP_SERVER',
                defaultValue: '10.10.10.185',
                description: 'Deploy container to this server.'
        )
        string(
                name: 'DATABASE_HOST',
                defaultValue: '10.10.10.122',
                description: 'Postgresql DB host.'
        )
        string(
                name: 'DATABASE_PORT',
                defaultValue: '55432',
                description: 'Postgresql DB port.'
        )
        string(
                name: "COMMAND",
                defaultValue: "python -m gold_digger --help",
                description: "One time command to be executed"
        )
    }

    stages {
        stage('Run container') {
            steps {
                withCredentials([
                    string(credentialsId: 'docker-registry-azure', variable: 'DRpass'),
                    string(
                        credentialsId: 'gold_digger_master_secrets_currency_layer_access_key',
                        variable: 'gold_digger_master_secrets_currency_layer_access_key'
                    ),
                    string(
                        credentialsId: 'gold_digger_master_secrets_fixer_access_key',
                        variable: 'gold_digger_master_secrets_fixer_access_key'
                    ),
                    usernamePassword(
                        credentialsId: 'gold_digger_master_database',
                        usernameVariable: 'gold_digger_master_db_user',
                        passwordVariable: '<PASSWORD>'
                    ),
                    string(
                        credentialsId: "graylog_amqp_password",
                         variable: "gold_digger_graylog_amqp_password"
                    )
                ]) {
                    script {
                        def server = params['APP_SERVER']
                        def database_host = params['DATABASE_HOST']
                        def database_port = params['DATABASE_PORT']
                        def command_name = getContainerName("${params.COMMAND}")
                        def command = "${params.COMMAND}"

                        sshagent(['5de2256c-107d-4e4a-a31e-2f33077619fe']) {
                            sh """ssh -oStrictHostKeyChecking=no -t -t jenkins@${server} <<EOF
                                docker login roihunter.azurecr.io -u roihunter -p "$DRpass"
                                docker pull roihunter.azurecr.io/golddigger/master
                                docker run --rm -d \
                                    -e "GOLD_DIGGER_PROFILE=master" \
                                    -e GOLD_DIGGER_DATABASE_HOST='''$database_host''' \
                                    -e GOLD_DIGGER_DATABASE_PORT='''$database_port''' \
                                    -e GOLD_DIGGER_DATABASE_USER='''$gold_digger_master_db_user''' \
                                    -e GOLD_DIGGER_DATABASE_PASSWORD='''$<PASSWORD>''' \
                                    -e GOLD_DIGGER_SECRETS_CURRENCY_LAYER_ACCESS_KEY='''$gold_digger_master_secrets_currency_layer_access_key''' \
                                    -e GOLD_DIGGER_SECRETS_FIXER_ACCESS_KEY='''$gold_digger_master_secrets_fixer_access_key''' \
                                    -e GOLD_DIGGER_GRAYLOG_AMQP_PASSWORD='''$<PASSWORD>''' \
                                    --hostname="golddigger-one-time-${command_name}-${env.BUILD_ID}" \
                                    --name="golddigger-one-time-${command_name}-${env.BUILD_ID}" \
                                    roihunter.azurecr.io/golddigger/master \
                                    ${command}

                                yes | docker image prune || exit 1
                                exit
                                EOF"""
                        }
                    }
                }
            }
        }
    }

    post {
        always {
            // Clean Workspace
            cleanWs()
        }
{'fraction_non_alphanumeric': 0.08574252532740302, 'fraction_numerical': 0.011613540894489745, 'mean_word_length': 1.117447031127387, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 25, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4110346', 'n_tokens_mistral': 2209, 'n_tokens_neox': 1992, 'n_words': 305}