Skip to main content

Mark all projects as OSS: false

⚠Please note: It's extremely important to use extreme caution in a REPL on production since you could make a catastrophic change to the running application that would happen in real time with no way to recover. Please only use under advice from CircleCI Support Engineering.⚠

Overview

The following commands make all projects in CircleCI Server private.

This REPL script is the script version of the Open Source setting in CircleCI Cloud.

Prerequisites

  • Access to the CircleCI server environment.

  • Privileges to execute commands on the server.

Instructions

  • Connect to a Frontend Pod:

    • Use the following command to access a frontend pod:

kubectl exec -it $(kubectl get pods -l app=frontend -o jsonpath='{.items[0].metadata.name}' -n <namespace>) -n <namespace> -- bash
  • Login to REPL:

lein repl :connect 6005
  • Run the Script:

(doseq [org (circle.model.organization/all {:only [:analytics-id]})] (prn "Processing Org Analytics ID:" (:analytics-id org)) (loop [projects (circle.project/find-many-by-org-id (:analytics-id org) {:limit 100})] (when (seq projects) (prn "Fetched" (count projects) "projects.") (doseq [slug (map :circle.project/slug projects)] (prn "Processing slug:" slug) (circle.http.api.admin-commands/set-project-feature-by-url slug :oss false)) (recur (circle.project/find-many-by-org-id (:analytics-id org) {:limit 100 :after (->> projects last :circle.project/id)})))))

Solution

The provided script iterates through all organizations and projects, marking them as private on CircleCI.

Additional Resources

Did this answer your question?