Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize 2.5 images for java chaincode and node chaincode #4984

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions core/chaincode/chaincodetest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ chaincode:
path:
name:

# Generic builder environment, suitable for most chaincode types
# Generic builder image with Go pre-installed.
# TWO_DIGIT_VERSION represents Fabric major.minor version.
builder: $(DOCKER_NS)/fabric-ccenv:$(TWO_DIGIT_VERSION)

# Enables/disables force pulling of the base docker images (listed below)
Expand All @@ -303,22 +304,23 @@ chaincode:
pull: false

golang:
# golang will never need more than baseos
# Compiled Go chaincodes will be copied to the fabric-baseos runtime image.
# TWO_DIGIT_VERSION represents Fabric major.minor version.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not do that for Golang too? The state of Golang chaincode is the same as the others :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go chaincode's fabric-ccenv and fabric-baseos images are built and published alongside fabric in this repository, might as well use the most recent images with latest Go.

runtime: $(DOCKER_NS)/fabric-baseos:$(TWO_DIGIT_VERSION)

# whether or not golang chaincode should be linked dynamically
dynamicLink: false

java:
# This is an image based on java:openjdk-8 with addition compiler
# This is an image based on eclipse temurin with addition compiler
# tools added for java shim layer packaging.
# This image is packed with shim layer libraries that are necessary
# for Java chaincode runtime.
runtime: $(DOCKER_NS)/fabric-javaenv:$(TWO_DIGIT_VERSION)
runtime: $(DOCKER_NS)/fabric-javaenv:2.5

node:
# This is an image based on node:$(NODE_VER)-alpine
runtime: $(DOCKER_NS)/fabric-nodeenv:$(TWO_DIGIT_VERSION)
runtime: $(DOCKER_NS)/fabric-nodeenv:2.5

