Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook Proxy maintenance #1298

Merged
merged 12 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ jobs:
name: Checkout repository
uses: actions/[email protected]
-
name: Setup Go 1.18
name: Setup Go 1.23
uses: actions/setup-go@v5
with:
go-version: 1.18
go-version: 1.23
-
name: Download goimports
run: |
Expand All @@ -102,7 +102,7 @@ jobs:
name: Download golangci-lint
run: |
curl -sSfL --output /tmp/golangci-lint.sh https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
cat /tmp/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.49.0
cat /tmp/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.1
-
name: Run linter
working-directory: jenkins/webhook-proxy
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added

### Changed
- Webhook Proxy maintenance ([#1298](https://github.com/opendevstack/ods-core/pull/1298))

### Fixed

Expand Down
8 changes: 4 additions & 4 deletions jenkins/ocp-config/deploy/jenkins-webhook-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ parameters:
- name: ODS_BITBUCKET_PROJECT
required: true
- name: WEBHOOK_PROXY_CPU_REQUEST
value: 50m
value: 25m
- name: WEBHOOK_PROXY_CPU_LIMIT
value: 200m
value: 50m
- name: WEBHOOK_PROXY_MEMORY_REQUEST
value: 128Mi
value: 30Mi
- name: WEBHOOK_PROXY_MEMORY_LIMIT
value: 128Mi
value: 40Mi
objects:
- apiVersion: route.openshift.io/v1
kind: Route
Expand Down
7 changes: 5 additions & 2 deletions jenkins/webhook-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Ideally we would us a very small image like plain alpine and just copy the
# pre-built binary into it, but due to e.g. multistage builds not available in
# OpenShift yet, for now the easiest is to build the binary in this image.
FROM golang:1.18-alpine
FROM golang:1.23-alpine

# Set default ALLOWED_EXTERNAL_PROJECTS env var
ARG allowedExternalProjects=opendevstack
ENV ALLOWED_EXTERNAL_PROJECTS=$allowedExternalProjects

RUN apk add --no-cache ca-certificates && \
RUN apk add -i ca-certificates && \
apk update && \
apk -i upgrade && \
apk cache clean && \
mkdir -p /home/webhook-proxy && \
chgrp -R 0 /home/webhook-proxy && \
chmod g+w /home/webhook-proxy
Expand Down
2 changes: 1 addition & 1 deletion jenkins/webhook-proxy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fmt:

lint:
golangci-lint --version
golangci-lint run --go=1.18
golangci-lint run --go=1.23

build: build-linux build-darwin build-windows

Expand Down
2 changes: 1 addition & 1 deletion jenkins/webhook-proxy/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/opendevstack/ods-core/jenkins/webhook-proxy

go 1.18
go 1.23
9 changes: 2 additions & 7 deletions jenkins/webhook-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,11 +593,12 @@ func (c *ocClient) Forward(e *Event, triggerSecret string) (int, []byte, error)
e.Pipeline,
triggerSecret,
)
log.Println(e.RequestID, "Forwarding to", url)

c.CheckJenkinsAvailability(e)
c.CheckDocGenAvailability(e)

log.Println(e.RequestID, "Forwarding to", url)

p := struct {
Env []EnvPair `json:"env"`
}{
Expand Down Expand Up @@ -629,9 +630,6 @@ func (c *ocClient) CreateOrUpdatePipeline(exists bool, tmpl *template.Template,
return 500, err
}

c.CheckJenkinsAvailability(e)
c.CheckDocGenAvailability(e)

url := fmt.Sprintf(
"%s/namespaces/%s/buildconfigs",
c.OpenShiftAPIBaseURL,
Expand Down Expand Up @@ -673,9 +671,6 @@ func (c *ocClient) DeletePipeline(e *Event) error {
e.Pipeline,
)

c.CheckJenkinsAvailability(e)
c.CheckDocGenAvailability(e)

req, _ := http.NewRequest(
"DELETE",
url,
Expand Down
Loading