Skip to content

Gitian builder#2396

Closed
micaelmalta wants to merge 2 commits intodogecoin:1.14.6-devfrom
micaelmalta:1.14.4-dev-new-gitian
Closed

Gitian builder#2396
micaelmalta wants to merge 2 commits intodogecoin:1.14.6-devfrom
micaelmalta:1.14.4-dev-new-gitian

Conversation

@micaelmalta
Copy link
Copy Markdown
Contributor

No description provided.

@micaelmalta micaelmalta force-pushed the 1.14.4-dev-new-gitian branch from bfeb005 to d4b45c1 Compare July 14, 2021 05:13
@micaelmalta
Copy link
Copy Markdown
Contributor Author

Ping @patricklodder @AbcSxyZ 🚀

Copy link
Copy Markdown
Contributor

@AbcSxyZ AbcSxyZ left a comment

Choose a reason for hiding this comment

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

A first review with some fix to do and details to discuss.

In my opinion, I wouldn't add many of those files and keep the following :

  • gitian-build.sh
  • 0001-Docker-apt-cacher.patch (temporary)
  • dependencies.sh (at least his content)
  • (No opinion about cirrus, so maybe)

And remove all other scripts about setups, licensing, readme.

To explain myself about setup script, all those scripts looks overkill, and I would be in favor to replace it by an appropriate documentation.
I understand the desire for automation, but it seems a lot of engineering to set up a couple of dependencies, who require few lines to copy-paste.

A documentation who can be structured like that :

Redirect to docker documentation
+ add an instruction for debian distros to add user in docker group

 + add a single line by os
# Debian based distributions
sudo apt [dep] ..
# Mac
brew [dep] ..
...

It will also reduce content of gitian-build.sh by removing setup instructions, the documentation about the feature.
It may allow us to keep a single script with his documentation. Do you think these scripts are worth it ?

Regarding documentation, I did not review it because I wanted to discuss this setup topic, but at least I think it should be moved under doc instead of contrib, to update gitian-building.md, and maybe some other file like https://github.com/dogecoin/dogecoin/blob/master/contrib/gitian-descriptors/README.md.

Comment thread contrib/gitian-builder/gitian-build.sh Outdated
Comment thread contrib/gitian-builder/gitian-build.sh Outdated
Comment thread contrib/gitian-builder/setup/dependencies.sh
@@ -0,0 +1,103 @@
From f9aa17728860f64e963ee40f9a62e075c7c41a8e Mon Sep 17 00:00:00 2001
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As a reminder, we should create an issue to track evolution of the PR inside the devrandom repo. To remove this fix when the feature is released.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The PR is already created: devrandom/gitian-builder#249

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was more thinking about opening an issue on Dogecoin repository, as a reminder to fix and remove the patch when they include your PR.

I would wait a bit and maybe do this when this PR is merged, they may merge before.

@fmhc
Copy link
Copy Markdown
Contributor

fmhc commented Jul 23, 2021

I am running into issues with following the README on a plain Ubuntu system. I have set up my GPG key on the system, do I need to do anything else? How is the naming of the GPG key affecting the command?
image
It builds everything without significant errors but the generated binaries are not in the dogecoin-binaries/1.14.4-dev/ folder
image

@AbcSxyZ
Copy link
Copy Markdown
Contributor

AbcSxyZ commented Jul 27, 2021

@fmhc
I tried your command, and wasn't able to get binaries from my side too using your command. Seem not working with a build using a commit, but fine with a tag.
This work for me :

./gitian-build.sh --build signer 1.14.3

For the build from a commit, seem to work properly, but maybe binaries are not moved in the appropriate directory ? Wasn't able to find them on the host, I didn't investigate further in the container rn.

@micaelmalta Were you able to build from a commit or didn't try ?

Also, I have been waiting but did not get an answer :) What about my question on install scripts ? Would be great to discuss, to see your pov.

@micaelmalta
Copy link
Copy Markdown
Contributor Author

micaelmalta commented Jul 27, 2021

I am currently working on a test descriptor to check it