# timeout in millisecs for starting up a container and waiting for Register
# to come through. 1sec should be plenty for chaincode unit tests
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/java/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func TestDockerBuildOptions(t *testing.T) {
require.NoError(t, err, "unexpected error from DockerBuildOptions")

expectedOpts := util.DockerBuildOptions{
Image: "hyperledger/fabric-javaenv:latest",
Image: "hyperledger/fabric-javaenv:2.5",
Cmd: "./build.sh",
}
require.Equal(t, expectedOpts, opts)
Expand Down
2 changes: 1 addition & 1 deletion core/chaincode/platforms/node/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestGenerateBuildOptions(t *testing.T) {
require.NoError(t, err)

expectedOpts := util.DockerBuildOptions{
Image: "hyperledger/fabric-nodeenv:latest",
Image: "hyperledger/fabric-nodeenv:2.5",
Cmd: expectedBuildScript,
}
require.Equal(t, expectedOpts, opts)
Expand Down
12 changes: 7 additions & 5 deletions core/deliverservice/testdata/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,8 @@ chaincode:
path:
name:

# Generic builder environment, suitable for most chaincode types
# Generic builder image with Go pre-installed.
# TWO_DIGIT_VERSION represents Fabric major.minor version.
builder: $(DOCKER_NS)/fabric-ccenv:$(TWO_DIGIT_VERSION)

# Enables/disables force pulling of the base docker images (listed below)
Expand All @@ -576,22 +577,23 @@ chaincode:
pull: false

golang:
# golang will never need more than baseos
# Compiled Go chaincodes will be copied to the fabric-baseos runtime image.
# TWO_DIGIT_VERSION represents Fabric major.minor version.
runtime: $(DOCKER_NS)/fabric-baseos:$(TWO_DIGIT_VERSION)

# whether or not golang chaincode should be linked dynamically
dynamicLink: false

java:
# This is an image based on java:openjdk-8 with addition compiler
# This is an image based on eclipse temurin with addition compiler
# tools added for java shim layer packaging.
# This image is packed with shim layer libraries that are necessary
# for Java chaincode runtime.
runtime: $(DOCKER_NS)/fabric-javaenv:$(TWO_DIGIT_VERSION)
runtime: $(DOCKER_NS)/fabric-javaenv:2.5

node:
# This is an image based on node:$(NODE_VER)-alpine
runtime: $(DOCKER_NS)/fabric-nodeenv:$(TWO_DIGIT_VERSION)
runtime: $(DOCKER_NS)/fabric-nodeenv:2.5

# List of directories to treat as external builders and launchers for
# chaincode. The external builder detection processing will iterate over the
Expand Down
13 changes: 12 additions & 1 deletion docs/source/chaincode_lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,18 @@ You need to install the chaincode package on every peer that will execute and
endorse transactions. You need to complete this step with the peer CLI using the
credentials of the **Peer Administrator**. Your peer will build the chaincode
after the chaincode is installed, and return a build error if there is a problem
with your chaincode. It is recommended that organizations only package a chaincode
with your chaincode.

To build chaincode, the peer by default will utilize an internal Docker builder with
support for Go, Java, and Node.js chaincodes. The docker image that is used for building
each language is specified in the peer's `core.yaml` configuration in the `chaincode` section.
The Go docker image version typically aligns with the Fabric version,
while the Java and Node.js docker image versions are managed by the respective Fabric chaincode projects.

In a production environment, an external chaincode builder is often utilized to provide more control
of the build process, see the [External Builders and Launchers](cc_launcher.html) topic for more details.

It is recommended that organizations only package a chaincode
once, and then install the same package on every peer that belongs to their org.
If a channel wants to ensure that each organization is running the same chaincode,
one organization can package a chaincode and send it to other channel members
Expand Down
12 changes: 7 additions & 5 deletions orderer/common/cluster/testdata/blockverification/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,8 @@ chaincode:
path:
name:

# Generic builder environment, suitable for most chaincode types
# Generic builder image with Go pre-installed.
# TWO_DIGIT_VERSION represents Fabric major.minor version.
builder: $(DOCKER_NS)/fabric-ccenv:$(TWO_DIGIT_VERSION)

# Enables/disables force pulling of the base docker images (listed below)
Expand All @@ -583,22 +584,23 @@ chaincode:
pull: false

golang:
# golang will never need more than baseos
# Compiled Go chaincodes will be copied to the fabric-baseos runtime image.
# TWO_DIGIT_VERSION represents Fabric major.minor version.
runtime: $(DOCKER_NS)/fabric-baseos:$(TWO_DIGIT_VERSION)

# whether or not golang chaincode should be linked dynamically
dynamicLink: false

java:
# This is an image based on java:openjdk-8 with addition compiler
# This is an image based on eclipse temurin with addition compiler
# tools added for java shim layer packaging.
# This image is packed with shim layer libraries that are necessary
# for Java chaincode runtime.
runtime: $(DOCKER_NS)/fabric-javaenv:$(TWO_DIGIT_VERSION)
runtime: $(DOCKER_NS)/fabric-javaenv:2.5

node:
# This is an image based on node:$(NODE_VER)-alpine
runtime: $(DOCKER_NS)/fabric-nodeenv:$(TWO_DIGIT_VERSION)
runtime: $(DOCKER_NS)/fabric-nodeenv:2.5

# List of directories to treat as external builders and launchers for
# chaincode. The external builder detection processing will iterate over the
Expand Down
12 changes: 7 additions & 5 deletions sampleconfig/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,8 @@ chaincode:
path:
name:

# Generic builder environment, suitable for most chaincode types
# Generic builder image with Go pre-installed.
# TWO_DIGIT_VERSION represents Fabric major.minor version.
builder: $(DOCKER_NS)/fabric-ccenv:$(TWO_DIGIT_VERSION)

# Enables/disables force pulling of the base docker images (listed below)
Expand All @@ -591,22 +592,23 @@ chaincode:
pull: false

golang:
# golang will never need more than baseos
# Compiled Go chaincodes will be copied to the fabric-baseos runtime image.
# TWO_DIGIT_VERSION represents Fabric major.minor version.
runtime: $(DOCKER_NS)/fabric-baseos:$(TWO_DIGIT_VERSION)

# whether or not golang chaincode should be linked dynamically
dynamicLink: false

java:
# This is an image based on java:openjdk-8 with addition compiler
# This is an image based on eclipse temurin with addition compiler
# tools added for java shim layer packaging.
# This image is packed with shim layer libraries that are necessary
# for Java chaincode runtime.
runtime: $(DOCKER_NS)/fabric-javaenv:$(TWO_DIGIT_VERSION)
runtime: $(DOCKER_NS)/fabric-javaenv:2.5

node:
# This is an image based on node:$(NODE_VER)-alpine
runtime: $(DOCKER_NS)/fabric-nodeenv:$(TWO_DIGIT_VERSION)
runtime: $(DOCKER_NS)/fabric-nodeenv:2.5

# List of directories to treat as external builders and launchers for
# chaincode. The external builder detection processing will iterate over the
Expand Down
2 changes: 1 addition & 1 deletion scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dockerPull() {
#three_digit_image_tag is passed in, e.g. "1.4.7"
three_digit_image_tag=$1
shift
#two_digit_image_tag is derived, e.g. "1.4", especially useful as a local tag for two digit references to most recent baseos, ccenv, javaenv, nodeenv patch releases
#two_digit_image_tag is derived, e.g. "1.4", especially useful as a local tag for two digit references
two_digit_image_tag=$(echo "$three_digit_image_tag" | cut -d'.' -f1,2)
while [[ $# -gt 0 ]]
do
Expand Down
2 changes: 1 addition & 1 deletion scripts/install-fabric.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ singleImagePull() {
#three_digit_image_tag is passed in, e.g. "1.4.7"
three_digit_image_tag=$1
shift
#two_digit_image_tag is derived, e.g. "1.4", especially useful as a local tag for two digit references to most recent baseos, ccenv, javaenv, nodeenv patch releases
#two_digit_image_tag is derived, e.g. "1.4", especially useful as a local tag for two digit references
two_digit_image_tag=$(echo "$three_digit_image_tag" | cut -d'.' -f1,2)
while [[ $# -gt 0 ]]
do
Expand Down