From 66a39826d0ba0929fc06dcc183f42b6b40064d1e Mon Sep 17 00:00:00 2001 From: Laurent Senta Date: Fri, 7 Apr 2023 11:19:43 +0200 Subject: [PATCH] feat: setup ci ipns map --- .github/workflows/test.yml | 5 +++-- Makefile | 2 +- cmd/gateway-conformance/main.go | 7 +------ kubo-config.example.sh | 7 ++++++- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a031b5e95..1b21da2da 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,9 +27,10 @@ jobs: run: | ipfs init; ./gateway-conformance/kubo-config.example.sh; + IPFS_NS_MAP=$(cat ./fixtures/dnslinks.json | jq -r 'to_entries | map("\(.key).example.com:\(.value)") | join(",")') + echo "IPFS_NS_MAP=${IPFS_NS_MAP}" >> $GITHUB_ENV - uses: ipfs/start-ipfs-daemon-action@v1 - env: - IPFS_NS_MAP: 12 # TODO + # note: the IPFS_NS_MAP set above will be passed to this action. - name: Provision Kubo Gateway run: | find ./fixtures -name '*.car' -exec ipfs dag import {} \; diff --git a/Makefile b/Makefile index da79019b9..02cb059f4 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ provision-cargateway: ./fixtures.car # cd go-libipfs/examples/car && go install car -c ./fixtures.car & -provision-kubo: +provision-kubo: fixtures.car find ./fixtures -name '*.car' -exec ipfs dag import {} \; fixtures.car: gateway-conformance diff --git a/cmd/gateway-conformance/main.go b/cmd/gateway-conformance/main.go index 720c4c6be..a56ac45bc 100644 --- a/cmd/gateway-conformance/main.go +++ b/cmd/gateway-conformance/main.go @@ -190,11 +190,6 @@ func main() { if err != nil { return err } - - err = dnslink.AsEnv(fxs.ConfigFiles, filepath.Join(directory, "dnslinks.env")) - if err != nil { - return err - } } else { err = copyFiles(fxs.CarFiles, directory) if err != nil { @@ -206,7 +201,7 @@ func main() { return err } - err = dnslink.AsEnv(fxs.ConfigFiles, filepath.Join(directory, "dnslinks.env")) + err := dnslink.Merge(fxs.ConfigFiles, filepath.Join(directory, "dnslinks.json")) if err != nil { return err } diff --git a/kubo-config.example.sh b/kubo-config.example.sh index d1873534a..8a266ad37 100755 --- a/kubo-config.example.sh +++ b/kubo-config.example.sh @@ -9,4 +9,9 @@ ipfs config --json Gateway.PublicGateways '{ "InlineDNSLink": true, "Paths": ["/ipfs", "/ipns", "/api"] } -}' \ No newline at end of file +}' + +IPFS_NS_MAP=$(cat ./dnslinks.json | jq -r 'to_entries | map("\(.key).example.com:\(.value)") | join(",")') + +echo "Set the following IPFS_NS_MAP before starting the kubo daemon:" +echo "IPFS_NS_MAP=${IPFS_NS_MAP}"