Skip to content

Commit

Permalink
chore: 🤖 Introduces Functions SGX support with SDK v3 (#22)
Browse files Browse the repository at this point in the history
## Why?

The following introduces support SGX as a flag for proxying the request
to the service(s) under Fleek Network.

⚠️ Depends on SDK v3 release

## How?

- [x] Add SGX flag to functions deploy
- [x] Replace the service number on fleek function link outputted
- [x] Check if function is not both private and SGX
- [x] Introduces changes to work under SDK v3

## Tickets?

-
[PLAT-1430](https://linear.app/fleekxyz/issue/PLAT-1430/cli-with-sdk-v3-features-revision)
-
[PLAT-1473](https://linear.app/fleekxyz/issue/PLAT-1473/%5Bubuntu%5D%5Bcli%5D-no-sites-found-is-shown-although-there-are-sites-in-the)

## Contribution checklist?

- [x] The commit messages are detailed
- [x] The `build` command runs locally
- [ ] Assets or static content are linked and stored in the project
- [ ] You have manually tested
- [ ] You have provided tests

## Security checklist?

- [ ] Sensitive data has been identified and is being protected properly
- [ ] Injection has been prevented (parameterized queries, no eval or
system calls)

## Preview?

```
Manual tests CLI:
	- Login ✅
	- Logout ✅
	- Projects
		- List ✅
		- Create ✅
		Obs: ProjectId cm14ucpfg0000vaaxcrhrwb9
	- Sites
		- Init ✅
		- List ✅
			- Shows recently created site
		- Deploy ✅
		- Deployments ✅
	- Domains
		- Site
			- Create ✅
			- Verify ✅
			- List ✅
			- Detail ✅
			- Delete ✅
		- Private Gateway
			- Create ✅
			- Verify ✅
			Obs: Do we really need this feature in Domains?
			The questions is due to the fact that it's an alias
			for the gateway created via gateways. Why complicate?
	- Gateways
		- Create ✅
		- Verify ✅
		- List ✅
        - Delete ✅
		- Detail ✅
		- Can access storage CID via GW? ✅
	- Applications
		- Create ✅
		- List ✅
		- Update ✅
		- Delete ✅
	- Pat
		- List ✅
		- Create ✅
		- Delete ✅
		Obs: Other feature "delete" is interactive, this one's not. This is not a big deal but should be consistent.
	- IPFS
		- Add ✅
	- Storage 
		- Add ✅
		- List ✅
		- Delete
			- CID ✅
			- Name ✅
	- Ens
		- Create ✅
		- Verify
		- Detail
		- List
		Obs: Require eth
	- Ipns
		- Create ✅
		- Resolve ✅
		- Delete ✅
		- Publish ✅
			Obs: "Please input a valid IPFS hash" should verify if input is valid hash
	- Functions
		- Create ✅
		- Deploy ✅
			Obs: the path should accept relative paths
		- List ✅
		- Deployments ✅
		- Update
			Obs: the update flow is unfriendly, e.g. the user has to specify --name/slug/status non interactively and then shows an interactive screen. The expectation is to do it interactively or non interactive
		- Delete ✅
		- Can call function using both gateways? ✅
		
```

---------

Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: daltoncoder <[email protected]>
Co-authored-by: Helder Oliveira <[email protected]>
Co-authored-by: RobertPechaCZ <[email protected]>
  • Loading branch information
5 people authored Sep 18, 2024
1 parent 51702c6 commit f358f9a
Show file tree
Hide file tree
Showing 89 changed files with 1,932 additions and 1,186 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-apes-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fleek-platform/cli": major
---

Introduces Functions SGX support with SDK v3
2 changes: 1 addition & 1 deletion .github/workflows/code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 7
version: 7.32.4
run_install: false

- name: Setup Nodejs
Expand Down
18 changes: 13 additions & 5 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"deploymentsListForSelectedSite": "Show deployments for the selected site",
"buildCmdFailedSeeErr": "The build command {cmd} has failed. Please refer to the errors above, as we are unable to proceed",
"uploadingFiles": "Files are being uploaded...",
"somethingWrongDurUpload": "An error occurred during the upload process",
"somethingWrongDurUpload": "An error occurred during the upload process. Please try again!",
"startingSiteDeployment": "Initiating site deployment...",
"creatingSite": "Creating the site",
"specifyDistDirToSiteUpl": "Please specify the directory containing the site files to be uploaded",
Expand Down Expand Up @@ -307,8 +307,8 @@
"functionsDeleteDescription": "Delete a function",
"deploymentsListForSelectedFunction": "Show deployments for the selected function",
"filePathValidWarning": "Please ensure the file path exists and points to a valid javascript file",
"commonFunctionActionFailure": "Failed to {action} function, {message} {tryAgain}. ",
"tryAgain": "please try again or contact support",
"commonFunctionActionFailure": "Failed to {action} the Fleek Function. {message} {tryAgain}!",
"tryAgain": "Please try again or contact support",
"functionsUpdateDescription": "Update a function",
"functionUpdateArgsNotValid": "One of --{param1}, --{param2} and --{param3} must be specified",
"selectFunctionStatus": "Select a function status from the options provided",
Expand All @@ -317,19 +317,24 @@
"typeFunctionCodePath": "Enter the path to the javascript file or folder containing the function code:",
"bundlingCode": "Bundling code",
"transformingCode": "Transforming code",
"encryptingCode": "Encrypting code",
"uploadCodeToIpfs": "Uploading code to IPFS",
"uploadToIpfsFailed": "Failed to upload to IPFS",
"uploadToIpfsFailed": "An issue occurred during the IPFS upload process.",
"storageUploadSuccessCid": "The Storage IPFS CID is {cid}",
"processing": "Processing",
"callFleekFunctionByUrlReq": "You can call this Fleek Function by making a request to the following URL",
"callFleekFunctionByNetworkUrlReq": "You can also call this Fleek Network URL directly for increased performance (please keep in mind you will not be able to deactivate this link)",
"availabilityCheckFailed": "Unable to fetch uploaded function through any of our private gateways, please try again later.",
"runningAvailabilityCheck": "Checking for availability of file through our gateways.",
"networkFetchMappings": "The network is fetching the blake3 hash mapping",
"networkFetchFailed": "Failed to fetch Mapping, please retry deploying your function.",
"unsupportedPackage": "The {packageName} package is not currently supported by Fleek Functions.",
"showUnsupportedModulesDocLink": "Please refer to our documentation to see which packages we support.",
"noBundle": "Disable bundling",
"bundleDisabledInDirectory": "Bundling is disabled but the path points to a directory. The {filename} file will be uploaded.",
"functionDeployToPrivateStorage": "[🧪 Alpha] Function code will be private",
"functionsUseSgx": "[🧪 Alpha] Function will use trusted execution environment for sensitive computations using SGX",
"pvtFunctionInSgxNotSupported": "[🧪 Alpha] Function cannot be private and use SGX",
"environmentVariables": "Set environment variables, do not include any sensitive information if your function is not private!",
"environmentVariablesFile": "Set environment variables from a file, do not include any sensitive information if your function is not private!",
"missingEnvVar": "Environment variable {key} is missing",
Expand All @@ -338,6 +343,9 @@
"unknownTransformError": "We had trouble transforming your function code. Try again? If the issue persists, let us know to help us improve!",
"failedToApplyNodeImportProtocol": "The process attempted to automatically apply the \"node:\" protocol for importing native modules but encountered an issue. When importing Node.js native modules, always use the \"node:\" prefix. For instance, use \"node:buffer\" instead of \"buffer\". This provides clarity when built-in Node.js modules must be imported.",
"requireDeprecatedUseES6Syntax": "The use of 'require' is deprecated in this context. Please switch to using ES6 'import' syntax for module imports. For example, change 'require' to 'import <ModuleName> from '<ModulePath>';'. This adjustment is necessary to comply with modern JavaScript standards and improve compatibility with Fleek Functions runtime and environment.",
"invalidWasmCode": "The {path} is a not valid wasm file",
"expectedNotFoundGeneric": "We had trouble locating the {name}. Please try again, and contact us if the issue persists.",
"unexpectedFileFormat": "We weren't expecting the format {format}. Please report the issue to our team and provide details for a quick fix."
"unexpectedFileFormat": "We weren't expecting the format {format}. Kindly submit a detailed report of the issue to our support team.",
"failedCalculateBlake3Hash": "Failed to calculate the Blake3 hash. Please try again!",
"failedDeployFleekFunction": "Failed to deploy the Fleek Function. Please try again!"
}
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fleek-platform/cli",
"version": "2.9.1",
"version": "2.10.0",
"bin": {
"fleek": "bin/index.js"
},
Expand Down Expand Up @@ -46,12 +46,15 @@
"commander": "^9.4.1",
"conf": "^10.2.0",
"dotenv": "^16.4.5",
"eciesjs": "^0.4.7",
"esbuild": "^0.21.4",
"files-from-path": "^1.0.0",
"glob": "^8.1.0",
"hash-wasm": "^4.11.0",
"lodash-es": "^4.17.21",
"multiformats": "^9.9.0",
"nanoid": "^3.3.4",
"native-fetch": "^4.0.2",
"ora": "^3.4.0",
"press-any-key": "^0.1.1",
"prompts": "^2.4.2",
Expand All @@ -63,14 +66,14 @@
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@changesets/cli": "^2.27.6",
"@fleek-platform/errors": "^2.2.3",
"@fleek-platform/sdk": "^2.1.5",
"@fleek-platform/errors": "^2.5.1",
"@fleek-platform/sdk": "^3.4.0",
"@fleek-platform/tester": "^2.3.0",
"@fleek-platform/utils-gateways": "^0.1.2",
"@fleek-platform/utils-github": "^0.0.2",
"@fleek-platform/utils-ipfs": "^0.4.2",
"@fleek-platform/utils-ipns": "^0.1.2",
"@fleek-platform/utils-validation": "^2.2.0",
"@fleek-platform/utils-validation": "^2.4.0",
"@tsconfig/node16": "^16.1.3",
"@types/ansi-escapes": "3.0.1",
"@types/cli-progress": "^3.11.5",
Expand Down
Loading

0 comments on commit f358f9a

Please sign in to comment.