Merge branch 'main' into cloudrun-support
This commit is contained in:
commit
104928f062
42
.github/workflows/ci.yml
vendored
42
.github/workflows/ci.yml
vendored
@ -76,9 +76,6 @@ jobs:
|
||||
with:
|
||||
go-version: 1.16
|
||||
|
||||
- name: Setup Kind Kubernetes Cluster
|
||||
uses: helm/kind-action@v1.2.0
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
# SOPS
|
||||
@ -92,20 +89,33 @@ jobs:
|
||||
mkdir -p ~/.config/dagger
|
||||
echo "$DAGGER_AGE_KEY" > ~/.config/dagger/keys.txt
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Integration test
|
||||
run: |
|
||||
make integration
|
||||
make core-integration
|
||||
|
||||
- name: Publish Test Report
|
||||
uses: mikepenz/action-junit-report@v2
|
||||
if: always()
|
||||
universe:
|
||||
name: Universe
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
report_paths: "tests/*.xml"
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
check_name: "Report"
|
||||
go-version: 1.16
|
||||
|
||||
- name: Setup Kind Kubernetes Cluster
|
||||
uses: helm/kind-action@v1.2.0
|
||||
|
||||
- name: Import Dagger private key
|
||||
env:
|
||||
DAGGER_AGE_KEY: ${{ secrets.DAGGER_AGE_KEY }}
|
||||
run: |
|
||||
mkdir -p ~/.config/dagger
|
||||
echo "$DAGGER_AGE_KEY" > ~/.config/dagger/keys.txt
|
||||
|
||||
- name: Universe Test
|
||||
run: |
|
||||
make universe-test
|
||||
|
9
Makefile
9
Makefile
@ -41,16 +41,15 @@ check-buildkit-version:
|
||||
|| { echo buildkit version mismatch go.mod != util/buildkitd/buildkitd.go ; exit 1; }
|
||||
|
||||
.PHONY: integration
|
||||
integration: dagger-debug universe-test
|
||||
$(shell command -v sops > /dev/null || { echo "You need sops. On macOS: brew install sops"; exit 1; })
|
||||
$(shell command -v parallel > /dev/null || { echo "You need gnu parallel. On macOS: brew install parallel"; exit 1; })
|
||||
integration: core-integration universe-test
|
||||
|
||||
.PHONY: core-integration
|
||||
core-integration: dagger-debug
|
||||
yarn --cwd "./tests" install
|
||||
DAGGER_BINARY="../cmd/dagger/dagger-debug" yarn --cwd "./tests" test
|
||||
|
||||
.PHONY: universe-test
|
||||
universe-test: dagger-debug
|
||||
$(shell command -v sops > /dev/null || { echo "You need sops. On macOS: brew install sops"; exit 1; })
|
||||
$(shell command -v parallel > /dev/null || { echo "You need gnu parallel. On macOS: brew install parallel"; exit 1; })
|
||||
yarn --cwd "./universe" install
|
||||
DAGGER_BINARY="../cmd/dagger/dagger-debug" yarn --cwd "./universe" test
|
||||
|
||||
|
@ -12,7 +12,7 @@ Using Dagger, software builders can automate the deployment of any application t
|
||||
|
||||
## Useful links
|
||||
|
||||
- [Join the Dagger community on Discord](https://discord.gg/Rmffpmc)
|
||||
- [Join the Dagger community on Discord](https://discord.gg/ufnyBtc8uY)
|
||||
- [Install from a binary release](https://docs.dagger.io/install)
|
||||
- [Build from source](https://docs.dagger.io/install#option-4-install-from-source)
|
||||
- [How to contribute](CONTRIBUTING.md)
|
||||
|
@ -35,6 +35,17 @@ You can then install it globally on your system:
|
||||
sudo mv ./bin/dagger /usr/local/bin
|
||||
```
|
||||
|
||||
## Option 2 (Windows): Run a shell script
|
||||
|
||||
From a terminal, run the following command:
|
||||
|
||||
```shell
|
||||
curl https://releases.dagger.io/dagger/install.ps1 -OutFile install.ps1 ; ./install.ps1; rm install.ps1
|
||||
```
|
||||
|
||||
We try to move the dagger binary under `C:\Windows\System32` but
|
||||
in case use missing the necessary permission we'll save everything under `<your home folder>/dagger`
|
||||
|
||||
## Option 3: Download a binary release
|
||||
|
||||
Open your web browser to [the latest release](https://github.com/dagger/dagger/releases/latest).
|
||||
|
@ -113,7 +113,7 @@ The inputs are persisted inside the `.dagger` directory and pushed to your git r
|
||||
|
||||
### The outputs
|
||||
|
||||
The plan defines one or several `outputs`. They can show helpful information at the end of the deployment. That's how we read the deploy `url` at the end of the deployment. Here is the command to list all inputs:
|
||||
The plan defines one or several `outputs`. They can show helpful information at the end of the deployment. That's how we read the deploy `url` at the end of the deployment. Here is the command to list all outputs:
|
||||
|
||||
```shell
|
||||
dagger output list
|
||||
|
@ -70,18 +70,21 @@ _No output._
|
||||
|
||||
## docker.#Push
|
||||
|
||||
Push a docker image
|
||||
Push a docker image to a remote registry
|
||||
|
||||
### docker.#Push Inputs
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------- |:-------------: |:-------------: |
|
||||
|*ref* | `string` |Remote ref (example: "index.docker.io/alpine:latest") |
|
||||
|*source* | `dagger.#Artifact` |Image |
|
||||
| Name | Type | Description |
|
||||
| ------------- |:-------------: |:-------------: |
|
||||
|*target* | `string` |Remote target (example: "index.docker.io/alpine:latest") |
|
||||
|*source* | `dagger.#Artifact` |Image source |
|
||||
|
||||
### docker.#Push Outputs
|
||||
|
||||
_No output._
|
||||
| Name | Type | Description |
|
||||
| ------------- |:-------------: |:-------------: |
|
||||
|*ref* | `string` |Image ref |
|
||||
|*digest* | `string` |Image digest |
|
||||
|
||||
## docker.#Run
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -21,7 +21,7 @@ require (
|
||||
github.com/opencontainers/go-digest v1.0.0
|
||||
github.com/opentracing/opentracing-go v1.2.0
|
||||
github.com/rs/zerolog v1.23.0
|
||||
github.com/spf13/cobra v1.1.3
|
||||
github.com/spf13/cobra v1.2.1
|
||||
github.com/spf13/viper v1.8.1
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/tonistiigi/fsutil v0.0.0-20201103201449-0834f99b7b85
|
||||
|
4
go.sum
4
go.sum
@ -984,8 +984,8 @@ github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKv
|
||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
||||
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
|
||||
github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M=
|
||||
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
|
||||
github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw=
|
||||
github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
|
||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||
|
77
install.ps1
Normal file
77
install.ps1
Normal file
@ -0,0 +1,77 @@
|
||||
# param (
|
||||
# [Parameter(Mandatory)] $PersonalToken
|
||||
# )
|
||||
Clear-Host
|
||||
@"
|
||||
|
||||
---------------------------------------------------------------------------------
|
||||
Author: Alessandro Festa
|
||||
Dagger Installation Utility for Windows users
|
||||
---------------------------------------------------------------------------------
|
||||
|
||||
"@
|
||||
|
||||
# Since we are already authenticated we may directly download latest version.
|
||||
$name="dagger"
|
||||
$base="https://dagger-io.s3.amazonaws.com"
|
||||
function http_download {
|
||||
$version=Get_Version
|
||||
$version=$version -replace '[""]'
|
||||
$version=$version -replace '\n'
|
||||
$fileName="dagger_v" + $version + "_windows_amd64"
|
||||
Clear-Host
|
||||
$url = $base + "/" + $name + "/releases/" + $version + "/" + $fileName + ".zip"
|
||||
write-host $url
|
||||
Pause
|
||||
|
||||
|
||||
Invoke-WebRequest -Uri $url -OutFile $env:temp/$fileName.zip -ErrorAction Stop
|
||||
Expand-Archive -Path $env:temp/$fileName.zip -DestinationPath $env:HOMEPATH/dagger -Force -ErrorVariable ProcessError;
|
||||
If ($ProcessError)
|
||||
{
|
||||
Clear-Host
|
||||
@"
|
||||
Whoops apparently we had an issue in unzipping the file, please check
|
||||
you have the right permission to do so and try to unzip manually the file.
|
||||
Currently we saved Dagger at your temp folder.
|
||||
"@
|
||||
exit
|
||||
} else {
|
||||
Clear-Host
|
||||
|
||||
@"
|
||||
|
||||
Thank You for downloading Dagger!
|
||||
|
||||
-----------------------------------------------------
|
||||
Dagger has been saved at <YOUR HOME FOLDER>/dagger/
|
||||
Please add dagger.exe to your PATH in order to use it
|
||||
----------------------------------------------------
|
||||
|
||||
"@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function Get_Version {
|
||||
$response = Invoke-RestMethod 'http://releases.dagger.io/dagger/latest_version' -Method 'GET' -Body $body -ErrorAction SilentlyContinue -ErrorVariable DownloadError
|
||||
If ($DownloadError)
|
||||
{
|
||||
Clear-Host
|
||||
@"
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
Houston we have a problem!
|
||||
|
||||
Apparently we had an issue in downloading the file, please try again
|
||||
run the script and if it still fail please open an issue on the Dagger repo.
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
"@
|
||||
exit
|
||||
}
|
||||
return $response
|
||||
|
||||
}
|
||||
|
||||
http_download
|
@ -2,10 +2,10 @@ package solver
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/docker/distribution/reference"
|
||||
bkauth "github.com/moby/buildkit/session/auth"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
@ -40,9 +40,9 @@ func (a *RegistryAuthProvider) Register(server *grpc.Server) {
|
||||
}
|
||||
|
||||
func (a *RegistryAuthProvider) Credentials(ctx context.Context, req *bkauth.CredentialsRequest) (*bkauth.CredentialsResponse, error) {
|
||||
reqURL, err := parseAuthHost(req.Host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
host := req.Host
|
||||
if host == "registry-1.docker.io" {
|
||||
host = "docker.io"
|
||||
}
|
||||
|
||||
a.m.RLock()
|
||||
@ -54,7 +54,7 @@ func (a *RegistryAuthProvider) Credentials(ctx context.Context, req *bkauth.Cred
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if u.Host == reqURL.Host {
|
||||
if u == host {
|
||||
return auth, nil
|
||||
}
|
||||
}
|
||||
@ -62,15 +62,16 @@ func (a *RegistryAuthProvider) Credentials(ctx context.Context, req *bkauth.Cred
|
||||
return &bkauth.CredentialsResponse{}, nil
|
||||
}
|
||||
|
||||
func parseAuthHost(host string) (*url.URL, error) {
|
||||
if host == "registry-1.docker.io" {
|
||||
host = "https://index.docker.io/v1/"
|
||||
}
|
||||
func parseAuthHost(host string) (string, error) {
|
||||
host = strings.TrimPrefix(host, "http://")
|
||||
host = strings.TrimPrefix(host, "https://")
|
||||
|
||||
if !strings.HasPrefix(host, "http://") && !strings.HasPrefix(host, "https://") {
|
||||
host = "https://" + host
|
||||
ref, err := reference.ParseNormalizedNamed(host)
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return url.Parse(host)
|
||||
return reference.Domain(ref), nil
|
||||
}
|
||||
|
||||
func (a *RegistryAuthProvider) FetchToken(ctx context.Context, req *bkauth.FetchTokenRequest) (rr *bkauth.FetchTokenResponse, err error) {
|
||||
|
2
stdlib/.dagger/env/docker-pull/.gitignore
vendored
Normal file
2
stdlib/.dagger/env/docker-pull/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# dagger state
|
||||
state/**
|
27
stdlib/.dagger/env/docker-pull/values.yaml
vendored
Normal file
27
stdlib/.dagger/env/docker-pull/values.yaml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
plan:
|
||||
module: ./docker
|
||||
package: ./tests/pull
|
||||
name: docker-pull
|
||||
inputs:
|
||||
ref:
|
||||
text: docker.io/daggerio/ci-test:xtyzsocvpici@sha256:35fc94d52b4fa53c2caa38ff11e13182e6f88c651eb0846728d1007d931f0d3c
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA0WFI2ZGFUOWgvNkdlZ3Na
|
||||
dEE5dTlVQi8vUVJqcHUxWE9GSmdnNmZLMHhRCm1sbFlJbEw1ZVFSVXU4MCtkT09l
|
||||
dVR1WE5XUkVpSXA3aXN5TzZLaWJRNnMKLS0tIDZINGpzODdXVUdKVVpFMjFUbUFO
|
||||
SG1raUVNTzZIWDltV1pOS3hySHlJeWcKg3blmstOGcxtPww513+mAEA0MWOXwNAT
|
||||
5ngRvG6MraW3g9dhIuUYOwjuJyz1Z07/DBEocSxnjSyw45ZCkM1/9Q==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2021-06-26T14:52:40Z"
|
||||
mac: ENC[AES256_GCM,data:IVEK6NFWEmNv8kRay2wVNhrsXVazVinIYRDLy7DTvaiWXyQYun//joK3QIoKz3dqi9rXeuTd95B13RxVQWKy/8cpmryg4QCwAaCj8erb5FHMRfn5/mAAV3NL5oAoOpKF4lZByrfdrXTJKppGWwYOFy8X693kK3FUzoUpIW2OqXg=,iv:qinwsUefQ7M+0OCTISPdQ9q//xsPitmHeCpdF00BJoo=,tag:reHZ5j0nz9fjAEFpR7IGGQ==,type:str]
|
||||
pgp: []
|
||||
encrypted_suffix: secret
|
||||
version: 3.7.1
|
2
stdlib/.dagger/env/docker-push-invalid-creds/.gitignore
vendored
Normal file
2
stdlib/.dagger/env/docker-push-invalid-creds/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# dagger state
|
||||
state/**
|
29
stdlib/.dagger/env/docker-push-invalid-creds/values.yaml
vendored
Normal file
29
stdlib/.dagger/env/docker-push-invalid-creds/values.yaml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
plan:
|
||||
module: ./docker
|
||||
package: ./tests/push-invalid-creds
|
||||
name: docker-push-invalid-creds
|
||||
inputs:
|
||||
TestRegistry.secret:
|
||||
text: ENC[AES256_GCM,data:PckymCtA/Q==,iv:to7XhUUcZrWDga7uT4C067BRzHEzmTPDUNAEb2TpS/I=,tag:jUTk8uGd185hmIvi/IHpww==,type:str]
|
||||
TestRegistry.username:
|
||||
text: invalid
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA4czBwNGtSdGZqdEZ5WDlM
|
||||
SHVYOU5zdFl4L2ptZk5rSHgwek1aaDNicENFCkJ4OUIweU5OZTVKalpTSkhYaGxB
|
||||
RUpHZmVvU3g3Y2tBZnRUcHh0TE52M1EKLS0tIHI1VUt1aUR0a0tDNHJVTHY4eEt1
|
||||
VC8wSTZvUE5UaDg2WE1CaGMzR3M1TEkK9v83AVI4lvFgjKCg8UmQrcxarlESWTfV
|
||||
2cDdWgoH7ZqgXo5jFv2tn8qQWHKl8eTTeYUWn8GoNVPKrCroax2fiQ==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2021-06-26T15:00:53Z"
|
||||
mac: ENC[AES256_GCM,data:ptE3WydZDuethnN5Qh26uAfndRbT+RKz2mktH4s2KyRNeDKgiBfwOVS1xoTxz+nkFoms0Cxac3iaVwZLpZXniQUbOAYY1fzfmyL32bfAUdNFs7P6K0thwSy8r8LJ38GvxHzZW289YVFTGSaJWCapbrcGzl6B7Aj5RcQ+Hhu32K8=,iv:PA2R7Q8y8F//RGnHpOCmxp8jWKXlAZ3Yfo0xbtPfx2E=,tag:EmxBTb9WVrDdOmgDHEDYfg==,type:str]
|
||||
pgp: []
|
||||
encrypted_suffix: secret
|
||||
version: 3.7.1
|
2
stdlib/.dagger/env/docker-push-multi-registry/.gitignore
vendored
Normal file
2
stdlib/.dagger/env/docker-push-multi-registry/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# dagger state
|
||||
state/**
|
35
stdlib/.dagger/env/docker-push-multi-registry/values.yaml
vendored
Normal file
35
stdlib/.dagger/env/docker-push-multi-registry/values.yaml
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
plan:
|
||||
module: ./docker
|
||||
package: ./tests/push-multi-registry
|
||||
name: docker-push-multi-registry
|
||||
inputs:
|
||||
TestRemoteAWS.awsConfig.accessKey:
|
||||
secret: ENC[AES256_GCM,data:Vg+RRHYV5p0twlKtq0zGzokTsXY=,iv:XXEjaZBmS7A+KBZQ/0ZJ4WLH3M5dthg0lq86BhHOt2U=,tag:q6QSQkH9Jz/e4FGlBNllug==,type:str]
|
||||
TestRemoteAWS.awsConfig.region:
|
||||
text: us-east-2
|
||||
TestRemoteAWS.awsConfig.secretKey:
|
||||
secret: ENC[AES256_GCM,data:uk5BBJhmc8RadT1FSIsnW+/Rvs8c+kIhshBia+DX+UEWiuPV+RwXfw==,iv:DzXcvUcy3amU7wCA6XFgPvGUAU+dxPZQMHKM94d9PlY=,tag:QDDs4kg6cFPLLGRM6sHzfg==,type:str]
|
||||
TestRemoteDocker.dockerConfig.secret:
|
||||
secret: ENC[AES256_GCM,data:bxlKdGBSd2Rxf0Kmw8+QO1h0308rGYPqzUO17Eg4RUh2WQjd,iv:vNZww3t8yBrcmmddJghtJWfkz3G9j2CPGyx9B3e/WK8=,tag:qlUl2dkREcGZxdKeAzPjzQ==,type:str]
|
||||
TestRemoteDocker.dockerConfig.username:
|
||||
text: daggertest
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBnc1JZMUpTUnFZNVI3RHh3
|
||||
a0RtTDNIQ2xjaHJlM0tNbndta1NlMjc2a2dFCkQzV0FpMFBHZUdZb0RMYW1DUGN2
|
||||
TlZVQ2dhdWt3OEN5LzZEYXR4QkFSTTAKLS0tIFdaS0Z0dG85QXNNTnpXZ0dFUGpY
|
||||
Yy81dlJ5cDhCL1VCc0szSE9Dbjh0TUEK+xcj1bHhJr0MR+2QLL0Y+at0/SFXcutx
|
||||
VpUkCykV3eBV6P9I51+3NeJ/ZMmJ43N2geFFJNeacmn8uQKNxpgGGw==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2021-07-01T13:15:01Z"
|
||||
mac: ENC[AES256_GCM,data:vpU0XJA/H/ra4BIuReWJAOLvFW4s+xHDAxxSYoU1WkdX68EUb1jbuhEqyDqlhQRn6lf3qSt9kbnbiiw39/mrdBFnwDg5DLjOPT17G/rBiSp9p+1e4mN8hGNp79uen+dDQX7f4NSxZ4nroMVtEuIuBrbFaZUMYVaBYEHjGuw2hgc=,iv:/nW7lpopSsqTwoaPgiHrabtl8aOZtJEezkwBDqi15Tg=,tag:uw3Hj+/t3Y5U0wpK7g+tJg==,type:str]
|
||||
pgp: []
|
||||
encrypted_suffix: secret
|
||||
version: 3.7.1
|
2
stdlib/.dagger/env/docker-push/.gitignore
vendored
Normal file
2
stdlib/.dagger/env/docker-push/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# dagger state
|
||||
state/**
|
29
stdlib/.dagger/env/docker-push/values.yaml
vendored
Normal file
29
stdlib/.dagger/env/docker-push/values.yaml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
plan:
|
||||
module: ./docker
|
||||
package: ./tests/push
|
||||
name: docker-push
|
||||
inputs:
|
||||
TestRegistry.secret:
|
||||
secret: ENC[AES256_GCM,data:ooc+0IjYtX9tkM7q1i4Ws6CorZsWtGQzHbjGx+j892iTZC7Q,iv:asdJzuRAHBRhD/FlkEd1VvX1tIz/qupBL7sMQWxZL5E=,tag:yuTyDx7hZeC+cmHx6tspmQ==,type:str]
|
||||
TestRegistry.username:
|
||||
text: daggertest
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBrcnpRZ203QzhtKzc3bzF4
|
||||
Y002V0JUUnNZMks2VS83SjBOdVZid1dxbTJjCmc5VGtvM3lOejEvQ3VMZ1ZyZElZ
|
||||
Skd3ZWxRMHdQRHdtZFBYUFMweDFlL28KLS0tIHhHeUh4a2gvb2w3UTEyNFZaK0dS
|
||||
UjFJYTc1UUUzSFVkZjQ2blRsSGpVdVEKOanMR3+WlAgoDfqTUW7WPW1ytT3NdkTX
|
||||
4Rqo49QmnuKFJ9tKoBFQOqgIo8E/lpcOkeIUiy5e/35FvsZ/KFk/pg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2021-06-26T14:53:13Z"
|
||||
mac: ENC[AES256_GCM,data:kxzdmyQwRIVP9D+w9LzRDIZOxDUqpSaGeD/GqaVxnQivEUjVFK5ePAcYV1fzjU4eeO3chIrP8NpvpIKZ1LztQddsPdTj72Yffgc5yq8/dGa3njiM8p9oa5hnZNoxLtyVPgRoNy3ZUZ6YSN9nqCFWW0DCjeSoiDlPX+1Vj/S6PeM=,iv:DhX4N6idS3VBaqau6k9yH+li34hOd3jqBsJJQu/P3Jw=,tag:X+taa7XgRmovR0JkhGpi7g==,type:str]
|
||||
pgp: []
|
||||
encrypted_suffix: secret
|
||||
version: 3.7.1
|
@ -59,7 +59,7 @@ package op
|
||||
|
||||
#DockerLogin: {
|
||||
do: "docker-login"
|
||||
target: string | *"https://index.docker.io/v1/"
|
||||
target: string
|
||||
username: string
|
||||
// FIXME: should be a #Secret (circular import)
|
||||
secret: string | bytes
|
||||
|
@ -28,18 +28,64 @@ import (
|
||||
]
|
||||
}
|
||||
|
||||
// Push a docker image
|
||||
// Push a docker image to a remote registry
|
||||
#Push: {
|
||||
// Remote ref (example: "index.docker.io/alpine:latest")
|
||||
ref: string @dagger(input)
|
||||
// Remote target (example: "index.docker.io/alpine:latest")
|
||||
target: string @dagger(input)
|
||||
|
||||
// Image
|
||||
// Image source
|
||||
source: dagger.#Artifact @dagger(input)
|
||||
|
||||
#up: [
|
||||
op.#Load & {from: source},
|
||||
op.#PushContainer & {"ref": ref},
|
||||
// Registry auth
|
||||
auth?: {
|
||||
// Username
|
||||
username: string @dagger(input)
|
||||
|
||||
// Password or secret
|
||||
secret: string @dagger(input)
|
||||
}
|
||||
|
||||
push: #up: [
|
||||
op.#Load & {from: source},
|
||||
|
||||
if auth != _|_ {
|
||||
op.#DockerLogin & {
|
||||
"target": target
|
||||
username: auth.username
|
||||
secret: auth.secret
|
||||
}
|
||||
},
|
||||
|
||||
op.#PushContainer & {ref: target},
|
||||
|
||||
op.#Subdir & {dir: "/dagger"},
|
||||
]
|
||||
|
||||
// Image ref
|
||||
ref: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
op.#Load & {from: push},
|
||||
|
||||
op.#Export & {
|
||||
source: "/image_ref"
|
||||
},
|
||||
]
|
||||
} @dagger(output)
|
||||
|
||||
// Image digest
|
||||
digest: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
op.#Load & {from: push},
|
||||
|
||||
op.#Export & {
|
||||
source: "/image_digest"
|
||||
},
|
||||
]
|
||||
} @dagger(output)
|
||||
}
|
||||
|
||||
#Run: {
|
||||
|
25
stdlib/docker/tests/pull/pull.cue
Normal file
25
stdlib/docker/tests/pull/pull.cue
Normal file
@ -0,0 +1,25 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger/op"
|
||||
"alpha.dagger.io/alpine"
|
||||
)
|
||||
|
||||
ref: string @dagger(input)
|
||||
|
||||
TestPull: {
|
||||
pull: #Pull & {from: ref}
|
||||
|
||||
check: #up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
op.#Exec & {
|
||||
always: true
|
||||
args: [
|
||||
"sh", "-c", """
|
||||
grep -q "test" /src/test.txt
|
||||
""",
|
||||
]
|
||||
mount: "/src": from: pull
|
||||
},
|
||||
]
|
||||
}
|
35
stdlib/docker/tests/push-invalid-creds/push.cue
Normal file
35
stdlib/docker/tests/push-invalid-creds/push.cue
Normal file
@ -0,0 +1,35 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/random"
|
||||
)
|
||||
|
||||
TestRegistry: {
|
||||
username: string @dagger(input)
|
||||
secret: string @dagger(input)
|
||||
}
|
||||
|
||||
TestPush: {
|
||||
// Generate a random string
|
||||
// Seed is used to force buildkit execution and not simply use a previous generated string.
|
||||
tag: random.#String & {seed: "docker push and pull should fail"}
|
||||
|
||||
target: "daggerio/ci-test:\(tag.out)"
|
||||
|
||||
image: #ImageFromDockerfile & {
|
||||
dockerfile: """
|
||||
FROM alpine
|
||||
RUN echo "test" > /test.txt
|
||||
"""
|
||||
context: ""
|
||||
}
|
||||
|
||||
push: #Push & {
|
||||
"target": target
|
||||
source: image
|
||||
auth: {
|
||||
username: TestRegistry.username
|
||||
secret: TestRegistry.secret
|
||||
}
|
||||
}
|
||||
}
|
93
stdlib/docker/tests/push-multi-registry/push.cue
Normal file
93
stdlib/docker/tests/push-multi-registry/push.cue
Normal file
@ -0,0 +1,93 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/aws"
|
||||
"alpha.dagger.io/aws/ecr"
|
||||
"alpha.dagger.io/dagger"
|
||||
"alpha.dagger.io/dagger/op"
|
||||
"alpha.dagger.io/random"
|
||||
"alpha.dagger.io/alpine"
|
||||
)
|
||||
|
||||
//
|
||||
// /!\ README /!\
|
||||
// The objective is to push an image on multiple registries to verify
|
||||
// that we correctly handle that kind of configuration
|
||||
//
|
||||
|
||||
TestResources: {
|
||||
// Generate a random string
|
||||
// Seed is used to force buildkit execution and not simply use a previous generated string.
|
||||
suffix: random.#String & {seed: "docker multi registry"}
|
||||
|
||||
image: #ImageFromDockerfile & {
|
||||
dockerfile: """
|
||||
FROM alpine
|
||||
RUN echo "test" > /test.txt
|
||||
"""
|
||||
context: ""
|
||||
}
|
||||
}
|
||||
|
||||
TestRemoteAWS: {
|
||||
awsConfig: aws.#Config
|
||||
|
||||
ecrCreds: ecr.#Credentials & {
|
||||
config: awsConfig
|
||||
}
|
||||
|
||||
target: "125635003186.dkr.ecr.\(awsConfig.region).amazonaws.com/dagger-ci:test-ecr-\(TestResources.suffix.out)"
|
||||
|
||||
remoteImg: #Push & {
|
||||
"target": target
|
||||
source: TestResources.image
|
||||
auth: {
|
||||
username: ecrCreds.username
|
||||
secret: ecrCreds.secret
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#TestGetSecret: {
|
||||
secret: dagger.#Artifact
|
||||
|
||||
out: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
|
||||
op.#Exec & {
|
||||
always: true
|
||||
args: ["sh", "-c", "cp /input/secret /secret"]
|
||||
mount: "/input/secret": "secret": secret
|
||||
},
|
||||
|
||||
op.#Export & {
|
||||
source: "/secret"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
TestRemoteDocker: {
|
||||
dockerConfig: {
|
||||
username: string & dagger.#Input
|
||||
secret: dagger.#Secret & dagger.#Input
|
||||
}
|
||||
|
||||
secret: #TestGetSecret & {
|
||||
secret: dockerConfig.secret
|
||||
}
|
||||
|
||||
target: "daggerio/ci-test:test-docker-\(TestResources.suffix.out)"
|
||||
|
||||
remoteImg: #Push & {
|
||||
"target": target
|
||||
source: TestResources.image
|
||||
auth: {
|
||||
username: dockerConfig.username
|
||||
"secret": secret.out
|
||||
}
|
||||
}
|
||||
}
|
64
stdlib/docker/tests/push/push.cue
Normal file
64
stdlib/docker/tests/push/push.cue
Normal file
@ -0,0 +1,64 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger/op"
|
||||
"alpha.dagger.io/dagger"
|
||||
"alpha.dagger.io/alpine"
|
||||
"alpha.dagger.io/random"
|
||||
)
|
||||
|
||||
TestRegistry: {
|
||||
username: string @dagger(input)
|
||||
secret: dagger.#Secret @dagger(input)
|
||||
}
|
||||
|
||||
#TestGetSecret: {
|
||||
secret: dagger.#Artifact
|
||||
|
||||
out: {
|
||||
string
|
||||
|
||||
#up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
|
||||
op.#Exec & {
|
||||
always: true
|
||||
args: ["sh", "-c", "cp /input/secret /secret"]
|
||||
mount: "/input/secret": "secret": secret
|
||||
},
|
||||
|
||||
op.#Export & {
|
||||
source: "/secret"
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
TestPush: {
|
||||
// Generate a random string
|
||||
// Seed is used to force buildkit execution and not simply use a previous generated string.
|
||||
tag: random.#String & {seed: "docker push"}
|
||||
|
||||
target: "daggerio/ci-test:\(tag.out)"
|
||||
|
||||
secret: #TestGetSecret & {
|
||||
secret: TestRegistry.secret
|
||||
}
|
||||
|
||||
image: #ImageFromDockerfile & {
|
||||
dockerfile: """
|
||||
FROM alpine
|
||||
RUN echo "test" > /test.txt
|
||||
"""
|
||||
context: ""
|
||||
}
|
||||
|
||||
push: #Push & {
|
||||
"target": target
|
||||
source: image
|
||||
auth: {
|
||||
username: TestRegistry.username
|
||||
"secret": secret.out
|
||||
}
|
||||
}
|
||||
}
|
@ -62,6 +62,29 @@ setup() {
|
||||
dagger -e docker-build up
|
||||
}
|
||||
|
||||
@test "docker push and pull" {
|
||||
skip "An occasional data race condition happen in the CI. Must be fix before execute that test"
|
||||
# Push image
|
||||
dagger -e docker-push up
|
||||
|
||||
# Get image reference
|
||||
dagger -e docker-pull input text ref "$(dagger -e docker-push query -c TestPush.push.ref | tr -d '\n' | tr -d '\"')"
|
||||
|
||||
# Pull image
|
||||
dagger -e docker-pull up
|
||||
}
|
||||
|
||||
@test "docker push: multi registry" {
|
||||
skip "An occasional data race condition happen in the CI. Must be fix before execute that test"
|
||||
run dagger -e docker-push-multi-registry up
|
||||
}
|
||||
|
||||
@test "docker push: invalid credential" {
|
||||
# Push image (SHOULD FAIL)
|
||||
run dagger -e docker-push-invalid-creds up
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "docker command: ssh" {
|
||||
dagger -e docker-command-ssh up
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ TestPushContainer: {
|
||||
ref: "daggerio/ci-test:\(tag.out)"
|
||||
#up: [
|
||||
op.#DockerLogin & {
|
||||
target: ref
|
||||
registry
|
||||
},
|
||||
op.#WriteFile & {
|
||||
|
@ -1,16 +0,0 @@
|
||||
setup() {
|
||||
load 'helpers'
|
||||
|
||||
common_setup
|
||||
}
|
||||
|
||||
# FIXME: move to universe/universe.bats
|
||||
# Assigned to: <ADD YOUR NAME HERE>
|
||||
# Changes in https://github.com/dagger/dagger/pull/628
|
||||
@test "stdlib: docker: push-and-pull" {
|
||||
skip_unless_secrets_available "$TESTDIR"/stdlib/docker/push-pull/inputs.yaml
|
||||
|
||||
# check that they succeed with the credentials
|
||||
run "$DAGGER" compute --input-yaml "$TESTDIR"/stdlib/docker/push-pull/inputs.yaml --input-dir source="$TESTDIR"/stdlib/docker/push-pull/testdata "$TESTDIR"/stdlib/docker/push-pull/
|
||||
assert_success
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
registry:
|
||||
username: ENC[AES256_GCM,data:YDDLkr32orAgQw==,iv:ezThCQJv+bVBf8SdfSa2HFoP+eu6IZMPl5xvMOGDcps=,tag:sEV9Sonc9rjDbxXsV+UBIA==,type:str]
|
||||
secret: ENC[AES256_GCM,data:moBq7PwFdtL/Z58ez+V1gR8QJsFRZEMsF82H/W6aJgf8Xdw8,iv:YAXcRzBoemmef5PBdAOBa5acNPo4BoKH7Ngud/CWYfA=,tag:LFkJvUZdltgHJ8TKVEeS/Q==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age1gxwmtwahzwdmrskhf90ppwlnze30lgpm056kuesrxzeuyclrwvpsupwtpk
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBGVmQxTXNSeU1scWJvVDFJ
|
||||
cExOL3AvR1JRRWp0cFFRWGtvQ1VKc2t1SUVFClVCS1hpN1dNTktoaWZ3R09OMFVM
|
||||
STRyWmtHRVROMW1Oa28yQkMwOHd1UUUKLS0tIE5LL1pEb1dMSEVXTHBsNlJxOTcr
|
||||
U2FyQUtYcXVVVTlVcW5zRXh5aUk3RUUKGiWb9jSl5xRHQxB56LtNclV5Jhs50sS7
|
||||
SAOBWgaYPjLpsI1oxgXf+B1FgBUEt3EMccrWRW85VvnOKOAUAJ53pQ==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2021-05-28T20:49:27Z"
|
||||
mac: ENC[AES256_GCM,data:we6IaVqfT6KZ4s97JbdFCbxL2zotojLRLEbmgwEAfBhz4KAitulRItMn4I6aD1dEIwYGAFtQEcf+Wqz2yT7JC6iz1s2zNtGIaMbxxQZD6EQcJvNmY3vzqC4SKf0cRENGZWI5OscH9VVenTmOAxwwWvp9W4J52d2w9FAD9+vCl/c=,iv:vf8mZwr+z7DjCVHaRbk8jQO9/pso5INy/FmCPq/xlzo=,tag:sgSvlksSOVq5LU0ycAsXxw==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.7.1
|
@ -1,65 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"alpha.dagger.io/dagger"
|
||||
"alpha.dagger.io/dagger/op"
|
||||
"alpha.dagger.io/alpine"
|
||||
"alpha.dagger.io/docker"
|
||||
"alpha.dagger.io/random"
|
||||
)
|
||||
|
||||
source: dagger.#Artifact
|
||||
|
||||
registry: {
|
||||
username: string
|
||||
secret: string
|
||||
}
|
||||
|
||||
TestPushAndPull: {
|
||||
tag: random.#String & {
|
||||
seed: ""
|
||||
}
|
||||
|
||||
ref: "daggerio/ci-test:\(tag.out)"
|
||||
|
||||
// Create image
|
||||
image: docker.#ImageFromDockerfile & {
|
||||
dockerfile: """
|
||||
FROM alpine
|
||||
COPY test.txt /test.txt
|
||||
"""
|
||||
context: source
|
||||
}
|
||||
|
||||
// Login
|
||||
login: #up: [
|
||||
op.#DockerLogin & {
|
||||
registry
|
||||
},
|
||||
]
|
||||
|
||||
// Push image
|
||||
push: docker.#Push & {
|
||||
"ref": ref
|
||||
source: image
|
||||
}
|
||||
|
||||
// Push image
|
||||
pull: docker.#Pull & {
|
||||
from: push.ref
|
||||
}
|
||||
|
||||
// Check the content
|
||||
verify: #up: [
|
||||
op.#Load & {from: alpine.#Image},
|
||||
op.#Exec & {
|
||||
always: true
|
||||
args: [
|
||||
"sh", "-c", """
|
||||
grep -q "test" /src/test.txt
|
||||
""",
|
||||
]
|
||||
mount: "/src": from: pull
|
||||
},
|
||||
]
|
||||
}
|
@ -1 +0,0 @@
|
||||
test
|
@ -16,8 +16,8 @@
|
||||
"write-heading-ids": "docusaurus write-heading-ids"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.0.0-beta.0",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.0",
|
||||
"@docusaurus/core": "2.0.0-beta.2",
|
||||
"@docusaurus/preset-classic": "2.0.0-beta.2",
|
||||
"@mdx-js/react": "^1.6.21",
|
||||
"@svgr/webpack": "^5.5.0",
|
||||
"amplitude-js": "^8.3.1",
|
||||
|
36
website/src/components/DocPageCustom.js
Normal file
36
website/src/components/DocPageCustom.js
Normal file
@ -0,0 +1,36 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import qs from 'querystringify';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import { checkUserCollaboratorStatus } from '../api/github'
|
||||
import Spinner from './Spinner';
|
||||
import DocPageAuthentication from './DocPageAuthentication';
|
||||
import DocPageRedirect from './DocPageRedirect';
|
||||
|
||||
function DocPageCustom({ location, userAccessStatus, setUserAccessStatus }) {
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [redirectState, setRedirectState] = useState()
|
||||
const authQuery = qs.parse(location.search);
|
||||
|
||||
useEffect(async () => {
|
||||
if (!isEmpty(authQuery) && userAccessStatus === null) { //callback after successful auth with github
|
||||
const user = await checkUserCollaboratorStatus(authQuery.code);
|
||||
setUserAccessStatus(user)
|
||||
if (user?.permission) {
|
||||
window.localStorage.setItem('user', JSON.stringify(user));
|
||||
}
|
||||
}
|
||||
setIsLoading(false)
|
||||
}, [])
|
||||
|
||||
if (isLoading) return <Spinner />
|
||||
|
||||
if (userAccessStatus?.permission === false) {
|
||||
return <DocPageRedirect />
|
||||
}
|
||||
|
||||
if (userAccessStatus === null) {
|
||||
return <DocPageAuthentication />
|
||||
}
|
||||
}
|
||||
|
||||
export default DocPageCustom
|
@ -10,7 +10,6 @@
|
||||
/* You can override the default Infima variables here. */
|
||||
:root {
|
||||
--ifm-background-color: var(--ifm-color-primary-light);
|
||||
|
||||
--ifm-code-background: var(--ifm-color-primary-dark);
|
||||
--ifm-code-font-size: 100%;
|
||||
--ifm-code-border-radius: 2rem;
|
||||
@ -19,7 +18,7 @@
|
||||
--ifm-code-padding-horizontal: 0.2rem;
|
||||
--ifm-color-primary: #0e2b3d;
|
||||
--ifm-color-primary-dark: #131226;
|
||||
--ifm-color-primary-darker: rgb(31, 165, 136);
|
||||
--ifm-color-primary-darker: #0d0c1b;
|
||||
--ifm-color-primary-darkest: rgb(26, 136, 112);
|
||||
--ifm-color-primary-light: #fffef6;
|
||||
--ifm-color-primary-lighter: rgb(102, 212, 189);
|
||||
@ -39,7 +38,7 @@
|
||||
--ifm-menu-color: var(--ifm-color-primary-dark);
|
||||
--ifm-menu-color-active: var(--ifm-color-primary-dark);
|
||||
--ifm-menu-color-background-hover: #fdf9d7;
|
||||
--ifm-menu-color-background-active: #fdf9d7;
|
||||
--ifm-menu-color-background-active: var(--ifm-menu-color-background-hover);
|
||||
--ifm-menu-link-sublist-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path d="M3.318 9.128a24.776 24.776 0 004.224-3.993.842.842 0 011.32.026c1.227 1.618 2.107 3.387 3.831 4.556.889.6-.159 1.9-1.044 1.3A14.369 14.369 0 018.14 7a30.457 30.457 0 01-3.829 3.463c-.845.671-1.834-.67-.993-1.335z" fill="%23131226" /></svg>');
|
||||
--ifm-navbar-height: 6rem;
|
||||
--ifm-navbar-background-color: var(--ifm-color-primary-light);
|
||||
@ -52,7 +51,7 @@
|
||||
|
||||
html[data-theme="dark"] {
|
||||
--ifm-background-color: var(--ifm-color-primary-dark);
|
||||
--ifm-navbar-background-color: transparent;
|
||||
--ifm-navbar-background-color: var(--ifm-color-primary-darker);
|
||||
--ifm-menu-color-active: var(--ifm-color-primary-light);
|
||||
--ifm-menu-color-background-active: var(--ifm-color-primary);
|
||||
--ifm-link-color: var(--ifm-color-primary-light);
|
||||
@ -63,13 +62,14 @@ html[data-theme="dark"] {
|
||||
--ifm-table-stripe-background: #2e526a;
|
||||
--ifm-code-background: var(--ifm-color-primary-dark);
|
||||
--ifm-heading-color: var(--ifm-color-primary-light);
|
||||
--ifm-blockquote-color: var(--ifm-menu-color-background-hover);
|
||||
--ifm-color-emphasis-300: var(--ifm-menu-color-background-hover);
|
||||
}
|
||||
|
||||
/* global */
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
h2 {
|
||||
font-family: "Poppins", sans-serif;
|
||||
}
|
||||
|
||||
@ -80,12 +80,13 @@ h2 {
|
||||
|
||||
code {
|
||||
margin: 0 1px;
|
||||
color: var(--ifm-code-color);
|
||||
}
|
||||
|
||||
.markdown {
|
||||
& > h2 {
|
||||
--ifm-h2-font-size: 1.5rem;
|
||||
--ifm-h2-vertical-rhythm-top: 3;
|
||||
--ifm-h2-vertical-rhythm-top: 4;
|
||||
}
|
||||
|
||||
& > h3 {
|
||||
@ -93,6 +94,10 @@ code {
|
||||
--ifm-h3-vertical-rhythm-top: 3;
|
||||
}
|
||||
|
||||
& > h2 + h3 {
|
||||
--ifm-h3-vertical-rhythm-top: 2;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
@ -124,14 +129,26 @@ p {
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
a[class*="menuLinkExternal"]:after {
|
||||
background: url("/img/Dagger_Icons_External-link.svg") no-repeat;
|
||||
position: absolute;
|
||||
right: var(--ifm-menu-link-padding-horizontal);
|
||||
top: var(--ifm-menu-link-padding-vertical);
|
||||
a[target="_blank"]:not(.edit-this-page) {
|
||||
svg {
|
||||
display: none;
|
||||
}
|
||||
&:after {
|
||||
background: var(--ifm-color-primary-darker);
|
||||
mask: url("/img/Dagger_Icons_External-link.svg") no-repeat;
|
||||
position: absolute;
|
||||
content:'';
|
||||
right: var(--ifm-menu-link-padding-horizontal);
|
||||
top: var(--ifm-menu-link-padding-vertical);
|
||||
height: 1.25rem;
|
||||
width: 1.25rem;
|
||||
}
|
||||
html[data-theme="dark"] &:after {
|
||||
background: var(--ifm-color-primary-light);
|
||||
}
|
||||
}
|
||||
|
||||
h1[class^="docTitle"] {
|
||||
h1[class^="h1Heading"] {
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
@ -139,6 +156,11 @@ h1[class^="docTitle"] {
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 2rem 0 5rem;
|
||||
|
||||
html[data-theme="dark"] & svg path {
|
||||
fill: var(--ifm-color-primary-light);
|
||||
}
|
||||
}
|
||||
|
||||
#__docusaurus {
|
||||
@ -146,7 +168,7 @@ h1[class^="docTitle"] {
|
||||
padding-bottom: 3rem;
|
||||
|
||||
html[data-theme="dark"] & {
|
||||
background: #0d0c1b;
|
||||
background: var(--ifm-color-primary-darker);
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,7 +192,7 @@ h1[class^="docTitle"] {
|
||||
|
||||
// sidebar
|
||||
@media (min-width: 997px) {
|
||||
div[class^="docSidebarContainer"] {
|
||||
aside[class^="docSidebarContainer"] {
|
||||
width: 250px;
|
||||
margin-right: 3rem;
|
||||
|
||||
@ -230,15 +252,21 @@ div[class^="codeBlockContainer"] {
|
||||
|
||||
div[class^="codeBlockTitle"] {
|
||||
background-color: var(--ifm-color-primary-dark) !important;
|
||||
border-bottom: 1px solid #606770;
|
||||
font-family: var(--ifm-font-family-monospace);
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
pre {
|
||||
border-radius: var(--ifm-global-radius);
|
||||
}
|
||||
}
|
||||
|
||||
div[class^="codeBlockLines"] {
|
||||
code[class^="codeBlockLines"] {
|
||||
background-color: var(--ifm-color-primary-dark) !important;
|
||||
margin-bottom: 0;
|
||||
border-radius: 0;
|
||||
margin: 0;
|
||||
.token-line {
|
||||
color: var(--ifm-color-primary-light) !important;
|
||||
}
|
||||
@ -295,19 +323,29 @@ html[data-theme="dark"] .menu {
|
||||
color: var(--ifm-color-primary-light);
|
||||
}
|
||||
|
||||
&--active:not(.menu__link--sublist) {
|
||||
background-color: var(--ifm-color-primary);
|
||||
color: var(--ifm-color-primary-light);
|
||||
|
||||
html[data-theme="dark"] & {
|
||||
background-color: var(--ifm-menu-color-background-hover);
|
||||
color: var(--ifm-color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
html[data-theme="dark"] &,
|
||||
html[data-theme="dark"] &:not([href]),
|
||||
html[data-theme="dark"] &:focus {
|
||||
color: var(--ifm-color-primary-light);
|
||||
}
|
||||
|
||||
html[data-theme="dark"] &:hover {
|
||||
html[data-theme="dark"] &:not(.menu__link--active):hover {
|
||||
background-color: var(--ifm-color-primary);
|
||||
}
|
||||
|
||||
html[data-theme="dark"] &:active {
|
||||
background-color: var(--ifm-color-primary);
|
||||
color: var(--ifm-color-primary-light);
|
||||
html[data-theme="dark"] &:not(.menu__link--active):active {
|
||||
background-color: var(--ifm-color-primary-light);
|
||||
color: var(--ifm-color-primary);
|
||||
}
|
||||
|
||||
&.menu__link--sublist {
|
||||
@ -319,7 +357,7 @@ html[data-theme="dark"] .menu {
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: #fdf9d7;
|
||||
background-color: var(--ifm-menu-color-background-hover);
|
||||
}
|
||||
|
||||
html[data-theme="dark"] & {
|
||||
@ -340,10 +378,16 @@ html[data-theme="dark"] .menu {
|
||||
display: none;
|
||||
}
|
||||
&:before {
|
||||
content: url("/img/Dagger_Icons_Search.svg");
|
||||
content: "";
|
||||
background-color: black;
|
||||
mask: url("/img/Dagger_Icons_Search.svg");
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
|
||||
html[data-theme="dark"] & {
|
||||
background-color: var(--ifm-color-primary-light);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -364,7 +408,6 @@ div[class*="admonition-"] .admonition-icon svg {
|
||||
|
||||
img[alt="github-contribute"] {
|
||||
display: block;
|
||||
margin: auto;
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
@ -378,7 +421,7 @@ img[alt="github-contribute"] {
|
||||
.admonition-#{$name} .admonition-icon::before {
|
||||
mask: url($path);
|
||||
content: "";
|
||||
background-color: $bgColor;
|
||||
background-color: var(--ifm-color-primary-dark);
|
||||
display: block;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import React, { useState, useCallback, useEffect } from 'react';
|
||||
import { MDXProvider } from '@mdx-js/react';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import renderRoutes from '@docusaurus/renderRoutes';
|
||||
@ -18,21 +18,40 @@ import { translate } from '@docusaurus/Translate';
|
||||
import clsx from 'clsx';
|
||||
import styles from './styles.module.css';
|
||||
import { ThemeClassNames, docVersionSearchTag } from '@docusaurus/theme-common';
|
||||
import { Redirect } from "react-router";
|
||||
import qs from 'querystringify';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import { checkUserCollaboratorStatus } from '../../api/github'
|
||||
import { GithubLoginButton } from 'react-social-login-buttons';
|
||||
import Spinner from '../../components/Spinner';
|
||||
import DocPageAuthentication from '../../components/DocPageAuthentication';
|
||||
import DocPageRedirect from '../../components/DocPageRedirect';
|
||||
import DocPageCustom from '../../components/DocPageCustom'
|
||||
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
|
||||
|
||||
function getSidebar({ versionMetadata, currentDocRoute }) {
|
||||
function addTrailingSlash(str) {
|
||||
return str.endsWith('/') ? str : `${str}/`;
|
||||
}
|
||||
|
||||
function removeTrailingSlash(str) {
|
||||
return str.endsWith('/') ? str.slice(0, -1) : str;
|
||||
}
|
||||
|
||||
const { permalinkToSidebar, docsSidebars } = versionMetadata; // With/without trailingSlash, we should always be able to get the appropriate sidebar
|
||||
// note: docs plugin permalinks currently never have trailing slashes
|
||||
// trailingSlash is handled globally at the framework level, not plugin level
|
||||
|
||||
const sidebarName =
|
||||
permalinkToSidebar[currentDocRoute.path] ||
|
||||
permalinkToSidebar[addTrailingSlash(currentDocRoute.path)] ||
|
||||
permalinkToSidebar[removeTrailingSlash(currentDocRoute.path)];
|
||||
const sidebar = docsSidebars[sidebarName];
|
||||
return {
|
||||
sidebar,
|
||||
sidebarName,
|
||||
};
|
||||
}
|
||||
|
||||
function DocPageContent({ currentDocRoute, versionMetadata, children }) {
|
||||
const { siteConfig, isClient } = useDocusaurusContext();
|
||||
const { pluginId, permalinkToSidebar, docsSidebars, version } = versionMetadata;
|
||||
const sidebarName = permalinkToSidebar[currentDocRoute.path];
|
||||
const sidebar = docsSidebars[sidebarName];
|
||||
const { pluginId, version } = versionMetadata;
|
||||
const { sidebarName, sidebar } = getSidebar({
|
||||
versionMetadata,
|
||||
currentDocRoute,
|
||||
});
|
||||
const [hiddenSidebarContainer, setHiddenSidebarContainer] = useState(false);
|
||||
const [hiddenSidebar, setHiddenSidebar] = useState(false);
|
||||
const toggleSidebar = useCallback(() => {
|
||||
@ -42,7 +61,6 @@ function DocPageContent({ currentDocRoute, versionMetadata, children }) {
|
||||
|
||||
setHiddenSidebarContainer(!hiddenSidebarContainer);
|
||||
}, [hiddenSidebar]);
|
||||
|
||||
return (
|
||||
<Layout
|
||||
key={isClient}
|
||||
@ -54,7 +72,7 @@ function DocPageContent({ currentDocRoute, versionMetadata, children }) {
|
||||
}}>
|
||||
<div className={styles.docPage}>
|
||||
{sidebar && (
|
||||
<div
|
||||
<aside
|
||||
className={clsx(styles.docSidebarContainer, {
|
||||
[styles.docSidebarContainerHidden]: hiddenSidebarContainer,
|
||||
})}
|
||||
@ -68,8 +86,7 @@ function DocPageContent({ currentDocRoute, versionMetadata, children }) {
|
||||
if (hiddenSidebarContainer) {
|
||||
setHiddenSidebar(true);
|
||||
}
|
||||
}}
|
||||
role="complementary">
|
||||
}}>
|
||||
<DocSidebar
|
||||
key={
|
||||
// Reset sidebar state on sidebar changes
|
||||
@ -107,7 +124,7 @@ function DocPageContent({ currentDocRoute, versionMetadata, children }) {
|
||||
<IconArrow className={styles.expandSidebarButtonIcon} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</aside>
|
||||
)}
|
||||
<main
|
||||
className={clsx(styles.docMainContainer, {
|
||||
@ -116,7 +133,7 @@ function DocPageContent({ currentDocRoute, versionMetadata, children }) {
|
||||
})}>
|
||||
<div
|
||||
className={clsx(
|
||||
'container padding-vert--lg',
|
||||
'container padding-top--md padding-bottom--lg',
|
||||
styles.docItemWrapper,
|
||||
{
|
||||
[styles.docItemWrapperEnhanced]: hiddenSidebarContainer,
|
||||
@ -141,50 +158,26 @@ function DocPage(props) {
|
||||
);
|
||||
const userAgent = ExecutionEnvironment.canUseDOM ? navigator.userAgent : null;
|
||||
|
||||
// CUSTOM DOCPAGE
|
||||
if (process.env.OAUTH_ENABLE == 'true' && userAgent !== 'Algolia DocSearch Crawler') {
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [redirectState, setRedirectState] = useState()
|
||||
const authQuery = qs.parse(location.search);
|
||||
const [userAccessStatus, setUserAccessStatus] = useState((() => {
|
||||
if (typeof window !== "undefined") return JSON.parse(window.localStorage.getItem('user'))
|
||||
})())
|
||||
// DocPage Swizzle
|
||||
const [userAccessStatus, setUserAccessStatus] = useState((() => {
|
||||
if (typeof window !== "undefined") return JSON.parse(window.localStorage.getItem('user'))
|
||||
})())
|
||||
|
||||
useEffect(async () => {
|
||||
if (!isEmpty(authQuery) && userAccessStatus === null) { //callback after successful auth with github
|
||||
const user = await checkUserCollaboratorStatus(authQuery.code);
|
||||
setUserAccessStatus(user)
|
||||
if (user?.permission) {
|
||||
if (typeof window !== "undefined") window.localStorage.setItem('user', JSON.stringify(user));
|
||||
}
|
||||
useEffect(() => {
|
||||
import('amplitude-js').then(amplitude => {
|
||||
if (userAccessStatus?.login) {
|
||||
var amplitudeInstance = amplitude.getInstance().init(process.env.REACT_APP_AMPLITUDE_ID, userAccessStatus?.login.toLowerCase(), {
|
||||
apiEndpoint: `${window.location.hostname}/t`
|
||||
});
|
||||
amplitude.getInstance().logEvent('Docs Viewed', { "hostname": window.location.hostname, "path": location.pathname });
|
||||
}
|
||||
setIsLoading(false)
|
||||
}, [])
|
||||
})
|
||||
}, [location.pathname, userAccessStatus])
|
||||
|
||||
useEffect(() => {
|
||||
import('amplitude-js').then(amplitude => {
|
||||
if (userAccessStatus?.login) {
|
||||
var amplitudeInstance = amplitude.getInstance().init(process.env.REACT_APP_AMPLITUDE_ID, userAccessStatus?.login.toLowerCase(), {
|
||||
apiEndpoint: `${window.location.hostname}/t`
|
||||
});
|
||||
amplitude.getInstance().logEvent('Docs Viewed', { "hostname": window.location.hostname, "path": location.pathname });
|
||||
}
|
||||
})
|
||||
}, [location.pathname, userAccessStatus])
|
||||
|
||||
if (isLoading) return <Spinner />
|
||||
|
||||
if (userAccessStatus?.permission === false) {
|
||||
return <DocPageRedirect />
|
||||
}
|
||||
|
||||
if (userAccessStatus === null) {
|
||||
return (
|
||||
<DocPageAuthentication />
|
||||
)
|
||||
}
|
||||
if (process.env.OAUTH_ENABLE == 'true' && userAccessStatus?.permission !== true && userAgent !== 'Algolia DocSearch Crawler') {
|
||||
return <DocPageCustom location={location} userAccessStatus={userAccessStatus} setUserAccessStatus={setUserAccessStatus} />
|
||||
}
|
||||
// END CUSTOM DOCPAGE
|
||||
// End DocPageSwizzle
|
||||
|
||||
if (!currentDocRoute) {
|
||||
return <NotFound {...props} />;
|
||||
@ -194,7 +187,9 @@ function DocPage(props) {
|
||||
<DocPageContent
|
||||
currentDocRoute={currentDocRoute}
|
||||
versionMetadata={versionMetadata}>
|
||||
{renderRoutes(docRoutes)}
|
||||
{renderRoutes(docRoutes, {
|
||||
versionMetadata,
|
||||
})}
|
||||
</DocPageContent>
|
||||
);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
:root {
|
||||
--doc-sidebar-width: 300px;
|
||||
--doc-sidebar-hidden-width: 30px;
|
||||
}
|
||||
|
||||
:global(.docs-wrapper) {
|
||||
@ -26,7 +27,7 @@
|
||||
}
|
||||
|
||||
.docMainContainerEnhanced {
|
||||
max-width: none;
|
||||
max-width: calc(100% - var(--doc-sidebar-hidden-width));
|
||||
}
|
||||
|
||||
.docSidebarContainer {
|
||||
@ -39,7 +40,7 @@
|
||||
}
|
||||
|
||||
.docSidebarContainerHidden {
|
||||
width: 30px;
|
||||
width: var(--doc-sidebar-hidden-width);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@ -72,27 +73,14 @@
|
||||
}
|
||||
|
||||
.docItemWrapperEnhanced {
|
||||
max-width: calc(var(--ifm-container-width) + var(--doc-sidebar-width));
|
||||
max-width: calc(
|
||||
var(--ifm-container-width) + var(--doc-sidebar-width)
|
||||
) !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 996px) {
|
||||
.docSidebarContainer {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 997px) and (max-width: 1320px) {
|
||||
.docItemWrapper {
|
||||
max-width: calc(
|
||||
var(--ifm-container-width) - var(--doc-sidebar-width) -
|
||||
var(--ifm-spacing-horizontal) * 2
|
||||
);
|
||||
}
|
||||
|
||||
.docItemWrapperEnhanced {
|
||||
max-width: calc(
|
||||
var(--ifm-container-width) - var(--ifm-spacing-horizontal) * 2
|
||||
);
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,20 @@ import './styles.css';
|
||||
import styles from './styles.module.css';
|
||||
import AnchorIcon from "./anchor.svg"
|
||||
|
||||
const Heading = (Tag) =>
|
||||
export const MainHeading = function MainHeading({...props}) {
|
||||
return (
|
||||
<header>
|
||||
<h1
|
||||
{...props}
|
||||
id={undefined} // h1 headings do not need an id because they don't appear in the TOC
|
||||
className={styles.h1Heading}>
|
||||
{props.children}
|
||||
</h1>
|
||||
</header>
|
||||
);
|
||||
};
|
||||
|
||||
const createAnchorHeading = (Tag) =>
|
||||
function TargetComponent({id, ...props}) {
|
||||
const {
|
||||
navbar: {hideOnScroll},
|
||||
@ -49,4 +62,8 @@ const Heading = (Tag) =>
|
||||
);
|
||||
};
|
||||
|
||||
const Heading = (headingType) => {
|
||||
return headingType === 'h1' ? MainHeading : createAnchorHeading(headingType);
|
||||
};
|
||||
|
||||
export default Heading;
|
||||
|
@ -8,3 +8,8 @@
|
||||
.enhancedAnchor {
|
||||
top: calc(var(--ifm-navbar-height) * -1 - 0.5rem);
|
||||
}
|
||||
|
||||
.h1Heading {
|
||||
font-size: 3rem;
|
||||
margin-bottom: calc(var(--ifm-leading-desktop) * var(--ifm-leading));
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
<svg id="Calque_1" data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 21"><defs><style>.cls-2{fill:#131226}</style></defs><path d="M8.09 7.93a2.824 2.824 0 012.61 2.54 4.082 4.082 0 01-.52 1.86c-.47.71-.93.54-1.63.52-.85-.02-1.65-.04-2.17-.83a3.249 3.249 0 01-.46-1.51c.05-.76-.02-1.67.69-2.15a2.879 2.879 0 011.48-.43z" fill="#fcc016"/><path class="cls-2" d="M14.85 7.64c.63-.58 1.56.35.95.93a5.671 5.671 0 01-1.97.97c-.81.25-1.17-1.02-.35-1.29.25-.09.49-.2.73-.31.15-.06.32-.15.49-.23a1 1 0 01.19-.11zM15.43 13.07c.78.35.1 1.49-.66 1.15-.5-.22-.99-.71-1.41-.88-.78-.32-.44-1.6.35-1.29.63.25 1.11.75 1.72 1.02zM11.29 17.43a7.45 7.45 0 01-.87-1.85c-.29-.82 1-1.15 1.29-.36a6.523 6.523 0 00.73 1.53c.49.71-.66 1.37-1.15.68zM12.88 4.67c-.29.54-.66 1.03-.96 1.58a.673.673 0 01-1.16-.68c.31-.55.68-1.04.97-1.58.41-.76 1.56-.09 1.15.68zM7.05 5.08a6.818 6.818 0 01-.41-2.23c-.04-.86 1.29-.85 1.32 0a6.263 6.263 0 00.36 1.87c.27.81-1 1.15-1.27.36zM6.54 15.43c.32-.78 1.61-.44 1.29.35a16.9 16.9 0 00-.72 2.07.669.669 0 01-1.29-.35 16.332 16.332 0 01.72-2.07zM8.57 14.34a3.979 3.979 0 01-3.14-1.1 4.554 4.554 0 01-1-2.68 4.53 4.53 0 01.07-1.22 3.541 3.541 0 01.87-2.05 3.935 3.935 0 012.66-.91c2.09.23 4.24 1.82 4.2 4.09a5.512 5.512 0 01-1.09 3.13 2.693 2.693 0 01-2.57.74zm-.48-6.41a2.879 2.879 0 00-1.48.43c-.71.48-.64 1.39-.69 2.15a3.249 3.249 0 00.46 1.51c.52.79 1.32.81 2.17.83.7.02 1.16.19 1.63-.52a4.082 4.082 0 00.52-1.86 2.824 2.824 0 00-2.61-2.54zM3.96 7.21a9.267 9.267 0 01-1.72-1.22c-.66-.51 0-1.66.68-1.15a8.946 8.946 0 001.72 1.22c.78.34.1 1.48-.68 1.15zM2.48 13.78a4.587 4.587 0 01.71-.54c.77-.36 1.45.8.67 1.13a4.394 4.394 0 00-1.35 1.19c-.54.66-1.47-.27-.93-.93a6.568 6.568 0 01.9-.85zM2.67 9.35c.85-.08.85 1.24 0 1.33a10.022 10.022 0 01-2.19-.09.666.666 0 01-.46-.81.687.687 0 01.81-.48 6.656 6.656 0 001.84.05z"/></svg>
|
Before Width: | Height: | Size: 1.8 KiB |
@ -1 +0,0 @@
|
||||
<svg data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 21"><path d="M5.85 12.4a4.044 4.044 0 002.92 2.59 6 6 0 001.68.11 6.481 6.481 0 01-3.31.63c-1.91-.14-4.05-1.19-4.42-3.26a6.213 6.213 0 011.71-5.41 4.414 4.414 0 013.55-1.2 4.928 4.928 0 00-1.65 1.97 6.471 6.471 0 00-.48 4.57z" fill="#fcfad8"/><path d="M10.45 15.1a6 6 0 01-1.68-.11 4.044 4.044 0 01-2.92-2.59 6.471 6.471 0 01.48-4.57 4.928 4.928 0 011.65-1.97 4.414 4.414 0 00-3.55 1.2 6.213 6.213 0 00-1.71 5.41c.37 2.07 2.51 3.12 4.42 3.26a6.481 6.481 0 003.31-.63zm.35-9.07a.685.685 0 01-.25.42.724.724 0 01-.52.2c-2.13.6-3.06 2.98-2.69 5.05.46 2.66 4.05 1.72 5.69 1.11.89-.34 1.32.95.63 1.44a.757.757 0 01-.22.67 8.26 8.26 0 01-6.53 2.41 6.145 6.145 0 01-5.74-4.43 7.8 7.8 0 012.3-7.15 5.76 5.76 0 017-.64.817.817 0 01.33.92z" fill="#131226"/></svg>
|
Before Width: | Height: | Size: 830 B |
1
website/src/theme/Toggle/icon_day.svg
Normal file
1
website/src/theme/Toggle/icon_day.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg class="mode" data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 21"><defs><style>.cls-2{fill:#131226}</style></defs><path d="M8.09 7.93a2.824 2.824 0 012.61 2.54 4.082 4.082 0 01-.52 1.86c-.47.71-.93.54-1.63.52-.85-.02-1.65-.04-2.17-.83a3.249 3.249 0 01-.46-1.51c.05-.76-.02-1.67.69-2.15a2.879 2.879 0 011.48-.43z" fill="#fcc016"/><path class="cls-2" d="M14.85 7.64c.63-.58 1.56.35.95.93a5.671 5.671 0 01-1.97.97c-.81.25-1.17-1.02-.35-1.29.25-.09.49-.2.73-.31.15-.06.32-.15.49-.23a1 1 0 01.19-.11zM15.43 13.07c.78.35.1 1.49-.66 1.15-.5-.22-.99-.71-1.41-.88-.78-.32-.44-1.6.35-1.29.63.25 1.11.75 1.72 1.02zM11.29 17.43a7.45 7.45 0 01-.87-1.85c-.29-.82 1-1.15 1.29-.36a6.523 6.523 0 00.73 1.53c.49.71-.66 1.37-1.15.68zM12.88 4.67c-.29.54-.66 1.03-.96 1.58a.673.673 0 01-1.16-.68c.31-.55.68-1.04.97-1.58.41-.76 1.56-.09 1.15.68zM7.05 5.08a6.818 6.818 0 01-.41-2.23c-.04-.86 1.29-.85 1.32 0a6.263 6.263 0 00.36 1.87c.27.81-1 1.15-1.27.36zM6.54 15.43c.32-.78 1.61-.44 1.29.35a16.9 16.9 0 00-.72 2.07.669.669 0 01-1.29-.35 16.332 16.332 0 01.72-2.07zM8.57 14.34a3.979 3.979 0 01-3.14-1.1 4.554 4.554 0 01-1-2.68 4.53 4.53 0 01.07-1.22 3.541 3.541 0 01.87-2.05 3.935 3.935 0 012.66-.91c2.09.23 4.24 1.82 4.2 4.09a5.512 5.512 0 01-1.09 3.13 2.693 2.693 0 01-2.57.74zm-.48-6.41a2.879 2.879 0 00-1.48.43c-.71.48-.64 1.39-.69 2.15a3.249 3.249 0 00.46 1.51c.52.79 1.32.81 2.17.83.7.02 1.16.19 1.63-.52a4.082 4.082 0 00.52-1.86 2.824 2.824 0 00-2.61-2.54zM3.96 7.21a9.267 9.267 0 01-1.72-1.22c-.66-.51 0-1.66.68-1.15a8.946 8.946 0 001.72 1.22c.78.34.1 1.48-.68 1.15zM2.48 13.78a4.587 4.587 0 01.71-.54c.77-.36 1.45.8.67 1.13a4.394 4.394 0 00-1.35 1.19c-.54.66-1.47-.27-.93-.93a6.568 6.568 0 01.9-.85zM2.67 9.35c.85-.08.85 1.24 0 1.33a10.022 10.022 0 01-2.19-.09.666.666 0 01-.46-.81.687.687 0 01.81-.48 6.656 6.656 0 001.84.05z"/></svg>
|
After Width: | Height: | Size: 1.8 KiB |
1
website/src/theme/Toggle/icon_night.svg
Normal file
1
website/src/theme/Toggle/icon_night.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg class="mode" data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 21"><path d="M5.85 12.4a4.044 4.044 0 002.92 2.59 6 6 0 001.68.11 6.481 6.481 0 01-3.31.63c-1.91-.14-4.05-1.19-4.42-3.26a6.213 6.213 0 011.71-5.41 4.414 4.414 0 013.55-1.2 4.928 4.928 0 00-1.65 1.97 6.471 6.471 0 00-.48 4.57z" fill="#fcfad8"/><path d="M10.45 15.1a6 6 0 01-1.68-.11 4.044 4.044 0 01-2.92-2.59 6.471 6.471 0 01.48-4.57 4.928 4.928 0 011.65-1.97 4.414 4.414 0 00-3.55 1.2 6.213 6.213 0 00-1.71 5.41c.37 2.07 2.51 3.12 4.42 3.26a6.481 6.481 0 003.31-.63zm.35-9.07a.685.685 0 01-.25.42.724.724 0 01-.52.2c-2.13.6-3.06 2.98-2.69 5.05.46 2.66 4.05 1.72 5.69 1.11.89-.34 1.32.95.63 1.44a.757.757 0 01-.22.67 8.26 8.26 0 01-6.53 2.41 6.145 6.145 0 01-5.74-4.43 7.8 7.8 0 012.3-7.15 5.76 5.76 0 017-.64.817.817 0 01.33.92z" fill="#131226"/></svg>
|
After Width: | Height: | Size: 843 B |
@ -9,8 +9,8 @@ import { useThemeConfig } from '@docusaurus/theme-common';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import clsx from 'clsx';
|
||||
import styles from './styles.module.css';
|
||||
import DarkIcon from "./Icon_Night-mode.svg"
|
||||
import LightIcon from "./Icon_Day-mode.svg"
|
||||
import DarkIcon from "./icon_night.svg"
|
||||
import LightIcon from "./icon_day.svg"
|
||||
|
||||
const Dark = ({ icon, style }) => (
|
||||
<span className={clsx(styles.toggle, styles.dark)} style={style}>
|
||||
|
@ -103,3 +103,9 @@
|
||||
:global(.react-toggle--checked .react-toggle-thumb) {
|
||||
left: 31px;
|
||||
}
|
||||
|
||||
:global(.icon_day_svg__mode),
|
||||
:global(.icon_night_svg__mode) {
|
||||
height: 26px;
|
||||
width: 26px;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user