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

Canonical CLA integration #14296

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FLASK_DEBUG=true
DEVEL=true
SECRET_KEY=insecure_dev_key
CONTRACTS_API_URL=https://contracts.staging.canonical.com/
CANONICAL_CLA_API_URL=https://cla.staging.canonical.com/
SECURITY_API_URL=https://ubuntu.com/security/
STRIPE_PUBLISHABLE_KEY=pk_test_yndN9H0GcJffPe0W58Nm64cM00riYG4N46
STORE_MAINTENANCE=false
Expand Down
15 changes: 7 additions & 8 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ let entries = {
tabbedContent: "./static/js/src/tabbed-content.js",
credentialsDashboard:
"./static/js/src/advantage/credentials/dashboard/app.tsx",
"canonical-cla": "./static/js/src/canonical-cla/app.tsx",
};

const isDev = process && process.env && process.env.NODE_ENV === "development";
Expand All @@ -47,22 +48,20 @@ const captchaKey =

for (const [key, value] of Object.entries(entries)) {
const options = {
plugins: [
sassPlugin(),
],
plugins: [sassPlugin()],
entryPoints: [value],
bundle: true,
minify: !isDev,
nodePaths: [path.resolve(__dirname, "./static/js/src")],
sourcemap: !isDev,
outfile: "static/js/dist/" + key + ".js",
loader: {
'.js': 'jsx',
'.ts': 'ts',
'.tsx': 'tsx',
'.jsx': 'jsx',
".js": "jsx",
".ts": "ts",
".tsx": "tsx",
".jsx": "jsx",
},
jsx: 'automatic',
jsx: "automatic",
target: ["chrome90", "firefox88", "safari14", "edge90"],
define: {
"process.env.NODE_ENV":
Expand Down
6 changes: 6 additions & 0 deletions konf/site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,9 @@ staging:
key: charmhub-api-username
name: discourse-api

- name: CANONICAL_CLA_API_URL
value: https://cla.canonical.com

routes:
- paths: [/blog]
name: ubuntu-com-blog
Expand Down Expand Up @@ -1155,3 +1158,6 @@ demo:
secretKeyRef:
key: charmhub-api-username
name: discourse-api

- name: CANONICAL_CLA_API_URL
value: https://cla.staging.canonical.com
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
"typescript": "5.5.4",
"url-polyfill": "1.1.12",
"url-search-params-polyfill": "8.2.5",
"use-query-params": "^2.2.1",
"vanilla-framework": "4.16.0",
"yup": "1.4.0"
},
Expand Down Expand Up @@ -157,4 +158,4 @@
"node"
]
}
}
}
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ bleach==6.0.0
numpy==1.24.4
python-slugify==8.0.1
djlint==1.34.1
pycountry==24.6.1
11 changes: 11 additions & 0 deletions static/js/src/canonical-cla/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Canonical CLA

This is the client side for the Canonical CLA service. It is a React application that uses fetch as a client to communicate with the REST API of the Canonical CLA service.

The main purpose of this application is to allow individual contributors and organizations to sign the Canonical Contribution License Agreement (CLA) to be able to contribute to Canonical's projects on Launchpad and/or GitHub.


### Resources
- Canonical CLA service: https://github.com/canonical/cla-canonical
- API docs: https://cla.canonical.com/docs

51 changes: 51 additions & 0 deletions static/js/src/canonical-cla/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { createRoot } from "react-dom/client";
import { SignFormProvider, useSignForm } from "./contexts/SignForm";
import { QueryParamProvider } from "use-query-params";
import { ReactRouter6Adapter } from "use-query-params/adapters/react-router-6";
import { BrowserRouter } from "react-router-dom";

import SuccessPage from "./pages/SuccessPage";
import SignPage from "./pages/SignPage";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";

declare global {
interface Window {
CANONICAL_CLA_API_URL: string;
COUNTRIES_LIST: {
alpha2: string;
name: string;
}[];
}
}
const CLAForm = () => {
const { step } = useSignForm();
return (
<div className="row p-strip">
<div className="col-8">
<h1>Contributor agreement form</h1>
{step === "sign" ? (
<SignPage />
) : step === "success" ? (
<SuccessPage />
) : null}
</div>
</div>
);
};

