Skip to content

Commit

Permalink
Merge pull request #72 from djkormo/makefile-fix
Browse files Browse the repository at this point in the history
changing golang to version 1.21.7
  • Loading branch information
djkormo committed Mar 9, 2024
2 parents 6d1b623 + 3a39542 commit 0181e23
Show file tree
Hide file tree
Showing 69 changed files with 3,908 additions and 4,439 deletions.
26 changes: 13 additions & 13 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"postStartCommand": "bash .devcontainer/test-on-create.sh",
"customizations": {
"vscode": {
"extensions": ["redhat.vscode-yaml",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"golang.Go",
"mhutchie.git-graph",
"766b.go-outliner", "m4ns0ur.base64"
]

}
}
{
"postStartCommand": "bash .devcontainer/test-on-create.sh",
"customizations": {
"vscode": {
"extensions": ["redhat.vscode-yaml",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"golang.Go",
"mhutchie.git-graph",
"766b.go-outliner", "m4ns0ur.base64"
]

}
}
}
4 changes: 3 additions & 1 deletion .devcontainer/test-on-create.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

#!/bin/bash

set -u
set -e
set -x

KUBERNETES_VERSION=v1.26.1
GO_VERSION=1.17.8
GO_VERSION=1.21.7
OPERATOR_SDK_VERSION=v1.19.x
CERT_MANAGER_VERSION=v1.12.6

Expand Down Expand Up @@ -155,3 +156,4 @@ echo "alias kubens='kubectl config set-context --current --namespace ' " >> ~/.b
echo "alias kge='kubectl get events --sort-by=.metadata.creationTimestamp' " >> ~/.bashrc

echo "done"

37 changes: 37 additions & 0 deletions .github/workflows/adcs-sim-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish ADCS Simulator Docker image on Release

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: Get the version from tag
id: get_version
run: echo ::set-env name=VERSION::${GITHUB_REF#refs/tags/}
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
COMMIT: 'variableContent'
BUILD_TIME: 'variableContent'
PROJECT: 'github.com/nokia/adcs-sim/adcs-sim'
#COMMIT?=$(shell git rev-parse --short HEAD)
#BUILD_TIME?=$(shell date -u '+%Y-%m-%d_%H:%M:%S')
#PROJECT?=github.com/nokia/adcs-sim/adcs-sim


- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
name: djkormo/adcs-sim
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
buildargs: VERSION,COMMIT,BUILD_TIME,PROJECT
tags: "latest,${{ env.VERSION }}"
dockerfile: ./test/Dockerfile

152 changes: 76 additions & 76 deletions .github/workflows/adcs-simulator.yaml
Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
name: adcs-simulator pipeline

on:
push:
paths:
- 'test/adcs-sim/**.go'
- 'test/**.go'
- 'test/Dockerfile'


jobs:

buildDocker:
runs-on: ubuntu-latest
env:
APP_NAME: adcs-simulator

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

ref: master

- name: Docker meta
id: meta
uses: docker/metadata-action@v4

with:
# list of Docker images to use as base name for tags
images: |
djkormo/adcs-sim
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Login to DockerHub
if: github.event_name != 'pull_request'

uses: docker/login-action@v2

with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push

uses: docker/build-push-action@v3

with:
context: ./test
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:

image-ref: djkormo/adcs-sim:master

format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
skip-dirs: /usr/local/bin/ca


name: adcs-simulator pipeline

on:
push:
paths:
- 'test/adcs-sim/**.go'
- 'test/**.go'
- 'test/Dockerfile'


jobs:

buildDocker:
runs-on: ubuntu-latest
env:
APP_NAME: adcs-simulator

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

ref: master

- name: Docker meta
id: meta
uses: docker/metadata-action@v4

with:
# list of Docker images to use as base name for tags
images: |
djkormo/adcs-sim
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Login to DockerHub
if: github.event_name != 'pull_request'

uses: docker/login-action@v2

with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push

uses: docker/build-push-action@v3

with:
context: ./test
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:

image-ref: djkormo/adcs-sim:master

format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
skip-dirs: /usr/local/bin/ca


24 changes: 15 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# Build the manager binary
FROM golang:1.17 as builder
FROM golang:1.21 as builder


ARG VERSION
ARG COMMIT
ARG BUILD_TIME
ARG PROJECT

WORKDIR /workspace

#ENV http_proxy=http://defraprx-fihelprx.glb.nsn-net.net:8080
#ENV https_proxy=http://defraprx-fihelprx.glb.nsn-net.net:8080
#ENV HTTP_PROXY=http://defraprx-fihelprx.glb.nsn-net.net:8080
#ENV HTTPS_PROXY=http://defraprx-fihelprx.glb.nsn-net.net:8080

# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum

# fix for CVE
#RUN go get golang.org/x/crypto

# 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
Expand All @@ -26,9 +27,14 @@ COPY controllers/ controllers/
COPY issuers/ issuers/
COPY adcs/ adcs/
COPY healthcheck/ healthcheck/

COPY version/ version/
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
#RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build \
-ldflags "-s -w -X ${PROJECT}/version.Release=${VERSION} \
-X ${PROJECT}/version.Commit=${COMMIT} -X ${PROJECT}/version.BuildTime=${BUILD_TIME}" \
-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
Expand Down
Loading

0 comments on commit 0181e23

Please sign in to comment.