From 861c78e76b09483d07a74ee3fd3b8783cc9b32e3 Mon Sep 17 00:00:00 2001 From: David Swan Date: Tue, 13 Apr 2021 14:48:27 +0100 Subject: [PATCH 1/2] (provision_service#296) - Port to Cloud CI --- .github/workflows/nightly.yml | 204 +++++++++++++++++++++++++++ .github/workflows/pr_test.yml | 184 ++++++++++++++++++++++++ .sync.yml | 5 +- spec/spec_helper_acceptance_local.rb | 50 +++++-- 4 files changed, 428 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/nightly.yml create mode 100644 .github/workflows/pr_test.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..865578cf --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,204 @@ +name: "nightly" + +on: + schedule: + - cron: '0 0 * * *' + +env: + HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 + HONEYCOMB_DATASET: litmus tests + +jobs: + setup_matrix: + name: "Setup Test Matrix" + runs-on: ubuntu-20.04 + outputs: + matrix: ${{ steps.get-matrix.outputs.matrix }} + + steps: + - name: "Honeycomb: Start recording" + uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 + with: + apikey: ${{ env.HONEYCOMB_WRITEKEY }} + dataset: ${{ env.HONEYCOMB_DATASET }} + job-status: ${{ job.status }} + + - name: "Honeycomb: Start first step" + run: | + echo STEP_ID=setup-environment >> $GITHUB_ENV + echo STEP_START=$(date +%s) >> $GITHUB_ENV + + - name: Checkout Source + uses: actions/checkout@v2 + if: ${{ github.repository_owner == 'puppetlabs' }} + + - name: Activate Ruby 2.7 + uses: ruby/setup-ruby@v1 + if: ${{ github.repository_owner == 'puppetlabs' }} + with: + ruby-version: "2.7" + bundler-cache: true + + - name: Print bundle environment + if: ${{ github.repository_owner == 'puppetlabs' }} + run: | + echo ::group::bundler environment + buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env + echo ::endgroup:: + + - name: "Honeycomb: Record Setup Environment time" + if: ${{ github.repository_owner == 'puppetlabs' }} + run: | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' + echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV + echo STEP_START=$(date +%s) >> $GITHUB_ENV + + - name: Setup Acceptance Test Matrix + id: get-matrix + if: ${{ github.repository_owner == 'puppetlabs' }} + run: | + if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then + buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2 + else + echo "::set-output name=matrix::{}" + fi + + - name: "Honeycomb: Record Setup Test Matrix time" + if: ${{ always() }} + run: | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix' + + Acceptance: + name: "${{matrix.platforms.label}}, ${{matrix.collection}}" + needs: + - setup_matrix + + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} + + env: + BUILDEVENT_FILE: '../buildevents.txt' + + steps: + - run: | + echo 'platform=${{ matrix.platforms.image }}' >> $BUILDEVENT_FILE + echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE + echo 'label=${{ matrix.platforms.label }}' >> $BUILDEVENT_FILE + + + - name: "Honeycomb: Start recording" + uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 + with: + apikey: ${{ env.HONEYCOMB_WRITEKEY }} + dataset: ${{ env.HONEYCOMB_DATASET }} + job-status: ${{ job.status }} + matrix-key: ${{ matrix.platforms.label }}-${{ matrix.collection }} + + - name: "Honeycomb: start first step" + run: | + echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-1 >> $GITHUB_ENV + echo STEP_START=$(date +%s) >> $GITHUB_ENV + + - name: Checkout Source + uses: actions/checkout@v2 + + - name: Activate Ruby 2.7 + uses: ruby/setup-ruby@v1 + with: + ruby-version: "2.7" + bundler-cache: true + + - name: Print bundle environment + run: | + echo ::group::bundler environment + buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env + echo ::endgroup:: + + - name: "Honeycomb: Record Setup Environment time" + if: ${{ always() }} + run: | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' + echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV + echo STEP_START=$(date +%s) >> $GITHUB_ENV + + - name: Provision test environment + run: | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]' + echo ::group::=== REQUEST === + cat request.json || true + echo + echo ::endgroup:: + echo ::group::=== INVENTORY === + if [ -f 'spec/fixtures/litmus_inventory.yaml' ]; + then + FILE='spec/fixtures/litmus_inventory.yaml' + elif [ -f 'inventory.yaml' ]; + then + FILE='inventory.yaml' + fi + sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true + echo ::endgroup:: + + - name: Install agent + run: | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' + + - name: Install module + run: | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module' + + - name: "Honeycomb: Record deployment times" + if: ${{ always() }} + run: | + echo ::group::honeycomb step + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system' + echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-3 >> $GITHUB_ENV + echo STEP_START=$(date +%s) >> $GITHUB_ENV + echo ::endgroup:: + + - name: Run acceptance tests + run: | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel' + + - name: "Honeycomb: Record acceptance testing times" + if: ${{ always() }} + run: | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests' + echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-4 >> $GITHUB_ENV + echo STEP_START=$(date +%s) >> $GITHUB_ENV + + - name: Remove test environment + if: ${{ always() }} + continue-on-error: true + run: | + if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down' + echo ::group::=== REQUEST === + cat request.json || true + echo + echo ::endgroup:: + fi + + - name: "Honeycomb: Record removal times" + if: ${{ always() }} + run: | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment' + + slack-workflow-status: + if: always() + name: Post Workflow Status To Slack + needs: + - Acceptance + runs-on: ubuntu-20.04 + steps: + - name: Slack Workflow Notification + uses: puppetlabs/Gamesight-slack-workflow-status@pdk-templates-v1 + with: + # Required Input + repo_token: ${{ secrets.GITHUB_TOKEN }} + slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }} + # Optional Input + channel: '#team-ia-bots' + name: 'GABot' diff --git a/.github/workflows/pr_test.yml b/.github/workflows/pr_test.yml new file mode 100644 index 00000000..69e414b5 --- /dev/null +++ b/.github/workflows/pr_test.yml @@ -0,0 +1,184 @@ +name: "PR Testing" + +on: [pull_request] + +env: + HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 + HONEYCOMB_DATASET: litmus tests + +jobs: + setup_matrix: + name: "Setup Test Matrix" + runs-on: ubuntu-20.04 + outputs: + matrix: ${{ steps.get-matrix.outputs.matrix }} + + steps: + - name: "Honeycomb: Start recording" + uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 + with: + apikey: ${{ env.HONEYCOMB_WRITEKEY }} + dataset: ${{ env.HONEYCOMB_DATASET }} + job-status: ${{ job.status }} + + - name: "Honeycomb: Start first step" + run: | + echo STEP_ID=setup-environment >> $GITHUB_ENV + echo STEP_START=$(date +%s) >> $GITHUB_ENV + + - name: Checkout Source + uses: actions/checkout@v2 + if: ${{ github.repository_owner == 'puppetlabs' }} + + - name: Activate Ruby 2.7 + uses: ruby/setup-ruby@v1 + if: ${{ github.repository_owner == 'puppetlabs' }} + with: + ruby-version: "2.7" + bundler-cache: true + + - name: Print bundle environment + if: ${{ github.repository_owner == 'puppetlabs' }} + run: | + echo ::group::bundler environment + buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env + echo ::endgroup:: + + - name: "Honeycomb: Record Setup Environment time" + if: ${{ github.repository_owner == 'puppetlabs' }} + run: | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' + echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV + echo STEP_START=$(date +%s) >> $GITHUB_ENV + + - name: Setup Acceptance Test Matrix + id: get-matrix + run: | + if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then + buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2 + else + echo "::set-output name=matrix::{}" + fi + + - name: "Honeycomb: Record Setup Test Matrix time" + if: ${{ always() }} + run: | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix' + + Acceptance: + name: "${{matrix.platforms.label}}, ${{matrix.collection}}" + needs: + - setup_matrix + if: ${{ needs.setup_matrix.outputs.matrix != '{}' }} + + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} + + env: + BUILDEVENT_FILE: '../buildevents.txt' + + steps: + - run: | + echo 'platform=${{ matrix.platforms.image }}' >> $BUILDEVENT_FILE + echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE + echo 'label=${{ matrix.platforms.label }}' >> $BUILDEVENT_FILE + + - name: "Honeycomb: Start recording" + uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 + with: + apikey: ${{ env.HONEYCOMB_WRITEKEY }} + dataset: ${{ env.HONEYCOMB_DATASET }} + job-status: ${{ job.status }} + matrix-key: ${{ matrix.platforms.label }}-${{ matrix.collection }} + + - name: "Honeycomb: start first step" + run: | + echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-1 >> $GITHUB_ENV + echo STEP_START=$(date +%s) >> $GITHUB_ENV + + - name: Checkout Source + uses: actions/checkout@v2 + + - name: Activate Ruby 2.7 + uses: ruby/setup-ruby@v1 + with: + ruby-version: "2.7" + bundler-cache: true + + - name: Print bundle environment + run: | + echo ::group::bundler environment + buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env + echo ::endgroup:: + + - name: "Honeycomb: Record Setup Environment time" + if: ${{ always() }} + run: | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' + echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV + echo STEP_START=$(date +%s) >> $GITHUB_ENV + + - name: Provision test environment + run: | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]' + echo ::group::=== REQUEST === + cat request.json || true + echo + echo ::endgroup:: + echo ::group::=== INVENTORY === + if [ -f 'spec/fixtures/litmus_inventory.yaml' ]; + then + FILE='spec/fixtures/litmus_inventory.yaml' + elif [ -f 'inventory.yaml' ]; + then + FILE='inventory.yaml' + fi + sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true + echo ::endgroup:: + + - name: Install agent + run: | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' + + - name: Install module + run: | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module' + + - name: "Honeycomb: Record deployment times" + if: ${{ always() }} + run: | + echo ::group::honeycomb step + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system' + echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-3 >> $GITHUB_ENV + echo STEP_START=$(date +%s) >> $GITHUB_ENV + echo ::endgroup:: + + - name: Run acceptance tests + run: | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel' + + - name: "Honeycomb: Record acceptance testing times" + if: ${{ always() }} + run: | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests' + echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-4 >> $GITHUB_ENV + echo STEP_START=$(date +%s) >> $GITHUB_ENV + + - name: Remove test environment + if: ${{ always() }} + continue-on-error: true + run: | + if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down' + echo ::group::=== REQUEST === + cat request.json || true + echo + echo ::endgroup:: + fi + + - name: "Honeycomb: Record removal times" + if: ${{ always() }} + run: | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment' diff --git a/.sync.yml b/.sync.yml index ec056c83..027ae762 100644 --- a/.sync.yml +++ b/.sync.yml @@ -5,7 +5,6 @@ include_todos: true appveyor.yml: delete: true - Gemfile: optional: ":development": @@ -18,6 +17,10 @@ spec/spec_helper.rb: - def regexp_matches(available_parameters) - " match(available_parameters)" - end +.github/workflows/nightly.yml: + unmanaged: false +.github/workflows/pr_test.yml: + unmanaged: false .gitpod.Dockerfile: unmanaged: false .gitpod.yml: diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index ab0aa62d..a175f1c4 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -20,18 +20,40 @@ class Helper SQL_ADMIN_PASS = 'Pupp3t1@' RSpec.configure do |c| + _module_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + c.formatter = :documentation + c.before(:suite) do Helper.instance.run_shell('puppet module install puppetlabs/mount_iso') Helper.instance.run_shell('puppet module install puppet/archive') - iso_opts = { - folder: WIN_ISO_ROOT, - file: WIN_2012R2_ISO, - drive_letter: 'I', - } - mount_iso(iso_opts) - - base_install(sql_version?) + if ENV['CLOUD_CI'] == 'true' + Helper.instance.run_shell("gsutil cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{WIN_2012R2_ISO} /tmp/") + Helper.instance.run_shell("gsutil cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2012_ISO} /tmp/") + Helper.instance.run_shell("gsutil cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2014_ISO} /tmp/") + Helper.instance.run_shell("gsutil cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2016_ISO} /tmp/") + Helper.instance.run_shell("gsutil cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2017_ISO} /tmp/") + Helper.instance.run_shell("gsutil cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2019_ISO} /tmp/") + + iso_opts = { + folder: '/tmp', + file: WIN_2012R2_ISO, + drive_letter: 'I', + } + mount_iso(iso_opts) + + base_install(sql_version?, '/tmp') + else + # For Internal testing + iso_opts = { + folder: WIN_ISO_ROOT, + file: WIN_2012R2_ISO, + drive_letter: 'I', + } + mount_iso(iso_opts) + + base_install(sql_version?, QA_RESOURCE_ROOT) + end end end @@ -79,35 +101,35 @@ def mount_iso(opts = {}) Helper.instance.apply_manifest(pp) end -def base_install(sql_version) +def base_install(sql_version, resource_root) case sql_version.to_i when 2012 iso_opts = { - folder: QA_RESOURCE_ROOT, + folder: resource_root, file: SQL_2012_ISO, drive_letter: 'H', } when 2014 iso_opts = { - folder: QA_RESOURCE_ROOT, + folder: resource_root, file: SQL_2014_ISO, drive_letter: 'H', } when 2016 iso_opts = { - folder: QA_RESOURCE_ROOT, + folder: resource_root, file: SQL_2016_ISO, drive_letter: 'H', } when 2017 iso_opts = { - folder: QA_RESOURCE_ROOT, + folder: resource_root, file: SQL_2017_ISO, drive_letter: 'H', } when 2019 iso_opts = { - folder: QA_RESOURCE_ROOT, + folder: resource_root, file: SQL_2019_ISO, drive_letter: 'H', } From cc4c218efb854d4dfd8bd01f0e3a6e4ac50c763f Mon Sep 17 00:00:00 2001 From: David Swan Date: Tue, 27 Apr 2021 11:32:57 +0100 Subject: [PATCH 2/2] =?UTF-8?q?(maint)=20-=20Various=20fixes=20in=20order?= =?UTF-8?q?=20to=20get=20the=20test=E2=80=99s=20running?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Code has been put in place so that when test’s are run on GCP relevant files are taking from the google cloud storage rather than artifactory - A temporary fix has been put in place to have all tests be run on sqlserver2016, pending the ability to set the sql version within the workflows - The PR workflow currently will only provision Windows 2016 machines --- .github/workflows/pr_test.yml | 5 +- provision.yaml | 14 ++++- spec/acceptance/sqlserver_config_spec.rb | 2 +- spec/acceptance/sqlserver_instance_spec.rb | 2 +- spec/acceptance/sqlserver_tsql_spec.rb | 2 +- .../z_last_sqlserver_features_spec.rb | 2 +- spec/spec_helper_acceptance_local.rb | 58 +++++++++++-------- 7 files changed, 51 insertions(+), 34 deletions(-) diff --git a/.github/workflows/pr_test.yml b/.github/workflows/pr_test.yml index 69e414b5..5c6ab5c6 100644 --- a/.github/workflows/pr_test.yml +++ b/.github/workflows/pr_test.yml @@ -5,7 +5,8 @@ on: [pull_request] env: HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 HONEYCOMB_DATASET: litmus tests - + SERVICE_URL: https://facade-openssh-windows-6f3kfepqcq-ew.a.run.app/v1/provision + jobs: setup_matrix: name: "Setup Test Matrix" @@ -55,7 +56,7 @@ jobs: id: get-matrix run: | if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then - buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2 + echo "::set-output name=matrix::{'platforms':[{'label':'win2016-sql2016','provider':'provision::provision_service','image':'windows-2016-core'}],'collection':['puppet7-nightly','puppet6-nightly']}" else echo "::set-output name=matrix::{}" fi diff --git a/provision.yaml b/provision.yaml index 86837757..77afe61e 100644 --- a/provision.yaml +++ b/provision.yaml @@ -5,7 +5,7 @@ release_checks_sql_2012: provisioner: abs images: ['win-2012r2-x86_64'] vars: 'sqlversion: sqlserver_2012' -release_checks_sql_2014_parity: +release_checks_sql_2014_nightly: provisioner: abs images: ['win-2012r2-x86_64'] vars: 'sqlversion: sqlserver_2014' @@ -13,18 +13,26 @@ release_checks_sql_2014: provisioner: abs images: ['win-2012r2-x86_64', 'win-2016-x86_64', 'win-2019-x86_64'] vars: 'sqlversion: sqlserver_2014' -release_checks_sql_2016_parity: +release_checks_sql_2016_nightly: provisioner: abs - images: ['win-2012r2-x86_64', 'win-2016-x86_64'] + images: ['win-2016-x86_64'] vars: 'sqlversion: sqlserver_2016' release_checks_sql_2016: provisioner: abs images: ['win-2012r2-x86_64', 'win-2016-x86_64', 'win-2019-x86_64'] vars: 'sqlversion: sqlserver_2016' +release_checks_sql_2017_nightly: + provisioner: abs + images: ['win-2016-x86_64'] + vars: 'sqlversion: sqlserver_2017' release_checks_sql_2017: provisioner: abs images: ['win-2012r2-x86_64', 'win-2016-x86_64', 'win-2019-x86_64'] vars: 'sqlversion: sqlserver_2017' +release_checks_sql_2019_nightly: + provisioner: abs + images: ['win-2019-x86_64'] + vars: 'sqlversion: sqlserver_2019' release_checks_sql_2019: provisioner: abs images: ['win-2012r2-x86_64', 'win-2016-x86_64', 'win-2019-x86_64'] diff --git a/spec/acceptance/sqlserver_config_spec.rb b/spec/acceptance/sqlserver_config_spec.rb index 9e9b848a..87b74e08 100644 --- a/spec/acceptance/sqlserver_config_spec.rb +++ b/spec/acceptance/sqlserver_config_spec.rb @@ -12,7 +12,7 @@ describe 'sqlserver::config test' do def ensure_sqlserver_instance(inst_name, ensure_val = 'present') pp = <<-MANIFEST - sqlserver_instance{'#{inst_name}': + sqlserver_instance{'#{inst_name}': ensure => '#{ensure_val}', source => 'H:', features => ['DQ', 'FullText', 'Replication', 'SQLEngine'], diff --git a/spec/acceptance/sqlserver_instance_spec.rb b/spec/acceptance/sqlserver_instance_spec.rb index ed59d2d2..d43b67b9 100644 --- a/spec/acceptance/sqlserver_instance_spec.rb +++ b/spec/acceptance/sqlserver_instance_spec.rb @@ -9,7 +9,7 @@ def new_random_instance_name end describe 'sqlserver_instance' do - version = sql_version? + version = '2016' # sql_version? def ensure_sqlserver_instance(features, inst_name, ensure_val = 'present', sysadmin_accounts = "['Administrator']") pp = <<-MANIFEST diff --git a/spec/acceptance/sqlserver_tsql_spec.rb b/spec/acceptance/sqlserver_tsql_spec.rb index 14967388..75b81c3e 100644 --- a/spec/acceptance/sqlserver_tsql_spec.rb +++ b/spec/acceptance/sqlserver_tsql_spec.rb @@ -4,7 +4,7 @@ require 'securerandom' require 'erb' -version = sql_version? +version = '2016' # sql_version? # database name db_name = ('DB' + SecureRandom.hex(4)).upcase diff --git a/spec/acceptance/z_last_sqlserver_features_spec.rb b/spec/acceptance/z_last_sqlserver_features_spec.rb index a7fa8cd9..35bcb86e 100644 --- a/spec/acceptance/z_last_sqlserver_features_spec.rb +++ b/spec/acceptance/z_last_sqlserver_features_spec.rb @@ -4,7 +4,7 @@ require 'erb' require 'json' -version = sql_version? +version = '2016' # sql_version? describe 'sqlserver_features', if: version.to_i != 2012 do def ensure_sql_features(features, ensure_val = 'present') diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index a175f1c4..66bc353f 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -27,22 +27,18 @@ class Helper Helper.instance.run_shell('puppet module install puppetlabs/mount_iso') Helper.instance.run_shell('puppet module install puppet/archive') - if ENV['CLOUD_CI'] == 'true' - Helper.instance.run_shell("gsutil cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{WIN_2012R2_ISO} /tmp/") - Helper.instance.run_shell("gsutil cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2012_ISO} /tmp/") - Helper.instance.run_shell("gsutil cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2014_ISO} /tmp/") - Helper.instance.run_shell("gsutil cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2016_ISO} /tmp/") - Helper.instance.run_shell("gsutil cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2017_ISO} /tmp/") - Helper.instance.run_shell("gsutil cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2019_ISO} /tmp/") - + if ENV['GITHUB_ACTIONS'] == 'true' + Helper.instance.run_shell("gsutil -q cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{WIN_2012R2_ISO} C:/Windows/Temp/#{WIN_2012R2_ISO}") iso_opts = { - folder: '/tmp', + folder: 'C:/Windows/Temp', file: WIN_2012R2_ISO, drive_letter: 'I', } mount_iso(iso_opts) - base_install(sql_version?, '/tmp') + # Temp fix to prove code works + base_install('2016', 'C:/Windows/Temp') + # base_install(sql_version?, 'C:/Windows/Temp') else # For Internal testing iso_opts = { @@ -83,51 +79,63 @@ def mount_iso(opts = {}) folder = opts[:folder] file = opts[:file] drive_letter = opts[:drive_letter] - - pp = <<-MANIFEST - $p_src = '#{folder}/#{file}' - $source = 'C:\\#{file}' - archive { $source: - ensure => present, - source => $p_src, - user => 0, - group => 0, - } - mount_iso{$source: - require => Archive[$source], - drive_letter => '#{drive_letter}', - } - MANIFEST + pp = if ENV['GITHUB_ACTIONS'] == 'true' + <<-MANIFEST + mount_iso{'#{folder}/#{file}': + drive_letter => '#{drive_letter}', + } + MANIFEST + else + <<-MANIFEST + $p_src = '#{folder}/#{file}' + $source = 'C:\\#{file}' + archive { $source: + ensure => present, + source => $p_src, + user => 0, + group => 0, + } + mount_iso{$source: + require => Archive[$source], + drive_letter => '#{drive_letter}', + } + MANIFEST + end Helper.instance.apply_manifest(pp) end def base_install(sql_version, resource_root) case sql_version.to_i when 2012 + Helper.instance.run_shell("gsutil -q cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2012_ISO} C:/Windows/Temp/#{SQL_2012_ISO}") if ENV['GITHUB_ACTIONS'] == 'true' iso_opts = { folder: resource_root, file: SQL_2012_ISO, drive_letter: 'H', } when 2014 + Helper.instance.run_shell("gsutil -q cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2014_ISO} C:/Windows/Temp/#{SQL_2014_ISO}") if ENV['GITHUB_ACTIONS'] == 'true' iso_opts = { folder: resource_root, file: SQL_2014_ISO, drive_letter: 'H', } when 2016 + Helper.instance.run_shell("gsutil -q cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2016_ISO} C:/Windows/Temp/#{SQL_2016_ISO}") if ENV['GITHUB_ACTIONS'] == 'true' iso_opts = { folder: resource_root, file: SQL_2016_ISO, drive_letter: 'H', } when 2017 + Helper.instance.run_shell("gsutil -q cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2017_ISO} C:/Windows/Temp/#{SQL_2017_ISO}") if ENV['GITHUB_ACTIONS'] == 'true' iso_opts = { folder: resource_root, file: SQL_2017_ISO, drive_letter: 'H', } when 2019 + Helper.instance.run_shell("gsutil -q cp -r gs://artifactory-modules/puppetlabs-sqlserver/#{SQL_2019_ISO} C:/Windows/Temp/#{SQL_2019_ISO}") if ENV['GITHUB_ACTIONS'] == 'true' iso_opts = { folder: resource_root, file: SQL_2019_ISO,