const App = () => {
const queryClient = new QueryClient();
return (
<BrowserRouter>
<QueryParamProvider adapter={ReactRouter6Adapter}>
<QueryClientProvider client={queryClient}>
<SignFormProvider>
<CLAForm />
</SignFormProvider>
</QueryClientProvider>
</QueryParamProvider>
</BrowserRouter>
);
};

createRoot(document.getElementById("react-root")!).render(<App />);
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
const IndividualCla = () => (
<fieldset>
<legend className="p-heading--3">
Canonical Individual Contributor Licence Agreement
</legend>
<p>
Thank you for your interest in contributing to software projects managed
by Canonical (“We” or “Us”).
</p>
<p>
This contributor agreement (“Agreement”) documents the rights granted by
contributors to Us. To make this document effective, please sign it and
send it to Us by email or electronic submission, following the
instructions at{" "}
<a href="https://www.canonical.com/contributors">
www.canonical.com/contributors
</a>
. This is a legally binding document, so please read it carefully before
agreeing to it. The Agreement may cover more than one software project
managed by Us.
</p>

<h3>1. Definitions</h3>
<p>“You” means the individual who Submits a Contribution to Us.</p>
<p>
“Contribution” means any work of authorship that is Submitted by You to Us
in which You own or assert ownership of the Copyright. If You do not own
the Copyright in the entire work of authorship, please follow the
instructions in www.canonical.com/contributors.
</p>
<p>
“Copyright” means all rights protecting works of authorship owned or
controlled by You, including copyright, moral and neighboring rights, as
appropriate, for the full term of their existence including any extensions
by You.
</p>
<p>
“Material” means the work of authorship which is made available by Us to
third parties. When this Agreement covers more than one software project,
the Material means the work of authorship to which the Contribution was
Submitted. After You Submit the Contribution, it may be included in the
Material.
</p>
<p>
“Submit” means any form of electronic, verbal, or written communication
sent to Us or our representatives, including but not limited to electronic
mailing lists, source code control systems, and issue tracking systems
that are managed by, or on behalf of, Us for the purpose of discussing and
improving the Material, but excluding communication that is conspicuously
marked or otherwise designated in writing by You as “Not a Contribution.”
</p>
<p>
“Submission Date” means the date on which You Submit a Contribution to Us.
</p>
<p>
“Effective Date” means the date You execute this Agreement or the date You
first Submit a Contribution to Us, whichever is earlier.
</p>
<p>“Media” means any portion of a Contribution which is not software.</p>

<h3>2. Grant of Rights</h3>
<h4>2.1 Copyright Licence</h4>
<p>
(a) You retain ownership of the Copyright in Your Contribution and have
the same rights to use or license the Contribution which You would have
had without entering into the Agreement.
</p>
<p>
(b) To the maximum extent permitted by the relevant law, You grant to Us a
perpetual, worldwide, non-exclusive, transferable, royalty-free,
irrevocable licence under the Copyright covering the Contribution, with
the right to sublicense such rights through multiple tiers of
sublicensees, to reproduce, modify, display, perform and distribute the
Contribution as part of the Material; provided that this license is
conditioned upon compliance with Section 2.3.
</p>
<h4>2.2 Patent Licence</h4>
<p>
For patent claims including, without limitation, method, process, and
apparatus claims which You own, control or have the right to grant, now or
in the future, You grant to Us a perpetual, worldwide, non-exclusive,
transferable, royalty-free, irrevocable patent licence, with the right to
sublicense these rights to multiple tiers of sublicensees, to make, have
made, use, sell, offer for sale, import and otherwise transfer the
Contribution and the Contribution in combination with the Material (and
portions of such combination). This licence is granted only to the extent
that the exercise of the licensed rights infringes such patent claims; and
provided that this licence is conditioned upon compliance with Section
2.3.
</p>
<h4>2.3 Outbound Licence</h4>
<p>
Based on the grant of rights in Sections 2.1 and 2.2, if We include Your
Contribution in a Material, We may license the Contribution under any
licence, including copyleft, permissive, commercial, or proprietary
licences. As a condition on the exercise of this right, We agree to also
license the Contribution under the terms of the licence or licences which
We are using for the Material on the Submission Date.
</p>
<h4>2.4 Moral Rights.</h4>
<p>
If moral rights apply to the Contribution, to the maximum extent permitted
by law, You waive and agree not to assert such moral rights against Us or
our successors in interest, or any of our licensees, either direct or
indirect.
</p>
<h4>2.5 Our Rights.</h4>
<p>
You acknowledge that We are not obligated to use Your Contribution as part
of the Material and may decide to include any Contribution We consider
appropriate.
</p>
<h4>2.6 Reservation of Rights.</h4>
<p>
Any rights not expressly licensed under this section are expressly
reserved by You.
</p>
<h3>3. Agreement</h3>
<p>You confirm that:</p>
<p>(a) You have the legal authority to enter into this Agreement.</p>
<p>
(b) You own the Copyright and patent claims covering the Contribution
which are required to grant the rights under Section 2.
</p>
<p>
(c) The grant of rights under Section 2 does not violate any grant of
rights which You have made to third parties, including Your employer. If
You are an employee, You have had Your employer approve this Agreement or
sign the Entity version of this document. If You are less than eighteen
years old, please have Your parents or guardian sign the Agreement.
</p>
<p>
(d) You have followed the instructions in{" "}
<a href="https://www.canonical.com/contributors">
www.canonical.com/contributors
</a>
, if You do not own the Copyright in the entire work of authorship
Submitted.
</p>
<h3>4. Disclaimer</h3>
<p>
EXCEPT FOR THE EXPRESS WARRANTIES IN SECTION 3, THE CONTRIBUTION IS
PROVIDED &quot;AS IS&quot;. MORE PARTICULARLY, ALL EXPRESS OR IMPLIED
WARRANTIES INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTY OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
EXPRESSLY DISCLAIMED BY YOU TO US. TO THE EXTENT THAT ANY SUCH WARRANTIES
CANNOT BE DISCLAIMED, SUCH WARRANTY IS LIMITED IN DURATION TO THE MINIMUM
PERIOD PERMITTED BY LAW.
</p>
<h3>5. Consequential Damage Waiver</h3>
<p>
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL YOU BE
LIABLE FOR ANY LOSS OF PROFITS, LOSS OF ANTICIPATED SAVINGS, LOSS OF DATA,
INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL AND EXEMPLARY DAMAGES ARISING
OUT OF THIS AGREEMENT REGARDLESS OF THE LEGAL OR EQUITABLE THEORY
(CONTRACT, TORT OR OTHERWISE) UPON WHICH THE CLAIM IS BASED.
</p>
<h3>6. Miscellaneous</h3>
<p>
6.1 This Agreement will be governed by and construed in accordance with
the laws of England excluding its conflicts of law provisions. Under
certain circumstances, the governing law in this section might be
superseded by the United Nations Convention on Contracts for the
International Sale of Goods (“UN Convention”) and the parties intend to
avoid the application of the UN Convention to this Agreement and, thus,
exclude the application of the UN Convention in its entirety to this
Agreement.
</p>
<p>
6.2 This Agreement sets out the entire agreement between You and Us for
Your Contributions to Us and overrides all other agreements or
understandings.
</p>
<p>
6.3 If You or We assign the rights or obligations received through this
Agreement to a third party, as a condition of the assignment, that third
party must agree in writing to abide by all the rights and obligations in
the Agreement.
</p>
<p>
6.4 The failure of either party to require performance by the other party
of any provision of this Agreement in one situation shall not affect the
right of a party to require such performance at any time in the future. A
waiver of performance under a provision in one situation shall not be
considered a waiver of the performance of the provision in the future or a
waiver of the provision in its entirety.
</p>
<p>
6.5 If any provision of this Agreement is found void and unenforceable,
such provision will be replaced to the extent possible with a provision
that comes closest to the meaning of the original provision and which is
enforceable. The terms and conditions set forth in this Agreement shall
apply notwithstanding any failure of essential purpose of this Agreement
or any limited remedy to the maximum extent possible under law.
</p>
<p>
To{" "}
<a href="https://assets.ubuntu.com/v1/ff2478d1-Canonical-HA-CLA-ANY-I_v1.2.pdf">
download as a PDF
</a>
</p>
</fieldset>
);

export default IndividualCla;
Loading
Loading