Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Kneubuhl <[email protected]>
  • Loading branch information
jkneubuh committed Jun 9, 2022
0 parents commit 9a5f3a2
Show file tree
Hide file tree
Showing 807 changed files with 163,902 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/image-build-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build Operator image

on:
pull_request:
branches: [main]

jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Build
run: |
scripts/install-tools.sh
make image
20 changes: 20 additions & 0 deletions .github/workflows/image-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build Operator image

on:
push:
branches: [main]

jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Build
run: |
scripts/install-tools.sh
make image
- name: Push
run: |
docker login ghcr.io -u $GITHUB_ACTOR -p ${{ secrets.CR_TOKEN }}
make image-push image-push-latest
81 changes: 81 additions & 0 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#
# Copyright contributors to the Hyperledger Fabric Operator project
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Integration Test

on:
push:
branches: [main]
pull_request:
branches: [main]

env:
KUBECONFIG_PATH: /tmp/kubeconfig.yaml
OPERATOR_NAMESPACE: inttest
DOCKERCONFIGJSON: ${{ secrets.DOCKERCONFIGJSON }}

jobs:
suite:
runs-on: ubuntu-latest

strategy:
matrix:
suite:
- ca
- peer
- orderer
- console
# - init
# - migration
# - e2ev2
# - actions/ca
# - actions/orderer
# - actions/peer
# - autorenew
# - cclauncher
# - restartmgr
# - operatorrestart

steps:
- uses: actions/checkout@v3

- name: Set up go
uses: actions/setup-go@v3
with:
go-version: "1.17.9"

- name: Set up ginkgo
run: |
go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega/...
- name: Set up KIND k8s cluster
run: |
make kind
kubectl config view --raw > /tmp/kubeconfig.yaml
- name: Install Fabric CRDs
run: |
kubectl kustomize config/crd | kubectl apply -f -
- name: Run ${{ matrix.suite }} integration tests
run: make integration-tests
# run: |
# sleep 360 && kubectl --kubeconfig $KUBECONFIG_PATH describe pods --all-namespaces &
# make integration-tests
env:
INT_TEST_NAME: ${{ matrix.suite }}
43 changes: 43 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Copyright contributors to the Hyperledger Fabric Operator project
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: unit-tests

on:
# TODO: uncomment this when moved to hyperledger-labs repo
# push:
# branches: [main]
pull_request:
branches: [main]

jobs:
make-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up go
uses: actions/setup-go@v3
with:
go-version: "1.17.9"
- name: license header checks
run: scripts/check-license.sh
# TODO: run in hyperledger-labs
# - name: gosec
# run: scripts/go-sec.sh
- name: run tests
run: make test
95 changes: 95 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Temporary Build Files
build/_output
build/_test
# Created by https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
projectile-bookmarks.eld
# directory configuration
.dir-locals.el
# saveplace
places
# url cache
url/cache/
# cedet
ede-projects.el
# smex
smex-items
# company-statistics
company-statistics-cache.el
# anaconda-mode
anaconda-mode/
### Go ###
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, build with 'go test -c'
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
### Vim ###
# swap
.sw[a-p]
.*.sw[a-p]
# session
Session.vim
# temporary
.netrwhist
# auto-generated tag files
tags
### VisualStudioCode ###
.vscode/*
.history
# End of https://www.gitignore.io/api/go,vim,emacs,visualstudiocode
testdata/kubeconfig.yml
testdata/deploy/test_operator.yaml
testdata/deploy/test_role_binding.yaml
testdata/tlsCert.pem
build/_output
bin
vendor
golang_copyright.txt
shell_copyright.txt
kubeconfig.yml
.env
*.bak
temp.*
integration/*/config
integration/actions/*/config
scripts/images/clusterserviceversion.yaml
.vscode
.idea/
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ARG ARCH
ARG REGISTRY
ARG GO_VER

########## Build operator binary ##########
FROM registry.access.redhat.com/ubi8/go-toolset:$GO_VER as builder
COPY . /go/src/github.com/IBM-Blockchain/fabric-operator
WORKDIR /go/src/github.com/IBM-Blockchain/fabric-operator
RUN GOOS=linux GOARCH=$(go env GOARCH) CGO_ENABLED=1 go build -mod=vendor -tags "pkcs11" -gcflags all=-trimpath=${GOPATH} -asmflags all=-trimpath=${GOPATH} -o /tmp/build/_output/bin/ibp-operator

########## Final Image ##########
FROM registry.access.redhat.com/ubi8/ubi-minimal

ENV OPERATOR=/usr/local/bin/ibp-operator

COPY --from=builder /tmp/build/_output/bin/ibp-operator ${OPERATOR}
COPY build/ /usr/local/bin
COPY definitions /definitions
COPY config/crd/bases /deploy/crds
COPY defaultconfig /defaultconfig
COPY docker-entrypoint.sh .
RUN microdnf update \
&& microdnf install -y \
shadow-utils \
iputils \
&& groupadd -g 7051 fabric-user \
&& useradd -u 7051 -g fabric-user -s /bin/bash fabric-user \
&& mkdir /licenses \
&& microdnf remove shadow-utils \
&& microdnf clean all \
&& chown -R fabric-user:fabric-user licenses \
&& /usr/local/bin/user_setup

USER fabric-user
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/local/bin/entrypoint"]
Loading

0 comments on commit 9a5f3a2

Please sign in to comment.