From 946c1f1b33890cadefaefdc0d04ddd8628913f15 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Thu, 12 Sep 2024 12:27:13 +0200 Subject: [PATCH 1/4] Update Fablo Docker image registry to GHCR Signed-off-by: Jakub Dzikowski --- .github/workflows/publish-docker-on-main.yml | 12 +++++------- .github/workflows/release-on-tag.yml | 2 +- CHANGELOG.md | 2 +- README.md | 10 +++++----- fablo-build.sh | 6 +++--- fablo.sh | 2 +- src/repositoryUtils.ts | 2 +- 7 files changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/publish-docker-on-main.yml b/.github/workflows/publish-docker-on-main.yml index 9854955e..79c91d8c 100644 --- a/.github/workflows/publish-docker-on-main.yml +++ b/.github/workflows/publish-docker-on-main.yml @@ -5,9 +5,6 @@ on: branches: - main -env: - IMAGE_NAME: softwaremill/fablo - jobs: publish-docker: runs-on: ubuntu-latest @@ -21,11 +18,12 @@ jobs: with: driver: docker-container - - name: Login to DockerHub - uses: docker/login-action@v1 + - name: Login to GHCR + uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_LOGIN }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image run: | diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index bdcc5e71..8570a4e3 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -41,7 +41,7 @@ jobs: - name: Publish Docker image run: | FABLO_VERSION=$(jq -r '.version' <"$GITHUB_WORKSPACE/package.json") - docker push softwaremill/fablo:"$FABLO_VERSION" + docker push ghcr.io/hyperledger-labs/fablo:"$FABLO_VERSION" - name: Create GitHub Release uses: "marvinpinto/action-automatic-releases@latest" diff --git a/CHANGELOG.md b/CHANGELOG.md index dba0850f..d3a9c05a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,7 +65,7 @@ ## 0.3.0 ### Features -* Add [Fablo REST](https://github.com/softwaremill/fablo-rest/) support +* Add [Fablo REST](https://github.com/fablo-io/fablo-rest/) support * By default all peers are anchor peers * Support `postGenerate` hook * Added support for [Orderer sharding](https://github.com/hyperledger-labs/fablo/issues/220) (multiple orderer groups). diff --git a/README.md b/README.md index d86d2c8e..e7074b6f 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Fablo supports: * RAFT and solo consensus protocols * Multiple organizations and channels * Chaincode installation and upgrade -* REST API client for CA and chaincodes ([Fablo REST](https://github.com/softwaremill/fablo-rest)) +* REST API client for CA and chaincodes ([Fablo REST](https://github.com/fablo-io/fablo-rest)) * [Blockchain Explorer](https://github.com/hyperledger/blockchain-explorer) which can be enabled for each organization ## See it in action @@ -42,7 +42,7 @@ To create a local Hyperledger Fabric network with Node.js chaincode and REST API ``` After a few minutes the whole network will be set up and running. -You can check the running nodes via `docker ps` or `docker stats`, and you can query the network with command line (via `cli.org1.example.com` container) or REST API client (via [Fablo REST](https://github.com/softwaremill/fablo-rest)). +You can check the running nodes via `docker ps` or `docker stats`, and you can query the network with command line (via `cli.org1.example.com` container) or REST API client (via [Fablo REST](https://github.com/fablo-io/fablo-rest)). ## Basic usage @@ -78,7 +78,7 @@ Good step to start your adventure with Fablo or set up a fast prototype. Fablo `init` command takes three parameters (the order does not matter): * Option `node` makes Fablo to generate a sample Node.js chaincode as well. -* Option `rest` enables simple REST API with [Fablo REST](https://github.com/softwaremill/fablo-rest) as standalone Docker container. +* Option `rest` enables simple REST API with [Fablo REST](https://github.com/fablo-io/fablo-rest) as standalone Docker container. * Option `dev` enables running peers in dev mode (so the hot reload for chaincode is possible). Sample command: @@ -570,9 +570,9 @@ You can find them in `fablo-target/fablo-config/connection-profiles` directory i ### REST API -Fablo is integrated with simple REST API for CA and chaincodes, supported by [Fablo REST](https://github.com/softwaremill/fablo-rest). +Fablo is integrated with simple REST API for CA and chaincodes, supported by [Fablo REST](https://github.com/fablo-io/fablo-rest). If you want to use it, provide for your organization `"tools": { "fabloRest": true }`. -Visit the [Fablo REST](https://github.com/softwaremill/fablo-rest) project for more documentation. +Visit the [Fablo REST](https://github.com/fablo-io/fablo-rest) project for more documentation. ### Blockchain Explorer diff --git a/fablo-build.sh b/fablo-build.sh index 4ff74904..a261521a 100755 --- a/fablo-build.sh +++ b/fablo-build.sh @@ -15,7 +15,7 @@ echo " FABLO_HOME: $FABLO_HOME" echo " FABLO_VERSION: $FABLO_VERSION" echo " VERSION_DETAILS: $VERSION_DETAILS" -IMAGE_BASE_NAME="softwaremill/fablo:$FABLO_VERSION" +IMAGE_BASE_NAME="ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then set +e @@ -37,7 +37,7 @@ if [ "${1:-''}" = "--push" ]; then docker buildx build \ --build-arg VERSION_DETAILS="$VERSION_DETAILS" \ --platform linux/amd64,linux/arm64 \ - --tag "softwaremill/fablo:$FABLO_VERSION" \ + --tag "ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" \ --push \ "$FABLO_HOME" else @@ -45,5 +45,5 @@ else --build-arg VERSION_DETAILS="$VERSION_DETAILS" \ --tag "$IMAGE_BASE_NAME" "$FABLO_HOME" - docker tag "$IMAGE_BASE_NAME" "softwaremill/fablo:$FABLO_VERSION" + docker tag "$IMAGE_BASE_NAME" "ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" fi diff --git a/fablo.sh b/fablo.sh index 83e55161..cc3a4388 100755 --- a/fablo.sh +++ b/fablo.sh @@ -3,7 +3,7 @@ set -e FABLO_VERSION=1.2.1-unstable.0 -FABLO_IMAGE_NAME="softwaremill/fablo" +FABLO_IMAGE_NAME="ghcr.io/hyperledger-labs/fablo" FABLO_IMAGE="$FABLO_IMAGE_NAME:$FABLO_VERSION" COMMAND="$1" diff --git a/src/repositoryUtils.ts b/src/repositoryUtils.ts index 03919cd8..58d61e94 100644 --- a/src/repositoryUtils.ts +++ b/src/repositoryUtils.ts @@ -1,6 +1,6 @@ import got from "got"; -const repositoryName = "softwaremill/fablo"; +const repositoryName = "ghcr.io/hyperledger-labs/fablo"; const repositoryTagsListUrl = `https://registry.hub.docker.com/v2/repositories/${repositoryName}/tags`; const incrementVersionFragment = (versionFragment: string) => { From 5d9ed9784a6d73d716094851a31c70560404ee30 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Thu, 12 Sep 2024 12:42:48 +0200 Subject: [PATCH 2/4] Update Fablo REST version and registry Signed-off-by: Jakub Dzikowski --- ...-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- src/setup-docker/index.ts | 2 +- src/setup-docker/templates/fabric-docker/docker-compose.yaml | 2 +- src/setup-k8s/index.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 874e9864..235e2886 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2034,7 +2034,7 @@ services: fablo-rest.org1.example.com: container_name: fablo-rest.org1.example.com - image: softwaremill/fablo-rest:\${FABLO_REST_VERSION} + image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} environment: - PORT=8000 - MSP_ID=Org1MSP diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 44fbec80..808c3ce0 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4091,7 +4091,7 @@ services: fablo-rest.org1.example.com: container_name: fablo-rest.org1.example.com - image: softwaremill/fablo-rest:\${FABLO_REST_VERSION} + image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} environment: - PORT=8000 - MSP_ID=Org1MSP diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 47ac08e0..092dfe78 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -161,7 +161,7 @@ export default class SetupDockerGenerator extends Generator { paths: global.paths, fabloVersion: config.fabloVersion, fabloBuild: getBuildInfo(), - fabloRestVersion: "0.1.0", + fabloRestVersion: "0.1.2", hyperledgerExplorerVersion: "1.1.8", fabricCouchDbVersion: "0.4.18", couchDbVersion: "3.1", diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 9ac57cbb..2ec40b3d 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -110,7 +110,7 @@ services: <%_ if (org.tools.fabloRest) { _%> <%= org.tools.fabloRest.address %>: container_name: <%= org.tools.fabloRest.address %> - image: softwaremill/fablo-rest:${FABLO_REST_VERSION} + image: ghcr.io/fablo-io/fablo-rest:${FABLO_REST_VERSION} environment: - PORT=8000 - MSP_ID=<%= org.tools.fabloRest.mspId %> diff --git a/src/setup-k8s/index.ts b/src/setup-k8s/index.ts index 473da594..36a99e88 100644 --- a/src/setup-k8s/index.ts +++ b/src/setup-k8s/index.ts @@ -68,7 +68,7 @@ export default class SetupDockerGenerator extends Generator { paths: global.paths, fabloVersion: config.fabloVersion, fabloBuild: getBuildInfo(), - fabloRestVersion: "0.1.0", + fabloRestVersion: "0.1.2", hyperledgerExplorerVersion: "1.1.8", fabricCouchDbVersion: "0.4.18", couchDbVersion: "3.1", From 0f0c8114d2e0a09cb5aac7fe37878f221491fc4d Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 17 Sep 2024 14:17:36 +0200 Subject: [PATCH 3/4] Update getting Fablo versions Signed-off-by: Jakub Dzikowski --- src/repositoryUtils.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/repositoryUtils.ts b/src/repositoryUtils.ts index 58d61e94..d3c30be0 100644 --- a/src/repositoryUtils.ts +++ b/src/repositoryUtils.ts @@ -1,7 +1,6 @@ import got from "got"; -const repositoryName = "ghcr.io/hyperledger-labs/fablo"; -const repositoryTagsListUrl = `https://registry.hub.docker.com/v2/repositories/${repositoryName}/tags`; +const repositoryTagsListUrl = `https://api.github.com/repos/hyperledger-labs/fablo/releases`; const incrementVersionFragment = (versionFragment: string) => { if (versionFragment.includes("-")) { @@ -55,21 +54,23 @@ const version = (v: string): Version => ({ }, }); -const requestVersionNames = (): Promise<{ results: { name: string }[] }> => { +const requestVersionNames = (): Promise<{ tag_name: string }[]> => { const params = { searchParams: { tag_status: "active", page_size: 1024, }, }; - return got(repositoryTagsListUrl, params).json<{ results: { name: string }[] }>(); + return got(repositoryTagsListUrl, params).json<{ tag_name: string }[]>(); }; +const versionRegex = /^v\d+\.\d+\.\d+(-[a-zA-Z0-9-]+)?$/; + const getAvailableTags = async (): Promise => { try { - const versionNames = (await requestVersionNames()).results - .filter((v) => v.name !== "latest") - .map((tag) => tag.name); + const versionNames = (await requestVersionNames()) + .filter((release) => versionRegex.test(release.tag_name)) + .map((release) => release.tag_name.slice(1)); return sortVersions(versionNames); } catch (err) { console.log(`Could not check for updates. Url: '${repositoryTagsListUrl}' not available`); From 4d59aa272637f50310c808442c80b3773eb81618 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 17 Sep 2024 14:17:49 +0200 Subject: [PATCH 4/4] Update snapshots Signed-off-by: Jakub Dzikowski --- ...-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 2 +- ...config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- ...config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 235e2886..f10bef04 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1526,7 +1526,7 @@ fi exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` "FABLO_VERSION=1.2.1-unstable.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index a4661b8e..f9353a77 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1436,7 +1436,7 @@ fi exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "FABLO_VERSION=1.2.1-unstable.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 2c889703..363def0d 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2097,7 +2097,7 @@ fi exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` "FABLO_VERSION=1.2.1-unstable.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 808c3ce0..8af26453 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3020,7 +3020,7 @@ fi exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` "FABLO_VERSION=1.2.1-unstable.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 59c39919..503cf956 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3316,7 +3316,7 @@ fi exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` "FABLO_VERSION=1.2.1-unstable.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1