Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/postcss-8.4.31
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
  • Loading branch information
dzikowski committed Sep 9, 2024
2 parents 36552bf + b84b8d9 commit e603648
Show file tree
Hide file tree
Showing 69 changed files with 21,833 additions and 42,018 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish-docker-on-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish on merge to main

on:
push:
branches:
- main

env:
IMAGE_NAME: softwaremill/fablo

jobs:
publish-docker:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build Fablo
run: |
shellcheck --version
yamllint -v
npm install
./fablo-build.sh
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish Docker image
run: |
FABLO_VERSION=$(jq -r '.version' <"$GITHUB_WORKSPACE/package.json")
docker push softwaremill/fablo:"$FABLO_VERSION"
60 changes: 60 additions & 0 deletions .github/workflows/release-on-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release on tag

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set version from tag and update tag
run: |
TAG=$(git describe --tags --abbrev=0)
VERSION=${TAG:1}
echo "TAG: $TAG"
echo "VERSION: $VERSION"
./bump_version.sh set "$VERSION"
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -a -m "Set version from tag: $TAG"
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
- name: Build Fablo
run: |
shellcheck --version
yamllint -v
npm install
./fablo-build.sh
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish Docker image
run: |
FABLO_VERSION=$(jq -r '.version' <"$GITHUB_WORKSPACE/package.json")
docker push softwaremill/fablo:"$FABLO_VERSION"
- name: Create GitHub Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
docs/schema.json
fablo.sh
- name: Set next development version
run: |
./bump_version.sh unstable
git commit -a -m "Set new development version: $NEW_VERSION"
git push origin HEAD
107 changes: 54 additions & 53 deletions .github/workflows/test-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,60 +39,61 @@ jobs:
- name: Lint
run: npm run lint && ./lint.sh
test-k8:
needs: test-main
runs-on: ubuntu-latest
timeout-minutes: 30
steps:

- name: Check out repository code
uses: actions/checkout@v2

- name: install k8, hlf plugin and helm
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.14.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind create cluster --wait 5m
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
set -x; cd "$(mktemp -d)" &&
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
kubectl krew install hlf
if [ -f "~/.bashrc" ]; then
echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
fi
if [ -f "~/.zshrc" ]; then
echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
fi
helm repo add kfs "https://kfsoftware.github.io/hlf-helm-charts" --force-update
helm install hlf-operator --version=1.8.0 kfs/hlf-operator
- name: Build Fablo
run: |
shellcheck --version && \
yamllint -v && \
npm install && \
npm run build && \
./fablo-build.sh
- name: fablo k8 tests
run: |
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
e2e-network/k8s/test-01-simple-k8s.sh
# test-k8:
# needs: test-main
# runs-on: ubuntu-latest
# timeout-minutes: 30
# steps:
#
# - name: Check out repository code
# uses: actions/checkout@v2
#
# - name: install k8, hlf plugin and helm
# run: |
# curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.14.0/kind-linux-amd64
# chmod +x ./kind
# sudo mv ./kind /usr/local/bin/kind
# kind create cluster --wait 5m
# curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
# chmod 700 get_helm.sh
# ./get_helm.sh
# curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
# chmod +x kubectl
# sudo mv ./kubectl /usr/local/bin/kubectl
# set -x; cd "$(mktemp -d)" &&
# OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
# ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
# KREW="krew-${OS}_${ARCH}" &&
# curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
# tar zxvf "${KREW}.tar.gz" &&
# ./"${KREW}" install krew
# export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
# kubectl krew install hlf
#
# if [ -f "~/.bashrc" ]; then
# echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
# fi
#
# if [ -f "~/.zshrc" ]; then
# echo 'export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
# fi
#
# helm repo add kfs "https://kfsoftware.github.io/hlf-helm-charts" --force-update
# helm install hlf-operator --version=1.8.0 kfs/hlf-operator
#
# - name: Build Fablo
# run: |
# shellcheck --version && \
# yamllint -v && \
# npm install && \
# npm run build && \
# ./fablo-build.sh
#
# - name: fablo k8 tests
# run: |
# export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
# e2e-network/k8s/test-01-simple-k8s.sh

