diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..9e4b0ae3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + ci: + name: CI + runs-on: ubuntu-24.04 + timeout-minutes: 45 + + steps: + - name: Check out repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Set up Go + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version: 1.17.13 + cache: true + + - name: Lint + run: make lint + + - name: Run unit tests + run: make test-unit + + - name: Validate release artifacts + run: make validate-release RELEASE_VERSION=1000.0.0 diff --git a/.whitesource b/.whitesource new file mode 100644 index 00000000..58c90b53 --- /dev/null +++ b/.whitesource @@ -0,0 +1,3 @@ +{ + "settingsInheritedFrom": "ibm-mend-config/mend-config@main" +} diff --git a/Makefile b/Makefile index 3883617b..c1f8015d 100644 --- a/Makefile +++ b/Makefile @@ -9,19 +9,15 @@ KUBEVAL_KUBE_VERSION=1.18.1 # Set PATH to pick up cached tools. The additional 'sed' is required for cross-platform support of quoting the args to 'env' SHELL := /usr/bin/env PATH=$(shell echo ${PWD}/cache/bin:${KUBEBUILDER_ASSETS}:${PATH} | sed 's/ /\\ /g') bash -# Version to create release. Value is set in .travis.yml's release job +# Version to create release. Value is set by the release job RELEASE_VERSION ?= 0.0.0 # Image URL to use all building/pushing image targets IMG ?= cloudoperators/ibmcloud-operator:${RELEASE_VERSION} # Produce CRDs that work back to Kubernetes 1.11 (no version conversion) CRD_OPTIONS ?= "crd" -# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) -ifeq (,$(shell go env GOBIN)) -GOBIN=$(shell go env GOPATH)/bin -else -GOBIN=$(shell go env GOBIN) -endif +# Use the configured GOBIN, falling back to GOPATH/bin. +GOBIN := $(or $(shell go env GOBIN),$(shell go env GOPATH)/bin) .PHONY: all all: manager @@ -140,7 +136,6 @@ lint: lint-deps golangci-lint run gosec -conf .gosec.json ./... find . -name '*.*sh' | xargs shellcheck --color - go list -json -m all | docker run --rm -i sonatypecommunity/nancy:latest sleuth .PHONY: lint-fix lint-fix: lint-deps diff --git a/README.md b/README.md index 57c03287..5dfd6923 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.com/IBM/cloud-operators.svg?branch=master)](https://travis-ci.com/IBM/cloud-operators) +[![CI](https://github.com/IBM/cloud-operators/actions/workflows/ci.yml/badge.svg)](https://github.com/IBM/cloud-operators/actions/workflows/ci.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/IBM/cloud-operators)](https://goreportcard.com/report/github.com/IBM/cloud-operators) [![Coverage Status](https://coveralls.io/repos/github/IBM/cloud-operators/badge.svg)](https://coveralls.io/github/IBM/cloud-operators) ![Docker Pulls](https://img.shields.io/docker/pulls/cloudoperators/ibmcloud-operator) diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 95c23ca9..03d6cba3 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -1,8 +1,8 @@ resources: -- manager.yaml + - manager.yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: -- name: controller - newName: cloudoperators/ibmcloud-operator - newTag: 1.0.0 + - name: controller + newName: cloudoperators/ibmcloud-operator + newTag: 1.0.0