Blockchain Hyperledger Fabric dev env setup - blockchain

I am very close to set up dev environment for hyperledger fabric and following this link
https://github.com/IBM-Blockchain/learn-chaincode/blob/master/docs/setup.md
When I run this command git clone -b v0.6 http://gerrit.hyperledger.org/r/fabric
and run go build. I get following error:
can't load package: package github.com/hyperledger/fabric: no
buildable Go source files in
/Users/test/work/src/github.com/hyperledger/fabric
However when I run step 4 from the link, the build success.
cd $GOPATH/src/github.com//learn-chaincode/start
go build ./
Here build is not succeed only for http://gerrit.hyperledger.org/r/fabric.
Any thoughts?
Please suggest!

I think the manual is not precisely written here. You are not supposed to run go build . on the cloned fabric repository. The manual just states here, that if you are getting build errors later, the clone into your go sources did not work. I is not asking you to build the fabric repository. If your build command is executed in step 4, everything should be set up correctly.

Assuming you are setting up the dev environment you want to build things for that after cloning the repo. This is done with make, thus e.g. make all to build and test all.
To build chaincode later on you use go build in the folder where you have the chaincode source file.

Related

Expo eas android build error: cannot copy 'C:\Users\xxx' to a subdirectory or itself,

I get this error when i use this line:
eas build -p android
I am trying to build the project but it gives this error:
Error: Cannot copy 'C:\Users\xx' to a subdirectory of itself,
'C:\Users\xx\AppData\Local\Temp\eas-cli-nodejs\5897d1cd-52ae-4c3c-a5c4-577
69487c9f8-shallow-clone'
This answer may be late but I came across this in assisting a fellow dev and think I can answer this for other devs in the future at least.
So, EAS has integration capabilities with git. What that means is that for instance, when running a build command, EAS uploads a shallow clone of your repository to EAS Build. This error will come up when you do not have git setup on your machine or your project has not remote base that you're working off of.
There is a solution to disable the git integration ability for your project if you so wish. That is setting the environment variable EAS_NO_VCS=1 So when running your build command, do this instead:
Mac: EAS_NO_VCS=1 eas <command>
Windows: npx cross-env EAS_NO_VCS=1 eas <command>
Reference: https://github.com/expo/fyi/blob/main/eas-vcs-workflow.md
Hope this helps.

VSTS: Store zip files from build for usage across builds

I am working on a series of builds. There are intermediate files created from few builds and other builds use those files in their build process. The build processes are scripted in PowerShell scripts. We are using private agents as there are custom dependencies.
Currently, we are using a folder on the private agent to store the intermediate outcomes that we refer to in the dependent builds.
We wish to keep it on VSTS (might be as a zip file) and download and unzip to a folder when we build the dependent component.
We see nuget etc. to be not fitting to the requirement.
Is there any available option for it?
If you want to store files in VSTS instead of the local agent machine, you can store the files into a separate repo hosted in VSTS.
Such as to store a zip file ($(Build.SourcesDirectory)\my.zip) into VSTS git repo (https://account.visualstudio.com/project/_git/filestore), you can execute below PowerShell script during build:
git clone https://Personal%20Access%20Token:PAT#account.visualstudio.com/project/_git/filestore
Copy-Item $(Build.SourcesDirectory)\my.zip $(Build.SourcesDirectory)\filestore
cd filestore
git add .
git commit -m 'add zip file'
git push oirgin master
After executing the build, the zip file my.zip stores in the VSTS git repo.
I finally published the outcome from the first build as part of the build artefact and then used in other (dependent) builds. It was nice to do.
Also, found it equivalent to having it on NuGet. Plan to move to Nuget later.

Can't run 'ng' from VSTS agent

I'm trying to run unit tests against our AngularCLI project using our hosted VSTS build agents however it keeps running into trouble when it tries to run 'ng test'.
To resolve this I have tried to make the agent use the ng tool directly by providing the path to the tool. This hasn't worked as it looks like it's trying to run 'ng test' where the tool is rather than in the specified current working directory:
I've also tried to add it as an environment variable in Windows (we're using Windows Server 2012 to host the VSTS agent) and setting the tool in the VSTS agent as just ng however it doesn't appear to be finding the ng tool:
How can I get the VSTS agent to make use of the ng tool to run tests? We have got #angular/cli installed on the server hosting the agent.
The thing is that you won't get angular cli installed on VSTS globally as its build server is not supporting that. But the good thing you not even need cli globally installed on your agent.
All you need is npm run ng build -- prod - this way it will always run the local version. Also this way you won't need to take care of updating your global package at all.
Use npm run ng test to run tests, npm run ng e2e to run protractor. If you need to pass any more params to any of these just use --
As mentioned by #Kuncevic, to use the Angular CLI without installing it globally, you will need to use the npm run command.
To run an Angular build using Azure Devops:
Add an npm task to install dependencies (choose install for the command)
Add another npm task, but choose custom for the command. Then add your command and arguments:
run ng -- build --output-path=dist --configuration=prod
Note how npm is not a part of the command and arguments since this will be provided by the task. Also note how -- separates the command to be run and the arguments to be passed to the command.