test-02-raft:
needs: test-main
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
e2e/__tmp__
e2e-network/*.logs
e2e-network/*.tmpdir
e2e-network/docker/*.logs
e2e-network/docker/*.tmpdir
fablo-target
generators
node_modules
Expand Down
35 changes: 35 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Fablo architecture

Fablo is a tool that allows to setup a running Hyperledger Fabric network on the basis of a config file.

The main flow of the application is presented in the diagram below (for instance for the `up` command):

```mermaid
sequenceDiagram
actor User
User ->> fablo.sh: Call `up` command
fablo.sh ->> fablo-target: Verify if network files<br/>are generated
alt no network files
fablo.sh ->> Fablo Docker: Generate network files
Fablo Docker ->> fablo-target: Generate network files<br>from `fablo-config.json`<br>and templates (Yeoman)
end
fablo.sh ->> fablo-target: Call `up` command
```

There are three important layers in this flow:

1. `fablo.sh` - this is our CLI. It accepts user commands, does some validation, and forwards them either to Fablo Docker container or generated network scripts in `fablo-target` directory.
2. Fablo Docker - is a Docker image that contains templates for generating the network files and Yeoman. When Fablo Docker is running, it has mounted `fablo-config.json` file from host and `fablo-target` directory.
3. `fablo-target` is a directory which contains generated Hyperledger Fabric network files (config files, helper scripts, temporary network files).

Notable files and directories:

* `./src` - source code for Yeoman generators, containing subdirectories for given commands and EJS template files.
* `./fablo.sh` - Fablo CLI script.
* `./Dockerfile`, `./docker-entrypoint.sh`, `fablo-build.sh` - files that define and are used to build the Fablo Docker image.
* `e2e-network` - directory that contains integration tests written in Bash scripts. Their goal is to setup sample networks with Fablo and verify them.
* `e2e` - directory that contains integration tests for generating network target files. Tey are mostly Jest snapshot tests.
* `samples` - directory with sample Fablo config JSON and YAML files.

See also [Contributing Guidelines](CONTRIBUTING.md), where you can find some more instructions how to run Fablo from source code and useful hints what needs to be done while working with the code.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
## 1.2.0-unstable

### Features
* Initial support for Kubernetes
* Basic support for `chaincode invoke` command
* Support for `chaincode invoke` command (tls and non-tls)
* Support for `chaincodes list` command (tls and non-tls)

### Fixes
* Remove unsupported test library and dependencies
* Updated Node.js version from 12 to 16 in chaincode

## 1.2.0
### Features
* Initial Kubernetes support [#351](https://github.com/hyperledger-labs/fablo/issues/351)
(not yet so elastic like Fablo in terms of network topology, but ready for first views and comments)

### Chore & Maintenance
* Library updates


## 1.1.0

### Features
Expand Down
56 changes: 56 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Contributing Guidelines

Thank you for considering contributing to our project! We welcome contributions from everyone and appreciate your interest in making our project better.

## Sign off Your Work

The Developer Certificate of Origin (DCO) is a lightweight way for contributors to certify that they wrote or otherwise have the right to submit the code they are contributing to the project. Here is the full text of the [DCO](http://developercertificate.org/). Contributors must sign-off that they adhere to these requirements by adding a `Signed-off-by` line to commit messages.

```text
This is my commit message
Signed-off-by: John Doe <[email protected]>
```

See `git help commit`:

```text
-s, --signoff
Add Signed-off-by line by the committer at the end of the commit log
message. The meaning of a signoff depends on the project, but it typically
certifies that committer has the rights to submit this work under the same
license and agrees to a Developer Certificate of Origin (see
http://developercertificate.org/ for more information).
```

## Getting Started

1. **Fork the repository**: Click the "Fork" button at the top right corner of the repository's page on GitHub.
2. **Clone your fork**: Use `git clone` to clone the repository to your local machine.
3. **Set up remote upstream**: Add the original repository as a remote named "upstream" using `git remote add upstream [original repository URL]`.
4. **Create a new branch**: Use `git checkout -b [branch-name]` to create a new branch for your contribution.

## Making Changes

1. **Make your changes**: Implement the changes or additions you want to make. Please follow any coding standards and guidelines provided in the project.
2. **Test your changes**: Ensure that your changes work as expected and don't introduce any new issues. Depending on the scope of your changes you may rely on our CI pipelines or run the following tests:
- **Unit tests**: Execute unit tests using the provided scripts. Use: `npm run test:unit`.
- **End-to-End (E2E) tests**: Execute E2E tests using the provided scripts. Use: `npm run test:e2e`.
- **Ent-to-End network tests**: Execute relevant shell scripts from `e2e-network` directory with E2E network tests.
3. **Update snapshots**: If you've made changes that affect snapshots (esp. any template changes), update them using `npm run test:e2e-update`.

## ## Running Fablo locally

You may want to verify some changes by running Fablo locally. To do so:
1. Execute `./fablo-build.sh` script to create a Fablo Docker image locally.
2. Use `./fablo.sh` from source root directory to call Fablo commands.

## Submitting Changes

1. **Push your changes**: Once you've made and tested your changes, push them to your forked repository with `git push origin [branch-name]`.
2. **Create a pull request**: Go to the original repository on GitHub and create a pull request from your forked branch to the main branch.
3. **Provide details**: Give your pull request a descriptive title and provide details about the changes you've made.
4. **Review process**: Your pull request will be reviewed by maintainers. Be responsive to any feedback and make necessary changes.

We appreciate your contributions and look forward to working with you!

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-alpine3.14
FROM node:18-alpine3.16

RUN apk add --no-cache sudo shfmt
RUN npm install --global --silent yo
Expand Down
Loading

0 comments on commit e603648

Please sign in to comment.