From 2a7ed9d68bf416566b4dbb375d857d44de32eb90 Mon Sep 17 00:00:00 2001 From: PiTrem Date: Tue, 3 Dec 2024 00:00:18 +0100 Subject: [PATCH] f --- .github/workflows/ci.yml | 39 +------------------------------------- app/clients/sftp_client.rb | 3 ++- 2 files changed, 3 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 173ada8ff9..b85331a5ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,38 +8,6 @@ on: - main jobs: - linting: - if: github.event.pull_request && (github.triggering_actor != 'dependabot[bot]') - runs-on: ubuntu-latest - env: - PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }} - steps: - - name: checkout repository - uses: actions/checkout@v4 - - run: | - git fetch --no-tags --prune --unshallow origin +refs/heads/*:refs/remotes/origin/* - - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.3.0' - - - name: install linting dependencies - run: gem install rubocop pronto pronto-rubocop rubocop-rspec rubocop-rails rubocop-performance - - - name: run Pronto - run: pronto run -f github_status github_pr_review -c origin/${{ github.base_ref }} - env: - PRONTO_GITHUB_ACCESS_TOKEN: "${{ github.token }}" - if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name # don't run on PRs from forks because of missing write permission: https://github.com/orgs/community/discussions/26829 - - - name: run Pronto on fork - # We cannot use the `github_status` formatter on forks in order to report the linting status, - # since the formatter requires write access, which isn't the default on forks. - # This is why we're using the `--exit-code` flag, which causes Pronto to propagate non-zero exit codes, - # i.e., we can use the `--exit-code` flag to fail the linting job in case Pronto reports warning or errors (https://github.com/prontolabs/pronto). - run: pronto run --exit-code -f text -c origin/${{ github.base_ref }} - if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name - testing: needs: [linting] if: always() && (needs.linting.result == 'success' || needs.linting.result == 'skipped') # https://github.com/actions/runner/issues/491 @@ -108,23 +76,18 @@ jobs: - name: bundle install run: bundle install - - name: yarn install - run: yarn install --production=false - name: prepare postgres run: | RAILS_ENV=test bundle exec rake db:migrate RAILS_ENV=test bundle exec rake db:test:prepare - RAILS_ENV=test bundle exec rake db:seed - - name: npm test - run: npm test - name: rspec unit run: | service ssh restart eval `ssh-agent` - DATACOLLECTOR_FACTORY_SFTP_USER=testuser ATACOLLECTOR_FACTORY_SFTP_KEY=id_test RAILS_ENV=test bundle exec rspec --exclude-pattern spec/{features}/**/*_spec.rb spec/lib/datacollector + DATACOLLECTOR_FACTORY_SFTP_USER=testuser DATACOLLECTOR_FACTORY_SFTP_KEY=id_test RAILS_ENV=test bundle exec rspec --exclude-pattern spec/{features}/**/*_spec.rb spec/lib/datacollector - name: coverage rspec unit if: github.event.pull_request && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) && (github.triggering_actor != 'dependabot[bot]') # don't run on PRs from forks because of missing write permission: https://github.com/orgs/community/discussions/26829 diff --git a/app/clients/sftp_client.rb b/app/clients/sftp_client.rb index 5176083377..a01eda530a 100644 --- a/app/clients/sftp_client.rb +++ b/app/clients/sftp_client.rb @@ -159,6 +159,7 @@ def extract_host_and_user(host, user, **options) uri = URI.parse("ssh://#{host}") @host = uri.host @user = user || uri.user || options.delete(:user) + puts "Host: #{@host}, User: #{@user}" @root_path = options.delete(:root_path) || (uri.path != '/' && uri.path.presence) @session_options = { port: uri.port } end @@ -166,7 +167,7 @@ def extract_host_and_user(host, user, **options) # Set some default options def default_options(options) @session_options = @session_options.merge( - timeout: 5, verbose: :warn, keys_only: true, auth_methods: [], number_of_password_prompts: 0, + timeout: 5, verbose: :debug, keys_only: true, auth_methods: [], number_of_password_prompts: 0, ) @session_options[:auth_methods] = %w[publickey] if options[:keys].present? || options[:key_data].present? @session_options[:auth_methods] += %w[password] if options[:password].present?