build wso2 apim 1.10.0 from source

So far I installed deployment version of wso2 AM. Now I would like to build it from source and try running it instead of the binaries I downloaded from the site.
Based on WSO2 documentation, I understand the steps are:
1) Download the carbon kernel source:
git clone -b 4.4.x https://github.com/wso2/carbon-kernel.git
2) Download the APIM source:
git clone https://github.com/wso2/product-apim
3) Build APIM from source
cd <SOURCE-DIR>\product-apim
mvn clean install
Are these steps sufficient, or am I missing something?
Should I build carbon-kernel in addition to building apim-manager?
On previous stackoverflow question, I read that carbon-kernel is not really necessary, and instead i should download and build carbon-apimgmt. Is this correct?
After I build the sources, how do I "package" all the compiled binaries along with all other necessary artifacts, in order to form an equivalent package to the wso2am-1.10.0.zip which I download from the site? Or is there another way to install and run the built code?
Github projects related to API manger can be found in following locations
apimgt component repo:
https://github.com/wso2/carbon-apimgt
This repository contains org.wso2.carbon.apimgt component related source code.
product repo:
https://github.com/wso2/product-apim
This repository contains all the resources needed to build the product package and intergration tests for the product.
master branch of these repositories are used for current development. (if you open parent pom.xml file you would find SNAPSHOT versions). If you build the default branches you would build the current development version of the api manager. (at this time, 1.10.1-SNAPSHOT). To build already released product you need to build released tag.
Steps to Build API manager 1.10.0
clone product:
git clone https://github.com/wso2/product-apim
Checkout release tag v1.10.0:
git checkout v1.10.0
Build the product:
mvn clean install (or mvn clean install -Dmaven.test.skip=true to skip integration tests)
get the product from
product-apim\modules\distribution\product\target
You do not have to build the 'carbon-apimgt' repository because the component build using that is already released and can be found in the nexus repo.
If you want to build the component (say need to provide a fix for a bug) build the 'v5.0.3' tag from the 'carbon-apimgt' repo.
git clone https://github.com/wso2/product-apim
git checkout v5.0.3
I'm posting the steps I did:
git clone https://github.com/wso2/carbon-appmgt
git clone https://github.com/wso2/product-apim
cd <SRC>/carbon-appmgt
mvn clean install
cd <SRC>/product-apim
mvn clean install
The ZIP file was found in
<SRC>\product-apim\modules\distribution\product\target
It is similar to the ZIP file that you download from the site.

maven downloading file on every run 'install' target called

I am using appfuse-spring 2.2.snapshot artifact in my project. I am using maven is 3 .
When I run maven target 'install' every time download the same jar and dependency file.
How can I avoid to download the same files again and again.
for example
Downloading: http://oss.sonatype.org/content/repositories/appfuse-snapshots/org/appfuse/appfuse-web/2.2.2-SNAPSHOT/maven-metadata.xml
I don't want to download the jar file again.
Thanks in advance.
Why it's will download again and again? If it's always downloading maybe something is wrong because once the library is in your local repository it shouldn't need to download anything unless a dependency changes.
If you want to disable the download, use -o (offline) option in your mvn command:
mvn install -o
More: Maven Command Line Options
The problem is that you download the snapshot. Maven check a snapshot dependency each build (and if require downloads it).
Please avoid depend of snapshots.
Please find your deps in the releases repository:
https://oss.sonatype.org/content/repositories/appfuse-releases/
Old question but probably the solution would have been to check the "updatePolicy" for the repo, its possibly set to "always".