Skip to content

Commit

Permalink
Webhook Proxy maintenance (#1298)
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisVQ authored Sep 2, 2024
1 parent de64651 commit 5d819ee
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 18 deletions.
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))

- Jenkins maintenance ([#1299](https://github.com/opendevstack/ods-core/pull/1299)) and update java version in Jenkins ([#1295](https://github.com/opendevstack/ods-core/issues/1295))

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

0 comments on commit 5d819ee

Please sign in to comment.