Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Circle CI to Build pull requests from forked repositories #99

Open
momer opened this issue Aug 31, 2023 · 3 comments
Open

Enable Circle CI to Build pull requests from forked repositories #99

momer opened this issue Aug 31, 2023 · 3 comments

Comments

@momer
Copy link
Contributor

momer commented Aug 31, 2023

Related to #93, #98

Description

#93 introduced a regression in the CI suite, due to a configuration change that didn't make its way into the .circleci/config.yml file - later resolved via #98.

This could have been identified in the PR if the CI ran before merge!

Resolution

If possible, enable Circle CI to build forked repository branches (details @ https://circleci.com/docs/oss/#build-pull-requests-from-forked-repositories)

@momer
Copy link
Contributor Author

momer commented Aug 31, 2023

Given #96 , here are the full workarounds/patches used to get Circle CI running locally; the known_hosts changes can probably be reverted/removed.

  1. Install Circle CI CLI (instructions)
  2. For those of us who run into this Circle CI issue with the way cimg/postgres works with docker (> 20.10.x) - including me, on OpenSUSE Tumbleweed, the easiest (and only, for me), fix was to downgrade to 20.10.x.
  3. Current git URLs in Gemfile require login or Circle CI's expected GH integration; apply a little patch to bypass this
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 42a657e..8cd8626 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -30,6 +30,19 @@ jobs:
       PGSLICE_URL: "postgres://root@localhost:5432/rideshare_test"
     steps:
       - checkout
+      - run:
+          name: Add github.com ssh keys
+          command: |
+            mkdir -p ~/.ssh
+            touch ~/.ssh/known_hosts
+            if ! grep github.com ~/.ssh/known_hosts > /dev/null
+            then
+              echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" >> ~/.ssh/known_hosts
+              echo "github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=" >> ~/.ssh/known_hosts
+              echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=" >> ~/.ssh/known_hosts
+            fi
+            git config --global url."https://github.com".insteadOf git://github.com
+            bundle config github.https true
       - ruby/install-deps
       - run:
           name: Wait for DB
diff --git a/Gemfile b/Gemfile
index 1c18d99..e459369 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,6 @@
 source 'https://rubygems.org'
 
-gem 'rails', git: '[email protected]:rails/rails.git'
+gem 'rails', github: 'rails/rails'
 gem 'pg'
 gem 'puma'
 gem 'geocoder'
@@ -8,15 +8,15 @@ gem 'strong_migrations'
 gem 'fast_jsonapi'
 gem 'jwt' # Json Web Token
 gem 'bcrypt' # Use ActiveModel has_secure_password
-gem 'pghero', git: '[email protected]:andyatkinson/pghero.git'
+gem 'pghero', github: 'andyatkinson/pghero'
 gem 'fx' # manage DB Functions
 gem 'scenic' # manage DB Views
 gem 'whenever', require: false # manage scheduled jobs
 gem 'prosopite' # identify N+1 queries
 gem 'pg_query', '~> 4.2'
 gem 'pg_search'
-gem 'pgslice', git: '[email protected]:andyatkinson/pgslice.git'
-gem 'fast_count', git: 'https://github.com/fatkodima/fast_count.git'
+gem 'pgslice', github: 'andyatkinson/pgslice'
+gem 'fast_count', github: 'fatkodima/fast_count'
 gem 'activerecord-import'
 
 # assets gems default Rails 7 app
  1. Run bundle locally to update Gemfile.lock
  2. circleci local execute test

@andyatkinson
Copy link
Owner

Holy smokes @momer - this is really cool and I didn't know was possible to do. I'll take a look into that capability and get some feedback to you.

@andyatkinson
Copy link
Owner

Hi @momer I gave this a shot and had mixed results.

I've just merged in this PR: #112

  • It updates local and Circle CI to PostgreSQL 16

I updated Docker on Mac OS, and installed the circleci CLI with homebrew. I was getting "invalid UTS mode" running circleci local execute build. I tried the suggestions in that thread, generating the yml file. With that I was able to run the build job:

https://discuss.circleci.com/t/circleci-cli-error-response-from-daemon-invalid-uts-mode/48081/9

I was able to run circleci local execute -c process.yml build

Running the test job though still produces the same original error. Builds on Circle CI itself are working as expected.

I'd love to get the local execution working properly. If you are able to spend time on it and get it working, and want to reply here or with a PR, I'd welcome it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants