Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
Publish k8s object changes to iot-core
Browse files Browse the repository at this point in the history
  • Loading branch information
croomes committed Aug 5, 2021
1 parent 3080ef0 commit b103ee9
Show file tree
Hide file tree
Showing 3,424 changed files with 1,213,148 additions and 16 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore all files which are not go type
!**/*.go
!**/*.mod
!**/*.sum
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '26 23 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
27 changes: 27 additions & 0 deletions .github/workflows/develop-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish develop image

on:
push:
branches:
- master

env:
IMG: storageos/portal-manager:develop

jobs:
publish-image:
runs-on: ubuntu-latest
name: Publish container image
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to container registry
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PAT }}
- name: Build container image
run: make docker-build
- name: Push container image
run: make docker-push
34 changes: 34 additions & 0 deletions .github/workflows/redhat-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish image to redhat registry

on:
workflow_dispatch:
# Enable manual trigger of this action.
inputs:
gitRef:
description: The git branch, tag or SHA to build the image from.
required: true
imageTag:
description: Image tag, e.g. `v1.0.0-3`.
required: true

jobs:
publish-image:
runs-on: ubuntu-latest
name: Publish image
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.gitRef }}
- name: Login to container registry
uses: docker/login-action@v1
with:
registry: scan.connect.redhat.com
username: ${{ secrets.RH_USERNAME }}
password: ${{ secrets.RH_TOKEN }}
- name: Set image env var
run: echo "IMG=scan.connect.redhat.com/${{ secrets.OSPID }}/portal-manager:${{ github.event.inputs.imageTag }}" >> $GITHUB_ENV
- name: Build container image
run: make docker-build
- name: Publish image
run: make docker-push
41 changes: 41 additions & 0 deletions .github/workflows/release-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish release image

on:
push:
tags:
- 'v*'

jobs:
publish-image:
runs-on: ubuntu-latest
name: Publish container image
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set image tag env var
# Refer https://stackoverflow.com/a/58178121 for git tag extraction.
run: echo "IMG_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set image env vars
run: |
echo "IMG=storageos/portal-manager:${{ env.IMG_TAG }}" >> $GITHUB_ENV
echo "RH_IMG=scan.connect.redhat.com/${{ secrets.OSPID }}/portal-manager:${{ env.IMG_TAG }}" >> $GITHUB_ENV
- name: Login to docker container registry
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.CR_USER }}
password: ${{ secrets.CR_PAT }}
- name: Build container image
run: make docker-build
- name: Push container image to dockerhub
run: make docker-push
- name: Login to redhat container registry
uses: docker/login-action@v1
with:
registry: scan.connect.redhat.com
username: ${{ secrets.RH_USERNAME }}
password: ${{ secrets.RH_TOKEN }}
- name: Push container image to redhat container registry
run: |
docker tag ${{ env.IMG }} ${{ env.RH_IMG }}
make docker-push IMG=${{ env.RH_IMG }}
41 changes: 41 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test and build image

on: [push, pull_request]

env:
IMG: storageos/portal-manager:develop

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run golangci-lint
uses: golangci/[email protected]
with:
args: --timeout=5m

test-build:
name: Run tests and build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.16.2'
- name: Run go tidy
run: make tidy && git diff --exit-code && test -z "$(git ls-files --exclude-standard --others | tee /dev/fd/2)"
- name: Run go test
run: make test
- name: Run go build
run: make build

build-image:
name: Build container image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build container image
run: make docker-build
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin
testbin/*

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Kubernetes Generated files - skip generated files, except for vendored files

!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
*.swp
*.swo
*~

# certs
ssl/

# Protobuf
pkg/publisher/proto/.protoc
pkg/publisher/proto/protoc
pkg/publisher/proto/protoc-gen-go
pkg/publisher/proto/portal/.build
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Build the manager binary
FROM golang:1.16 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY pkg/ pkg/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532

ENTRYPOINT ["/manager"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 StorageOS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit b103ee9

Please sign in to comment.