Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opendevstack/ods-pipeline
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1bfa1f1828eda2e60cb2cc07ee5b430ef4751467
Choose a base ref
..
head repository: opendevstack/ods-pipeline
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 51dbe63de3c43be497aab9b7a3ef779caf6d226c
Choose a head ref
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -40,12 +40,14 @@ listed in the changelog.
- Change installation mode from centralized to local/namespaced ([#404](https://github.com/opendevstack/ods-pipeline/pull/404))
- Removed logging of test reports for TypeScript and Python build tasks ([#470](https://github.com/opendevstack/ods-pipeline/issues/470))
- Don't remove tasks on `helm` upgrades, rollbacks, etc. ([#477](https://github.com/opendevstack/ods-pipeline/issues/477))
- Run go fmt over packages, not entire directory ([#484](https://github.com/opendevstack/ods-pipeline/issues/484))

### Fixed
- Cannot enable debug mode in some tasks ([#377](https://github.com/opendevstack/ods-pipeline/issues/377))
- Gradle task does not expose Nexus env variables ([#373](https://github.com/opendevstack/ods-pipeline/issues/373))
- Gradle build fails when it contains more than one test class ([#414](https://github.com/opendevstack/ods-pipeline/issues/414))
- Gradle proxy settings are set during prepare-local-env ([#291](https://github.com/opendevstack/ods-pipeline/issues/291))
- Add `xargs` to helm image as `helm-secrets` depends on it ([#465](https://github.com/opendevstack/ods-pipeline/issues/465))
- Pipeline creation fails when branch names contain slashes ([#466](https://github.com/opendevstack/ods-pipeline/issues/466))
- Race conditions between pipelines of the same repository ([#394](https://github.com/opendevstack/ods-pipeline/issues/394))

7 changes: 5 additions & 2 deletions build/package/Dockerfile.helm
Original file line number Diff line number Diff line change
@@ -43,9 +43,12 @@ ENV HELM_PLUGIN_DIFF_VERSION=3.3.2 \
HELM_PLUGINS=/usr/local/helm/plugins \
SKOPEO_VERSION=1.5 \
TAR_VERSION=1.30 \
GIT_VERSION=2.27
GIT_VERSION=2.27 \
FINDUTILS_VERSION=4.6

RUN microdnf install skopeo-${SKOPEO_VERSION}* git-${GIT_VERSION}* tar-${TAR_VERSION}* && microdnf clean all
# helm-secrets depends on xargs (from GNU findutils) in it's signal handlers,
# c.f. https://github.com/jkroepke/helm-secrets/blob/main/scripts/commands/helm.sh#L34-L36
RUN microdnf install skopeo-${SKOPEO_VERSION}* git-${GIT_VERSION}* tar-${TAR_VERSION}* findutils-${FINDUTILS_VERSION}* && microdnf clean all

COPY --from=builder /usr/local/bin/deploy-with-helm /usr/local/bin/deploy-with-helm
COPY --from=builder /usr/local/bin/helm /usr/local/bin/helm
3 changes: 2 additions & 1 deletion build/package/scripts/build-go.sh
Original file line number Diff line number Diff line change
@@ -71,7 +71,8 @@ echo GOMODCACHE="$GOMODCACHE"
df -h "$ROOT_DIR"

echo "Checking format ..."
unformatted=$(gofmt -l .)
# shellcheck disable=SC2046
unformatted=$(go fmt $(go list ./...))
if [ -n "${unformatted}" ]; then
echo "Unformatted files:"
echo "${unformatted}"
6 changes: 6 additions & 0 deletions docs/design/software-design-specification.adoc
Original file line number Diff line number Diff line change
@@ -562,6 +562,12 @@ For all repositories in scope, the artifacts in the corresponding groups in Nexu
| Python 3.9 available as container is a base platform for building and running various Python applications and frameworks. It is maintained by Red Hat and updated regularly.
| https://catalog.redhat.com/software/containers/ubi8/python-39/6065b24eb92fbda3a4c65d8f

| SDS-EXT-29
| GNU findutils
| 4.6
| Basic directory searching utilities, included due to the dependency of `helm-secrets` on `xargs`
| https://www.gnu.org/software/findutils/

|===

== Appendix
46 changes: 23 additions & 23 deletions internal/manager/queue.go
Original file line number Diff line number Diff line change
@@ -21,17 +21,6 @@ type pipelineRunQueue struct {
logger logging.LeveledLoggerInterface
}

// wait waits for up to maxInitialWait. The exact wait time is
// pseudo-randomized if maxInitialWait is longer than one second.
func wait(maxInitialWait time.Duration) {
initialWait := time.Second
if maxInitialWait > time.Second {
initialWait = time.Duration(rand.Intn(int(maxInitialWait.Seconds())-1) + 1)
}
timer := time.NewTimer(initialWait)
<-timer.C
}

// StartPolling periodically checks status for given identifier.
// The time until the first time is not more than maxInitialWait.
func (q *pipelineRunQueue) StartPolling(pt QueueAdvancer, identifier string, maxInitialWait time.Duration) chan bool {
@@ -82,18 +71,6 @@ type Queue struct {
TektonClient tektonClient.ClientPipelineRunInterface
}

// needsQueueing checks if any run has either:
// - pending status set OR
// - is progressing
func needsQueueing(pipelineRuns *tekton.PipelineRunList) bool {
for _, pr := range pipelineRuns.Items {
if pr.Spec.Status == tekton.PipelineRunSpecStatusPending || pipelineRunIsProgressing(pr) {
return true
}
}
return false
}

// AdvanceQueue starts the oldest pending pipeline run if there is no
// progressing pipeline run at the moment.
// It returns the queue length.
@@ -140,8 +117,31 @@ func (s *Server) AdvanceQueue(repository string) (int, error) {
return len(pendingPrs), nil
}

// needsQueueing checks if any run has either:
// - pending status set OR
// - is progressing
func needsQueueing(pipelineRuns *tekton.PipelineRunList) bool {
for _, pr := range pipelineRuns.Items {
if pr.Spec.Status == tekton.PipelineRunSpecStatusPending || pipelineRunIsProgressing(pr) {
return true
}
}
return false
}

// pipelineRunIsProgressing returns true if the PR is not done, not pending,
// not cancelled, and not timed out.
func pipelineRunIsProgressing(pr tekton.PipelineRun) bool {
return !(pr.IsDone() || pr.IsPending() || pr.IsCancelled() || pr.IsTimedOut())
}

// wait waits for up to maxInitialWait. The exact wait time is
// pseudo-randomized if maxInitialWait is longer than one second.
func wait(maxInitialWait time.Duration) {
initialWait := time.Second
if maxInitialWait > time.Second {
initialWait = time.Duration(rand.Intn(int(maxInitialWait.Seconds())-1) + 1)
}
timer := time.NewTimer(initialWait)
<-timer.C
}
6 changes: 5 additions & 1 deletion scripts/kind-with-registry.sh
Original file line number Diff line number Diff line change
@@ -27,6 +27,10 @@ KIND_CLUSTER_NAME="kind"
RECREATE_KIND_CLUSTER="false"
REGISTRY_PORT="5000"

# K8S version is aligned with OpenShift GA 4.8.
# See https://docs.openshift.com/container-platform/4.8/release_notes/ocp-4-8-release-notes.html
K8S_VERSION="v1.21.1"

while [[ "$#" -gt 0 ]]; do
case $1 in

@@ -90,7 +94,7 @@ if [ "${RECREATE_KIND_CLUSTER}" == "true" ]; then
fi

# create a cluster with the local registry enabled in containerd
cat <<EOF | kind create cluster --name "${KIND_CLUSTER_NAME}" --config=-
cat <<EOF | kind create cluster --name "${KIND_CLUSTER_NAME}" --image "kindest/node:${K8S_VERSION}" --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
2 changes: 1 addition & 1 deletion test/tasks/ods-deploy-helm_test.go
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ func TestTaskODSDeployHelm(t *testing.T) {
if strings.Contains(string(ctxt.CollectedLogs), doNotWantLogMsg) {
t.Fatalf("Do not want:\n%s\n\nGot:\n%s", doNotWantLogMsg, string(ctxt.CollectedLogs))
}
wantLogMsg := "plugin \"diff\" identified at least one change"
wantLogMsg := "identified at least one change"
if !strings.Contains(string(ctxt.CollectedLogs), wantLogMsg) {
t.Fatalf("Want:\n%s\n\nGot:\n%s", wantLogMsg, string(ctxt.CollectedLogs))
}