Skip to content

Commit

Permalink
Merge pull request #237 from controlplaneio/fix_container_builds
Browse files Browse the repository at this point in the history
  • Loading branch information
06kellyjac authored Sep 21, 2021
2 parents 6fe348d + efd7cea commit 5e9096b
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 172 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/move_issues_to_board.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Move new issues into To do
---
name: Move new issues into To Do

on:
issues:
types: [ opened ]
types: [opened]

jobs:
automate-project-columns:
Expand Down
70 changes: 5 additions & 65 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
name: Release
on:
create:
# https://github.com/actions/runner/issues/1007
push:
tags:
- v*.*.*
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
release:
Expand All @@ -13,7 +15,7 @@ jobs:
uses: actions/[email protected]
id: go
with:
go-version: ^1.15
go-version: ^1.17

- name: Check out code
uses: actions/[email protected]
Expand All @@ -24,65 +26,3 @@ jobs:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release-containers:
name: Build and Push container - ${{ matrix.containers.name }}
runs-on: ubuntu-latest
strategy:
matrix:
containers:
- name: kubesec
file: ./Dockerfile
suffix: ""
- name: kubesec scratch
file: ./Dockerfile.scratch
suffix: -scratch

steps:
- name: Cache container layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}${{ matrix.containers.suffix }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}${{ matrix.containers.suffix }}-buildx-
- name: Generate container tags and labels
id: docker_meta
uses: crazy-max/[email protected]
with:
# images: kubesec/kubesec,ghcr.io/controlplaneio/kubesec
images: kubesec/kubesec
tag-latest: ${{ matrix.containers.suffix == '' }}
tag-semver: |
{{version}}${{ matrix.containers.suffix }}
label-custom: |
org.opencontainers.image.vendor=controlplane
org.opencontainers.image.url=https://kubesec.io/
- name: Login to Docker Hub Registry
uses: docker/[email protected]
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# - name: Login to GitHub Container Registry
# uses: docker/[email protected]
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.CR_PAT }}

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Build container and push tags
uses: docker/[email protected]
with:
push: true
file: ${{ matrix.containers.file }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: mode=max,type=local,dest=/tmp/.buildx-cache
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
77 changes: 77 additions & 0 deletions .github/workflows/release_containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
name: Release Containers
on:
# https://github.com/actions/runner/issues/1007
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
release-containers:
name: Build and Push container - ${{ matrix.containers.name }}
runs-on: ubuntu-latest
strategy:
matrix:
containers:
- name: kubesec
file: ./Dockerfile
suffix: ""
- name: kubesec scratch
file: ./Dockerfile.scratch
suffix: -scratch

steps:
- name: Cache container layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}${{ matrix.containers.suffix }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}${{ matrix.containers.suffix }}-buildx-
- name: Checkout
uses: actions/[email protected]

- name: Generate container tags and labels
id: docker_meta
uses: docker/[email protected]
with:
# images: kubesec/kubesec,ghcr.io/controlplaneio/kubesec
images: kubesec/kubesec
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}
flavor: |
latest=${{ matrix.containers.suffix == '' }}
suffix=${{ matrix.containers.suffix }}
labels: |
org.opencontainers.image.vendor=controlplane
org.opencontainers.image.url=https://kubesec.io/
- name: Login to Docker Hub Registry
uses: docker/[email protected]
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# - name: Login to GitHub Container Registry
# uses: docker/[email protected]
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.CR_PAT }}

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Build container and push tags
uses: docker/[email protected]
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
file: ${{ matrix.containers.file }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: mode=max,type=local,dest=/tmp/.buildx-cache
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.

## Table of Contents

- [2.11.4](#2114)
- [2.11.3](#2113)
- [2.11.2](#2112)
- [2.11.1](#2111)
Expand All @@ -28,6 +29,12 @@ All notable changes to this project will be documented in this file.

---

## `2.11.4`

- Fix container builds so all tags are correctly built
- Split release and container release so they can be re-ran separately
- Bump dependencies

## `2.11.3`

- Bump dependencies
Expand Down
100 changes: 0 additions & 100 deletions Jenkinsfile

This file was deleted.

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/instrumenta/kubeval v0.16.1
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/prometheus/client_golang v1.11.0
Expand All @@ -32,7 +32,7 @@ require (
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.19.1
golang.org/x/sys v0.0.0-20210915083310-ed5796bab164 // indirect
golang.org/x/sys v0.0.0-20210921065528-437939a70204 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,9 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
Expand Down Expand Up @@ -549,8 +550,8 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210915083310-ed5796bab164 h1:7ZDGnxgHAMw7thfC5bEos0RDAccZKxioiWBhfIe+tvw=
golang.org/x/sys v0.0.0-20210915083310-ed5796bab164/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210921065528-437939a70204 h1:JJhkWtBuTQKyz2bd5WG9H8iUsJRU3En/KRfN8B2RnDs=
golang.org/x/sys v0.0.0-20210921065528-437939a70204/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down

0 comments on commit 5e9096b

Please sign in to comment.