forked from hyperledger-cacti/cacti
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(examples/supply-chain): fix test infra - migrate to Fabric v2.5.6
The supply chain app's build and execution scripts should finally be working after this and also be much more stable than before due to the flakiness of the Fabric V1 test ledger not being an issue anymore. The container image is now published as: `ghcr.io/hyperledger/cactus-example-supply-chain-app:2024-03-08--pr-3059-1` 1.The new contract is compiled with go v1.20 and therefore has to have the contract method names capitalized insted of camelCase, otherwise the methods are not possible to be exported and the contract deployment fails even if everything else is correct. 2. The supply chain app now uses the newest edition of the Fabric v2 AIO test ledger container image which uses Fabric v2.5.6 (current LTS at the time of this writing). 3. The shipment contract's source code has been migrated to Fabric v2 meaning that instead of a stub object we get a context object for each method's first parameter and then the stub can be acquired from that context object. 4. The method arguments no longer need to be passed around as an array of strings and instead the contract method's input arguments are first-class go method parameters. 5. Re-enabled a test case that was being skipped until now due to flakiness: ...`src/test/typescript/integration/supply-chain-backend-api-calls.test.ts` The supply chain app container image was built with this command: ```sh DOCKER_BUILDKIT=1 docker build \ --build-arg="NPM_PKG_VERSION=2.0.0-2945-supply-chain-app-build-failed.241+b2c306ea0" \ -f ./examples/cactus-example-supply-chain-backend/Dockerfile \ . \ -t scaeb ``` The NPM_PKG_VERSION build arg is important because the image defaults to "latest" which at the moment is packages that do not contain the fixes made by this commit, so re-building the image without that extra arg will not work until we issue the next official non-canary release. Depends on hyperledger-cacti#3058 Depends on hyperledger-cacti#3054 Fixes hyperledger-cacti#2945 Fixes hyperledger-cacti#2969 Fixes hyperledger-cacti#1899 Fixes hyperledger-cacti#1521 Fixes hyperledger-cacti#1518 Signed-off-by: Peter Somogyvari <[email protected]>
- Loading branch information
Showing
15 changed files
with
293 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,66 @@ | ||
FROM cruizba/ubuntu-dind:19.03.11 as runner | ||
FROM cruizba/ubuntu-dind:jammy-24.0.7-compose-2.24.0 as runner | ||
|
||
USER root | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update | ||
RUN apt -y upgrade | ||
RUN apt-get update && \ | ||
apt -y upgrade | ||
|
||
# Need curl for healthchecks | ||
RUN apt-get -y install --no-install-recommends curl | ||
|
||
# The file binary is used to inspect exectubles when debugging container image issues | ||
RUN apt-get -y install --no-install-recommends file | ||
|
||
|
||
RUN apt-get -y install --no-install-recommends ca-certificates | ||
RUN apt-get -y install --no-install-recommends tzdata | ||
RUN apt-get -y install --no-install-recommends -y \ | ||
curl \ | ||
file \ | ||
ca-certificates \ | ||
tzdata \ | ||
git \ | ||
jq | ||
|
||
ARG APP=/usr/src/app/ | ||
|
||
ENV TZ=Etc/UTC | ||
ENV APP_USER=appuser | ||
|
||
RUN useradd -m ${APP_USER} | ||
RUN usermod -a -G ${APP_USER} ${APP_USER} | ||
RUN mkdir -p ${APP} | ||
RUN useradd -m ${APP_USER} && \ | ||
usermod -a -G ${APP_USER} ${APP_USER} && \ | ||
mkdir -p ${APP} | ||
|
||
RUN mkdir -p "${APP}/log/" | ||
RUN chown -R $APP_USER:$APP_USER "${APP}/" | ||
RUN mkdir -p "${APP}/log/" && \ | ||
chown -R $APP_USER:$APP_USER "${APP}/" | ||
|
||
# TODO: Can we hack it together so that the whole thing works rootless? | ||
USER ${APP_USER} | ||
WORKDIR ${APP} | ||
|
||
# COPY --chown=${APP_USER}:${APP_USER} examples/cactus-example-supply-chain-backend/tpl.package.json /usr/src/app/package.json | ||
|
||
# RUN touch /usr/src/app/package.json | ||
|
||
SHELL ["/bin/bash", "--login", "-i", "-c"] | ||
# Installing Node Version Manager (nvm) | ||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash | ||
ARG NPM_PKG_VERSION=latest | ||
# Installing NodeJS via Node Version Manager (nvm) | ||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | ||
ARG NPM_PKG_VERSION="latest" | ||
RUN source ~/.bashrc && \ | ||
nvm install 16.15.1 && \ | ||
npm install -g yarn && \ | ||
yarn add @hyperledger/cactus-example-supply-chain-backend@${NPM_PKG_VERSION} --ignore-engines --production | ||
nvm install 18.18.2 && \ | ||
npm i -g corepack && corepack enable && corepack prepare [email protected] --activate && \ | ||
yarn init --yes --private && \ | ||
yarn config set nodeLinker node-modules && \ | ||
yarn add @hyperledger/cactus-example-supply-chain-backend@${NPM_PKG_VERSION} --exact && \ | ||
yarn add [email protected] --exact && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-test-tooling": "\($NPM_PKG_VERSION)" }' | tee /usr/src/app/package.json && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-api-client": "\($NPM_PKG_VERSION)" } ' | tee /usr/src/app/package.json && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-cmd-api-server": "\($NPM_PKG_VERSION)" } ' | tee /usr/src/app/package.json && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-common": "\($NPM_PKG_VERSION)" } ' | tee /usr/src/app/package.json && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-core": "\($NPM_PKG_VERSION)" } ' | tee /usr/src/app/package.json && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-core-api": "\($NPM_PKG_VERSION)" } ' | tee /usr/src/app/package.json && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-example-supply-chain-business-logic-plugin": "\($NPM_PKG_VERSION)" } ' | tee /usr/src/app/package.json && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-example-supply-chain-frontend": "\($NPM_PKG_VERSION)" } ' | tee /usr/src/app/package.json && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-plugin-consortium-manual": "\($NPM_PKG_VERSION)" } ' | tee /usr/src/app/package.json && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-plugin-keychain-memory": "\($NPM_PKG_VERSION)" } ' | tee /usr/src/app/package.json && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-plugin-ledger-connector-besu": "\($NPM_PKG_VERSION)" } ' | tee /usr/src/app/package.json && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-plugin-ledger-connector-fabric": "\($NPM_PKG_VERSION)" } ' | tee /usr/src/app/package.json && \ | ||
cat /usr/src/app/package.json | jq --arg NPM_PKG_VERSION ${NPM_PKG_VERSION} '.resolutions += { "@hyperledger/cactus-plugin-ledger-connector-quorum": "\($NPM_PKG_VERSION)" } ' | tee /usr/src/app/package.json && \ | ||
yarn install | ||
|
||
SHELL ["/bin/bash", "--login", "-c"] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ackend/src/main/typescript/infrastructure/shipment-golang-contract-pinned-dependencies.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* These are the pinned dependencies used to build the go source code that is | ||
* located in the file at: | ||
* examples/cactus-example-supply-chain-backend/src/main/go/shipment.ts | ||
*/ | ||
export const SHIPMENT_GOLANG_CONTRACT_PINNED_DEPENDENCIES = [ | ||
"github.com/hyperledger/[email protected]", | ||
"github.com/hyperledger/[email protected]", | ||
"github.com/hyperledger/[email protected]", | ||
"github.com/hyperledger/fabric-samples/asset-transfer-private-data/[email protected]", | ||
"github.com/stretchr/[email protected]", | ||
"google.golang.org/[email protected]", | ||
"github.com/davecgh/[email protected]", // indirect | ||
"github.com/go-openapi/[email protected]", // indirect | ||
"github.com/go-openapi/[email protected]", // indirect | ||
"github.com/go-openapi/[email protected]", // indirect | ||
"github.com/go-openapi/[email protected]", // indirect | ||
"github.com/gobuffalo/[email protected]", // indirect | ||
"github.com/gobuffalo/[email protected]", // indirect | ||
"github.com/gobuffalo/[email protected]", // indirect | ||
"github.com/golang/[email protected]", // indirect | ||
"github.com/joho/[email protected]", // indirect | ||
"github.com/josharian/[email protected]", // indirect | ||
"github.com/mailru/[email protected]", // indirect | ||
"github.com/pmezard/[email protected]", // indirect | ||
"github.com/rogpeppe/[email protected]", // indirect | ||
"github.com/xeipuuv/[email protected]", // indirect | ||
"github.com/xeipuuv/[email protected]", // indirect | ||
"github.com/xeipuuv/[email protected]", // indirect | ||
"golang.org/x/[email protected]", // indirect | ||
"golang.org/x/[email protected]", // indirect | ||
"golang.org/x/[email protected]", // indirect | ||
"golang.org/x/[email protected]", // indirect | ||
"google.golang.org/genproto/googleapis/[email protected]", // indirect | ||
"google.golang.org/[email protected]", // indirect | ||
"gopkg.in/[email protected]", // indirect | ||
]; |
Oops, something went wrong.