@micaelmalta
Copy link
Copy Markdown
Contributor Author

micaelmalta commented Jul 27, 2021

@fmhc @AbcSxyZ I fixed some issues here.

@AbcSxyZ I really think the gitian-builder should be an independent repo from Dogecoin Core ... If we do so, the init scripts make more sense IMO. I remove the init script and moved into a dedicated folder on my repo https://github.com/micaelmalta/gitian-builder-dogecoin

@AbcSxyZ
Copy link
Copy Markdown
Contributor

AbcSxyZ commented Jul 28, 2021

And think it as a standalone script inside the repository ? A script you can just download or copy to run the build.

Thinking quickly about using the current repository, it may be a bit messy do it that way, you thought about it too ? You had "issue" with git right (can't find this discussion again) ? Not sure if we should explore something here.

Personally, I'm really mitigated about using another repository, do not feel it's really needed.

@micaelmalta micaelmalta force-pushed the 1.14.4-dev-new-gitian branch from 4a9f6f8 to 4797b01 Compare July 28, 2021 19:46
@fmhc
Copy link
Copy Markdown
Contributor

fmhc commented Jul 29, 2021

I was able to successfully build from dogecoin/dogecoin and from my own repo with commit flag, working fine for me!

And think it as a standalone script inside the repository ? A script you can just download or copy to run the build.

Thinking quickly about using the current repository, it may be a bit messy do it that way, you thought about it too ? You had "issue" with git right (can't find this discussion again) ? Not sure if we should explore something here.

Personally, I'm really mitigated about using another repository, do not feel it's really needed.

I thougth having it as a seperate repository would be nice as a single starting point, but this solution also works and i think its a great achievement for the dogecoin-core repo to enable "modern" docker-based development with this. guess its a general question if things should all be in the core or if dogecoin development should spread out over more repositories in the dogecoin project.

In terms of documentation, a hint for = gpg key uid name could be useful to avoid someone spending time gathering that knowledge. I had a GPG key but only with my full name, not a short one, breaking the input argument and then i thought it was the key filename until i digged into the code and @michaelMALTA giving some hints on his repository, thanks for that 🚀

@AbcSxyZ
Copy link
Copy Markdown
Contributor

AbcSxyZ commented Jul 30, 2021

its a general question if things should all be in the core or if dogecoin development should spread out over more repositories

I'm not against using other repos sometime, but not for Gitian from my pov. I wouldn't be in favor of using another repo for a single script, and I think all install scripts are not needed, it's for me a lot of engineering for a couple of dependencies.
Good docs would do the job.

I like automation, but I'm wondering if it's appropriate here :)

@micaelmalta micaelmalta force-pushed the 1.14.4-dev-new-gitian branch from 4797b01 to 79d3959 Compare July 30, 2021 17:16
@micaelmalta
Copy link
Copy Markdown
Contributor Author

In terms of documentation, a hint for = gpg key uid name could be useful to avoid someone spending time gathering that knowledge. I had a GPG key but only with my full name, not a short one, breaking the input argument and then i thought it was the key filename until i digged into the code and @michaelMALTA giving some hints on his repository, thanks for that 🚀

@fmhc I added some documentation for the GNUGPG UID 🚀

@micaelmalta
Copy link
Copy Markdown
Contributor Author

@rnicoll @patricklodder @michilumin What do you think about this? Should we just have a single script in the Dogecoin core repo, or a separate repo?

@patricklodder
Copy link
Copy Markdown
Member

Should we just have a single script in the Dogecoin core repo, or a separate repo?

Scripts that are written for Dogecoin Core and aid the build process should imho go in contrib, together with all the other things that do that (like the scripts you wrote here). Scripts that are maintained outside of Dogecoin Core and are technically an external dependency, should not be maintained inside this repository; example: ltc_scrypt that is required for testing only has an installer script but the code remains external.

This makes sure that the repo stays on-topic and we do not over-burden ourselves with code maintenance from things that can be perfectly managed upstream.

@micaelmalta
Copy link
Copy Markdown
Contributor Author

Should we just have a single script in the Dogecoin core repo, or a separate repo?

Scripts that are written for Dogecoin Core and aid the build process should imho go in contrib, together with all the other things that do that (like the scripts you wrote here). Scripts that are maintained outside of Dogecoin Core and are technically an external dependency, should not be maintained inside this repository; example: ltc_scrypt that is required for testing only has an installer script but the code remains external.

This makes sure that the repo stays on-topic and we do not over-burden ourselves with code maintenance from things that can be perfectly managed upstream.

Thanks @patricklodder ! Should we then consider to move all the scripts from https://github.com/micaelmalta/gitian-builder-dogecoin including the automated init and the CI tests?

@patricklodder
Copy link
Copy Markdown
Member

Should we then consider to move all the scripts from https://github.com/micaelmalta/gitian-builder-dogecoin including the automated init and the CI tests?

Yes, but be careful with secrets... What I'd (ultimately) love to do with those scripts is:

  1. Make a GH Actions (since this is targeting 1.14) script outputting hashes, that triggers on changes to:
    • ./depends
    • ./contrib/gitian-descriptors
    • ./contrib/gitian-builder (this set of scripts)
  2. Any automated initialization should never touch pgp secret keys, so without those, it'd be fine to include. There's a section about external signing in the gitian doc and that should imho be the best practice anyway as this allows for keeping secrets in a protected environment while allowing a build machine to just connect freely and download things. (i.e. from a security p.o.v. there are different requirements to secure pgp secrets vs the gitian builder itself.)

@fmhc
Copy link
Copy Markdown
Contributor

fmhc commented Jul 30, 2021

I think dogecoin should evolve and have a doge core repo for real core reference stuff, as @patricklodder said, and room for some supported / community approved repos in the dogecoin project domain. When will we have 20 signers for a release? We must make the dev community more integrative imho

@patricklodder patricklodder changed the base branch from 1.14.4-dev to 1.14.5-dev August 20, 2021 21:25
@patricklodder patricklodder added this to the 1.14.5 milestone Aug 20, 2021
@micaelmalta micaelmalta force-pushed the 1.14.4-dev-new-gitian branch from dbf1783 to 5beea3a Compare August 21, 2021 04:07
Copy link
Copy Markdown
Member

@patricklodder patricklodder left a comment

Choose a reason for hiding this comment

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

Ran this a couple of times. Besides in-line comments, could you please revert the name change to the signing descriptors? Other than that, works neatly.

Comment on lines +74 to +75
+# DELETE ESM Files: W: Failed to fetch https://esm.ubuntu.com/ubuntu/dists/trusty-infra-security/main/binary-amd64/Packages Received HTTP code 403 from proxy after CONNECT
+RUN [ -f /etc/apt/sources.list.d/*esm*.list ] && rm /etc/apt/sources.list.d/*esm*.list
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be:

  1. A separate .patch file because this is a separate issue (and may or may not be fixed upstream regardless of the apt cache patch)
  2. Conditional to only trigger on trusty because it's simply a fix for ubuntu depreciating the repository but not updating the docker image (see what I did for that earlier this year when we were building 1.14.3 at patricklodder/gitian-builder@de43391). Another image could have a fully functional esm source.

EOF

- docker build --pull -f $OUT.Dockerfile -t $OUT .
+ docker build --network host --pull -f $OUT.Dockerfile -t $OUT .
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why change to host network? (also below in libexec/start-target)

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

MIT License is already listed on the top-level. No need to add it here again. Suggest to remove this file

Comment on lines +1 to +6
<h1 align="center">
Dogecoin Core [DOGE, Ð]
<br/><br/>
<img src="https://static.tumblr.com/ppdj5y9/Ae9mxmxtp/300coin.png" alt="Dogecoin" width="300"/>
</h1>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This feels kind of redundant.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about instructions in https://github.com/dogecoin/dogecoin/blob/master/doc/gitian-building.md ?

Contrib folders have README but there is also some gitian instruction in doc. Those instructions in doc are outdated and do not work anymore. Where gitian instructions should go to avoid duplicate information, following DRY ?

Keep the contrib/gitian-builder README and add a link to it from the doc, maybe near a release process explanation ? And removing https://github.com/dogecoin/dogecoin/tree/master/doc/gitian-building folder with pictures + https://github.com/dogecoin/dogecoin/blob/master/doc/gitian-building.md ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm okay with the readme, just the branding feels redundant.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Where the gitian instructions should go ? Docs or contrib ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Both. This readme should describe this script. The document in doc/ should describe the generic process regardless of this script but can mention and link it.

Comment on lines +34 to +36
2. Generate GPG key

https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/generating-a-new-gpg-key
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This has some implications towards how the pgp key for signing can be stored. Can we make this less intrusive towards security by doing the externally signed flavor?


Dogecoin Core is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/licenses/MIT.

## OTHER CREDITS
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are those credit useful ? Can reduce file content.

Do you mind @patricklodder ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah since the top level is already MIT, I would only add specific license info if there is a need to use a different license than MIT.

Copy link
Copy Markdown
Contributor

@AbcSxyZ AbcSxyZ Sep 5, 2021

Choose a reason for hiding this comment

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

I was speaking about the following credits :

## OTHER CREDITS

https://github.com/patricklodder

https://gist.github.com/patricklodder/88d6c4e3406db840963f85d95ceb44fe

I don't understand what you said about the license, why are you speaking about a different type of license ? No specific ressources in the folder is using another license right ? Couldn't we remove license info too ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry, my bad. Yeah credits can go, license can go.


## TROUBLESHOOT

### DOCKER ERROR
Copy link
Copy Markdown
Contributor

@AbcSxyZ AbcSxyZ Sep 5, 2021

Choose a reason for hiding this comment

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

Do you think it's really useful to add this error ? It's more concerning some docker trouble shoot with rights, something that may be outside the scope here.

We may expect they will google their mistake, I think having documentation to anticipate potential error (at least those who do not concern dogecoin core) may add some unnecessary content.

Imagine we include also the #2337 with a Docker implementation to run nodes, should we add this info there also ?


git fetch origin 9e97a4d5038cd61215f5243a37c06fa1734a276e # LAST VERSION TESTED
git reset --hard FETCH_HEAD
git am < "$dirName"/patches/0001-Docker-apt-cacher.patch
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Using a fresh install, patch fail if git email is not configured using something like git config --global user.email "you@example.com".

echo ""
echo "Compiling ${VERSION} ${descriptor}"
echo ""
./bin/gbuild -j "$proc" -m "$mem" --commit dogecoin="$COMMIT" --url dogecoin="$url" ../gitian-descriptors/gitian-"$descriptor".yml || exit 1
Copy link
Copy Markdown
Contributor

@AbcSxyZ AbcSxyZ Sep 15, 2021

Choose a reason for hiding this comment

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

Don't know what did you do with all of your dependencies scripts, info were probably there, but looks like some are missing now.

Need ruby to run gbuild. Is it missing some prerequisites from devrandom/gitian-builder, maybe only ruby needed here ?

@AbcSxyZ
Copy link
Copy Markdown
Contributor

AbcSxyZ commented Sep 15, 2021

I will try to improve the documentation for this topic in the following days, I'm going back into this PR.

@patricklodder @rnicoll do you think there is still any relevant information from the current gitian build guide ?
Wasn't working at all for me, lot of outdated content/versions, probably you use old environment on releases. For now, could we assume use docker as the default (and lonely) supported method to perform gitian ?
Delete all the current gitian docs and replace it with information related to this PR.

@patricklodder
Copy link
Copy Markdown
Member

For now, could we assume use docker as the default (and lonely) supported method to perform gitian ?

No. Per the compile-time error in depends under gcc 7 that we found in #2501 by comparing docker with lxc output, we absolutely need more than just docker and we need to perform amendments to this script after we merge something.

wget $1 -O $(basename -- $1)
}

function process_file() {
Copy link
Copy Markdown
Contributor

@AbcSxyZ AbcSxyZ Sep 16, 2021

Choose a reason for hiding this comment

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

I just suggest some improvement, I think the process_file can be simplified in multiple ways, to finally keep a single function. Remove some extra content (like check_file echos), and make it easier to read by reducing the number of command substitution.

It's to keep it here as reminder, I may suggest a PR soon, but by trying to simplify the code of this file I ended up with :

function process_file() {
    local filename=$(basename $1)
    
    # Download file if not available
    if [[ ! -f $filename ]]; then
        wget $1
    fi

    # Verify file signature
    echo "$2 $filename" | sha256sum -c --status

    if [ $? != 0 ]; then
        echo "$(basename $0): Signature for $filename don't match."
        exit 1
    fi
}

By using something similar, the entire behavior in one function, don't you think we can add this to gitian-build.sh to keep a single file ?

P.S.: If a file is already available but do not match sha256sum, I avoid overwriting the file like it was in your code. Design choice, avoid re-downloading.

@AbcSxyZ
Copy link
Copy Markdown
Contributor

AbcSxyZ commented Sep 16, 2021

For now, could we assume use docker as the default (and lonely) supported method to perform gitian ?

No.

So the script should be able to run on docker, lxc and kvm ? The suggested script is entirely removing kvm & lxc reference.

@patricklodder
Copy link
Copy Markdown
Member

So the script should be able to run on docker, lxc and kvm ? The suggested script is entirely removing kvm & lxc reference.

Also VMWare/vagrant is not implemented. But I don't mind if in an initial iteration this script just does Docker - just have to undelete the original script.

But we cannot spot supply chain attacks on Docker (or docker images) if only we compare docker-built hashes against each other and never check against anything else. I chose to use Docker exactly because @rnicoll used to use lxc. If he would now switch to Docker, it means I'll have to switch to one of the others (most likely lxc, because that is the least obtrusive to use.)

@AbcSxyZ
Copy link
Copy Markdown
Contributor

AbcSxyZ commented Sep 19, 2021

New PR built on top of this one, see #2579.

Fix issues of Dogecoin folder getting old files and never cleaned
@micaelmalta micaelmalta force-pushed the 1.14.4-dev-new-gitian branch from 5beea3a to 70f3a64 Compare October 16, 2021 18:12
@patricklodder patricklodder removed this from the 1.14.5 milestone Nov 1, 2021
@patricklodder patricklodder changed the base branch from 1.14.5-dev to 1.14.6-dev November 8, 2021 14:16
patricklodder pushed a commit to patricklodder/dogecoin that referenced this pull request May 28, 2022
- undelete & update previous script
- update description + comments
- reorganize help menu of gitian-build.sh
- rewrite option explanation for --sign with gpg
- remove docker reference from setup option
- update documentation
- re-enable external signing
- re-enable apt cacher and use apt cacher by default
- switch from trusty to bionic
- remove gpg key verification + display message for
  detached signature
- revert script name change for sign descriptors
- list pgp in required dependencies + remove apache
@patricklodder
Copy link
Copy Markdown
Member

Merged with #2973! Many thanks! ❤️

edtubbs pushed a commit to edtubbs/dogecoin that referenced this pull request Jun 30, 2022
- undelete & update previous script
- update description + comments
- reorganize help menu of gitian-build.sh
- rewrite option explanation for --sign with gpg
- remove docker reference from setup option
- update documentation
- re-enable external signing
- re-enable apt cacher and use apt cacher by default
- switch from trusty to bionic
- remove gpg key verification + display message for
  detached signature
- revert script name change for sign descriptors
- list pgp in required dependencies + remove apache
mydogecoin-official pushed a commit to mydogecoin-project/mydogecoin that referenced this pull request Oct 12, 2025
- undelete & update previous script
- update description + comments
- reorganize help menu of gitian-build.sh
- rewrite option explanation for --sign with gpg
- remove docker reference from setup option
- update documentation
- re-enable external signing
- re-enable apt cacher and use apt cacher by default
- switch from trusty to bionic
- remove gpg key verification + display message for
  detached signature
- revert script name change for sign descriptors
- list pgp in required dependencies + remove apache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants