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

[Fix]: Remove --platform flag from Docker commands in fabric_provider.go #323

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 0 additions & 13 deletions internal/blockchain/fabric/fabric_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ func (p *FabricProvider) FirstTimeSetup() error {
// Run cryptogen to generate MSP
if err := docker.RunDockerCommand(p.ctx, blockchainDirectory,
"run",
"--platform", getDockerPlatform(),
"--rm",
"-v", fmt.Sprintf("%s:/etc/template.yml", cryptogenYamlPath),
"-v", fmt.Sprintf("%s:/etc/firefly", volumeName),
Expand All @@ -124,7 +123,6 @@ func (p *FabricProvider) FirstTimeSetup() error {
// Generate genesis block
if err := docker.RunDockerCommand(p.ctx, blockchainDirectory,
"run",
"--platform", getDockerPlatform(),
"--rm",
"-v", fmt.Sprintf("%s:/etc/firefly", volumeName),
"-v", fmt.Sprintf("%s:/etc/hyperledger/fabric/configtx.yaml", path.Join(blockchainDirectory, "configtx.yaml")),
Expand Down Expand Up @@ -335,7 +333,6 @@ func (p *FabricProvider) createChannel() error {
volumeName := fmt.Sprintf("%s_firefly_fabric", p.stack.Name)
return docker.RunDockerCommand(p.ctx, stackDir,
"run",
"--platform", getDockerPlatform(),
"--rm",
fmt.Sprintf("--network=%s_default", p.stack.Name),
"-v", fmt.Sprintf("%s:/etc/firefly", volumeName),
Expand All @@ -356,7 +353,6 @@ func (p *FabricProvider) joinChannel() error {
volumeName := fmt.Sprintf("%s_firefly_fabric", p.stack.Name)
return docker.RunDockerCommand(p.ctx, stackDir,
"run",
"--platform", getDockerPlatform(),
"--rm",
fmt.Sprintf("--network=%s_default", p.stack.Name),
"-v", fmt.Sprintf("%s:/etc/firefly", volumeName),
Expand Down Expand Up @@ -405,7 +401,6 @@ func (p *FabricProvider) installChaincode(packageFilename string) error {
volumeName := fmt.Sprintf("%s_firefly_fabric", p.stack.Name)
return docker.RunDockerCommand(p.ctx, contractsDir,
"run",
"--platform", getDockerPlatform(),
"--rm",
fmt.Sprintf("--network=%s_default", p.stack.Name),
"-e", "CORE_PEER_ADDRESS=fabric_peer:7051",
Expand All @@ -425,7 +420,6 @@ func (p *FabricProvider) queryInstalled() (*QueryInstalledResponse, error) {
volumeName := fmt.Sprintf("%s_firefly_fabric", p.stack.Name)
str, err := docker.RunDockerCommandBuffered(p.ctx, p.stack.RuntimeDir,
"run",
"--platform", getDockerPlatform(),
"--rm",
fmt.Sprintf("--network=%s_default", p.stack.Name),
"-e", "CORE_PEER_ADDRESS=fabric_peer:7051",
Expand Down Expand Up @@ -454,7 +448,6 @@ func (p *FabricProvider) approveChaincode(channel, chaincode, version, packageID
volumeName := fmt.Sprintf("%s_firefly_fabric", p.stack.Name)
return docker.RunDockerCommand(p.ctx, p.stack.RuntimeDir,
"run",
"--platform", getDockerPlatform(),
"--rm",
fmt.Sprintf("--network=%s_default", p.stack.Name),
"-e", "CORE_PEER_ADDRESS=fabric_peer:7051",
Expand Down Expand Up @@ -482,7 +475,6 @@ func (p *FabricProvider) commitChaincode(channel, chaincode, version string) err
volumeName := fmt.Sprintf("%s_firefly_fabric", p.stack.Name)
return docker.RunDockerCommand(p.ctx, p.stack.RuntimeDir,
"run",
"--platform", getDockerPlatform(),
"--rm",
fmt.Sprintf("--network=%s_default", p.stack.Name),
"-e", "CORE_PEER_ADDRESS=fabric_peer:7051",
Expand Down Expand Up @@ -617,11 +609,6 @@ func (p *FabricProvider) CreateAccount(args []string) (interface{}, error) {
}, nil
}

// As of release 2.4, Hyperledger Fabric only publishes amd64 images, but no arm64 specific images
func getDockerPlatform() string {
return "linux/amd64"
}

func (p *FabricProvider) ParseAccount(account interface{}) interface{} {
accountMap := account.(map[string]interface{})
return &Account{
Expand Down
7 changes: 0 additions & 7 deletions internal/blockchain/fabric/fabric_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,6 @@ func TestGetConnectorURL(t *testing.T) {

}

func TestGetDockerPlatform(t *testing.T) {
expectedString := "linux/amd64"
String := getDockerPlatform()
assert.Equal(t, expectedString, String)
}

func TestGetContracts(t *testing.T) {
FilePath := t.TempDir()
testContractFile := filepath.Join(FilePath, "/test_contracts.json")
Expand Down Expand Up @@ -410,4 +404,3 @@ func TestRegisterIdentity(t *testing.T) {
})

}

Loading