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

chore(gradle): Adjust memory for gradle tests #18

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a27e88a
perf(sql): Optimise searchForPipelinesByTrigger LIMIT and OFFSET SQL …
christosarvanitis Apr 15, 2024
fc072b3
fix(SqlExecutionRepository): fixed bug in sql repository in orca-sql …
juangod-wise Apr 15, 2024
38b447f
refactor(front50): use SpinnakerRetrofitErrorHandler with Front50Serv…
Pranav-b-7 Apr 16, 2024
fff90a4
feat(sql): log the size of executions when they complete (#4660)
dbyron-sf Apr 16, 2024
90a3832
chore(dependencies): Autobump fiatVersion (#4704)
spinnakerbot Apr 16, 2024
83aa47f
feat(front50): set front50.useTriggeredByEndpoint to true by default …
dbyron-sf Apr 17, 2024
ae3ef6c
fix(clouddriver): Handle the Retrofit conversionError in ClusterSizeP…
Pranav-b-7 Apr 18, 2024
3bc345b
fix(test/keel): Javadoc referring to missing method in ImportDelivery…
Pranav-b-7 Apr 19, 2024
d2f5024
fix(clouddriver): Throw SpinnakerHttpException when Http status is 40…
Pranav-b-7 Apr 24, 2024
c235cf3
fix(test/bakery): Mock http errors using SpinnakerHttpException in Co…
Pranav-b-7 Apr 25, 2024
acbd6e1
chore(dependencies): Autobump korkVersion (#4713)
spinnakerbot Apr 27, 2024
4fe8a71
chore(dependencies): Autobump fiatVersion (#4714)
spinnakerbot Apr 27, 2024
102a9d3
chore(dependencies): Autobump korkVersion (#4715)
spinnakerbot Apr 28, 2024
a1b32d7
refactor(retrofit): Cleanup unused RetrofitError occurrences (#4712)
Pranav-b-7 Apr 29, 2024
bc76db0
fix(test/clouddriver): Mock http error using SpinnakerHttpException i…
Pranav-b-7 Apr 29, 2024
88114eb
refactor(retrofit): Dismantle RetrofitExceptionHandler (#4716)
Pranav-b-7 May 1, 2024
b360ad5
feat(build): add orca-integration module to exercise the just-built d…
dbyron-sf May 7, 2024
b2dba59
fix(jenkins): Wrong Job name encoding in query params for Artifacts/P…
christosarvanitis May 9, 2024
b128594
chore(dependencies): Autobump korkVersion (#4726)
spinnakerbot May 10, 2024
9c8126b
fix(blueGreen): Scaling replicaSets should not be considered for dele…
christosarvanitis May 22, 2024
7564826
chore(dependencies): Autobump korkVersion (#4734)
spinnakerbot Jun 6, 2024
e110e65
chore(dependencies): Autobump korkVersion (#4735)
spinnakerbot Jun 7, 2024
6dcc522
fix(tests): add new containerized integration tests to run orca with …
kirangodishala Jun 10, 2024
c5e7aad
fix(liquibase): fix checkSum errors occurring with spinnaker upgrade …
kirangodishala Jun 11, 2024
f936de5
chore(build): enable cross compilation plugin for Java 17 (#4738)
mattgogerly Jun 11, 2024
aa0d702
chore(dependencies): Autobump korkVersion (#4745)
spinnakerbot Jun 12, 2024
f6d2318
chore(dependencies): Autobump fiatVersion (#4746)
spinnakerbot Jun 12, 2024
dea968c
chore(gradle): Update gradle test memory
jasonmcintosh Jun 12, 2024
aac59b3
chore(gradle): Change gradle memory to be a bit lower vs. test memory
jasonmcintosh Jun 12, 2024
8adb57b
Merge branch 'master' into fixGradleTestMemory
jasonmcintosh Jun 12, 2024
14ef6a5
chore(gradle): Reduce GHA runner memory for gradle
jasonmcintosh Jun 12, 2024
740cfb2
chore(gradle): Reduce memory on releases as well since increased on t…
jasonmcintosh Jun 12, 2024
f48b5ee
chore(gradle): Reduce memory on releases as well since increased on t…
jasonmcintosh Jun 12, 2024
057fdd5
chore(gradle): Reduce memory on releases as well since increased on t…
jasonmcintosh Jun 12, 2024
b041ea1
chore(gradle): Reduce memory on releases as well since increased on t…
jasonmcintosh Jun 12, 2024
9b94fb6
chore(gradle): Spotless
jasonmcintosh Jun 12, 2024
af347bb
fix(dokka): use version 1.9.20 of org.jetbrains.dokka (#4747)
dbyron-sf Jun 12, 2024
6a55337
Merge branch 'master' into fixGradleTestMemory
jasonmcintosh Jun 12, 2024
3ec4fb1
fix(build): revert java17 changes (#4750)
dbyron-sf Jun 13, 2024
3bd889e
Merge branch 'master' into fixGradleTestMemory
jasonmcintosh Jun 13, 2024
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
17 changes: 15 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- release-*

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx6g -Xms6g
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx4g -Xms4g
CONTAINER_REGISTRY: us-docker.pkg.dev/spinnaker-community/docker

jobs:
Expand Down Expand Up @@ -39,6 +39,19 @@ jobs:
env:
ORG_GRADLE_PROJECT_version: ${{ steps.build_variables.outputs.VERSION }}
run: ./gradlew build --stacktrace ${{ steps.build_variables.outputs.REPO }}-web:installDist
- name: Build local slim container image for testing
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.slim
load: true
platforms: local
tags: |
"${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-unvalidated"
- name: Test local slim container image
env:
FULL_DOCKER_IMAGE_NAME: "${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-unvalidated"
run: ./gradlew ${{ steps.build_variables.outputs.REPO }}-integration:test
- name: Login to GAR
# Only run this on repositories in the 'spinnaker' org, not on forks.
if: startsWith(github.repository, 'spinnaker/')
Expand Down Expand Up @@ -98,4 +111,4 @@ jobs:
push: true
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ github.ref_name }}-latest-java11-unvalidated-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-unvalidated-ubuntu"
17 changes: 15 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: PR Build
on: [ pull_request ]

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx6g -Xms6g
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx4g -Xms4g
CONTAINER_REGISTRY: us-docker.pkg.dev/spinnaker-community/docker

jobs:
Expand Down Expand Up @@ -72,4 +72,17 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: |
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:latest-java11-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-ubuntu"
"${{ env.CONTAINER_REGISTRY }}/${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}-java11-ubuntu"
- name: Build local slim container image for testing
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.slim
load: true
platforms: local
tags: |
"${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}"
- name: Test local slim container image
env:
FULL_DOCKER_IMAGE_NAME: "${{ steps.build_variables.outputs.REPO }}:${{ steps.build_variables.outputs.VERSION }}"
run: ./gradlew ${{ steps.build_variables.outputs.REPO }}-integration:test
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx6g -Xms6g -Dorg.gradle.internal.http.socketTimeout=120000 -Dorg.gradle.internal.http.connectionTimeout=120000 -Dorg.gradle.internal.remote.repository.deploy.max.attempts=6
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx4g -Xms4g -Dorg.gradle.internal.http.socketTimeout=120000 -Dorg.gradle.internal.http.connectionTimeout=120000 -Dorg.gradle.internal.remote.repository.deploy.max.attempts=6
CONTAINER_REGISTRY: us-docker.pkg.dev/spinnaker-community/docker

jobs:
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.java11.slim
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM alpine:3.16
LABEL maintainer="[email protected]"
RUN apk --no-cache add --update bash openjdk11-jre
RUN apk --no-cache add --update bash curl openjdk11-jre
RUN addgroup -S -g 10111 spinnaker
RUN adduser -S -G spinnaker -u 10111 spinnaker
COPY orca-web/build/install/orca /opt/orca
RUN mkdir -p /opt/orca/plugins && chown -R spinnaker:nogroup /opt/orca/plugins
USER spinnaker
HEALTHCHECK CMD curl --fail http://localhost:8083/health
CMD ["/opt/orca/bin/orca"]
3 changes: 2 additions & 1 deletion Dockerfile.java11.ubuntu
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM ubuntu:bionic
LABEL maintainer="[email protected]"
RUN apt-get update && apt-get -y install openjdk-11-jre-headless wget
RUN apt-get update && apt-get -y install curl openjdk-11-jre-headless wget
RUN adduser --system --uid 10111 --group spinnaker
COPY orca-web/build/install/orca /opt/orca
RUN mkdir -p /opt/orca/plugins && chown -R spinnaker:nogroup /opt/orca/plugins
USER spinnaker
HEALTHCHECK CMD curl --fail http://localhost:8083/health
CMD ["/opt/orca/bin/orca"]
3 changes: 2 additions & 1 deletion Dockerfile.slim
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM alpine:3.16
LABEL maintainer="[email protected]"
RUN apk --no-cache add --update bash openjdk17-jre
RUN apk --no-cache add --update bash curl openjdk17-jre
RUN addgroup -S -g 10111 spinnaker
RUN adduser -S -G spinnaker -u 10111 spinnaker
COPY orca-web/build/install/orca /opt/orca
RUN mkdir -p /opt/orca/plugins && chown -R spinnaker:nogroup /opt/orca/plugins
USER spinnaker
HEALTHCHECK CMD curl --fail http://localhost:8083/health
CMD ["/opt/orca/bin/orca"]
3 changes: 2 additions & 1 deletion Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM ubuntu:bionic
LABEL maintainer="[email protected]"
RUN apt-get update && apt-get -y install openjdk-17-jre-headless wget
RUN apt-get update && apt-get -y install curl openjdk-17-jre-headless wget
RUN adduser --system --uid 10111 --group spinnaker
COPY orca-web/build/install/orca /opt/orca
RUN mkdir -p /opt/orca/plugins && chown -R spinnaker:nogroup /opt/orca/plugins
USER spinnaker
HEALTHCHECK CMD curl --fail http://localhost:8083/health
CMD ["/opt/orca/bin/orca"]
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ subprojects {
}

test {
minHeapSize = "512m"
maxHeapSize = "2g"
maxParallelForks = 4

testLogging {
exceptionFormat = "full"
}
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fiatVersion=1.45.0
korkVersion=7.224.0
fiatVersion=1.48.0
korkVersion=7.230.0
kotlinVersion=1.6.21
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx6g
org.gradle.jvmargs=-Xmx4g
spinnakerGradleVersion=8.32.1
targetJava11=true

Expand Down
2 changes: 1 addition & 1 deletion keiko-sql/keiko-sql.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ dependencies {
testImplementation project(":keiko-tck")
testImplementation "io.spinnaker.kork:kork-sql-test"
testImplementation "org.testcontainers:mysql"
testImplementation "mysql:mysql-connector-java"
testImplementation "com.mysql:mysql-connector-j"
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
Expand Down Expand Up @@ -137,6 +138,20 @@ public interface PipelineExecution {

void setPartition(String partition);

/**
* The size of the pipeline execution (not including stages) in units appropriate for the
* implementation (e.g. characters/bytes), if available.
*/
Optional<Long> getSize();

void setSize(long size);

/**
* The total size of the pipeline execution including stages in units appropriate for the
* implementation (e.g. characters/bytes), if available.
*/
Optional<Long> getTotalSize();

// -------

StageExecution namedStage(String type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ public interface StageExecution {

void setAdditionalMetricTags(Map<String, String> additionalMetricTags);

/**
* The size of the stage execution in units appropriate for the implementation (e.g.
* characters/bytes), if available.
*/
Optional<Long> getSize();

void setSize(long size);

// ------------- InternalStageExecution?
// A lot of these methods are used in a single place somewhere in Orca. I don't know why we
// decided to put a bunch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import com.netflix.spinnaker.orca.KeelService
import groovy.util.logging.Slf4j
import org.springframework.lang.Nullable
import org.springframework.stereotype.Component
import retrofit.RetrofitError

@Slf4j
@Component
Expand Down Expand Up @@ -76,25 +75,22 @@ class DeleteApplicationTask extends AbstractFront50Task {
front50Service.delete(application.name)
try {
front50Service.deletePermission(application.name)
} catch (RetrofitError re) {
if (re.response?.status == 404) {
} catch (SpinnakerHttpException re) {
if (re.responseCode == 404) {
return TaskResult.SUCCEEDED
}
log.error("Could not delete application permission", re)
return TaskResult.builder(ExecutionStatus.TERMINAL).outputs(outputs).build()
} catch (SpinnakerServerException e){
log.error("Could not delete application permission", e)
return TaskResult.builder(ExecutionStatus.TERMINAL).outputs(outputs).build()
}
// delete Managed Delivery data
if (keelService != null) {
log.debug("Deleting Managed Delivery data for {}", application.name)
keelService.deleteDeliveryConfig(application.name)
}
}
} catch (RetrofitError e) {
if (e.response?.status == 404) {
return TaskResult.SUCCEEDED
}
log.error("Could not delete application", e)
return TaskResult.builder(ExecutionStatus.TERMINAL).outputs(outputs).build()
} catch (SpinnakerHttpException httpException){
if (httpException.responseCode == 404) {
return TaskResult.SUCCEEDED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ package com.netflix.spinnaker.orca.applications.tasks

import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.kork.dynamicconfig.DynamicConfigService
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus
import com.netflix.spinnaker.orca.front50.Front50Service
import com.netflix.spinnaker.orca.front50.model.Application
import retrofit.RetrofitError
import retrofit.client.Response
import spock.lang.Specification
import spock.lang.Subject
import spock.lang.Unroll
Expand Down Expand Up @@ -57,7 +60,7 @@ class UpsertApplicationTaskSpec extends Specification {
given:
def app = new Application(config.application + [user: config.user])
task.front50Service = Mock(Front50Service) {
1 * get(config.application.name) >> null
1 * get(config.application.name) >> { throw notFoundError() }
1 * create(app)
1 * updatePermission(*_)
0 * _._
Expand Down Expand Up @@ -99,7 +102,11 @@ class UpsertApplicationTaskSpec extends Specification {
application.user = config.user

task.front50Service = Mock(Front50Service) {
1 * get(config.application.name) >> initialState
if (initialState == null) {
1 * get(config.application.name) >> { throw notFoundError() }
} else {
1 * get(config.application.name) >> initialState
}
1 * "${operation}"(*_)
_ * updatePermission(*_)
0 * _._
Expand Down Expand Up @@ -150,4 +157,13 @@ class UpsertApplicationTaskSpec extends Specification {
[:] || 1
[READ: ["[email protected]"], WRITE: ["[email protected]"]] || 1
}

private static SpinnakerHttpException notFoundError() {
return new SpinnakerHttpException(RetrofitError.httpError(
"http://front50",
new Response("http://front50", 404, "Not Found", [], null),
null,
null
))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.kork.artifacts.model.Artifact
import com.netflix.spinnaker.kork.core.RetrySupport
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerServerException
import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus
import com.netflix.spinnaker.orca.api.pipeline.RetryableTask
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
Expand All @@ -41,7 +42,6 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import retrofit.RetrofitError


import static com.netflix.spinnaker.kork.web.selector.v2.SelectableService.*
Expand Down Expand Up @@ -86,7 +86,7 @@ class CreateBakeTask implements RetryableTask {
stage.context.user = user
}
}
} catch (RetrofitError e) {
} catch (SpinnakerServerException e) {
// ignore exception, we will just use the owner passed to us
if (!e.message.contains("404")) {
log.warn("Error retrieving application {} from front50, ignoring.", stage.execution.application, e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.orca.bakery.config.BakeryConfiguration
import com.netflix.spinnaker.orca.jackson.OrcaObjectMapper
import retrofit.RequestInterceptor
import retrofit.RetrofitError
import retrofit.client.OkClient
import spock.lang.Specification
import spock.lang.Subject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.netflix.spinnaker.orca.bakery.tasks

import com.netflix.spinnaker.kork.artifacts.model.Artifact
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.kork.web.selector.v2.SelectableService
import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus
import com.netflix.spinnaker.orca.bakery.BakerySelector
Expand All @@ -39,12 +40,12 @@ class CompletedBakeTaskSpec extends Specification {

@Shared PipelineExecutionImpl pipeline = pipeline()

@Shared notFoundError = RetrofitError.httpError(
@Shared notFoundError = new SpinnakerHttpException(RetrofitError.httpError(
null,
new Response("http://bakery", HTTP_NOT_FOUND, "Not Found", [], null),
null,
null
)
))

def "finds the AMI and artifact created by a bake"() {
given:
Expand Down Expand Up @@ -105,7 +106,7 @@ class CompletedBakeTaskSpec extends Specification {

then:
1 * task.bakerySelector.select(_) >> selectedBakeryService
thrown(RetrofitError)
thrown(SpinnakerHttpException)

where:
region = "us-west-1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup

import com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
import com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.TargetServerGroupLinearStageSupport
import com.netflix.spinnaker.orca.clouddriver.tasks.MonitorKatoTask
Expand All @@ -38,7 +39,7 @@ import org.springframework.stereotype.Component
@Component
@Slf4j
class PinServerGroupStage extends TargetServerGroupLinearStageSupport {
public static final String TYPE = getType(PinServerGroupStage)
public static final String TYPE = StageDefinitionBuilder.getType(PinServerGroupStage)

@Override
protected void taskGraphInternal(StageExecution stage, TaskNode.Builder builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup

import com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
import com.netflix.spinnaker.orca.clouddriver.pipeline.providers.aws.ModifyAwsScalingProcessStage
import com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.TargetServerGroupLinearStageSupport
Expand All @@ -37,7 +38,7 @@ import org.springframework.stereotype.Component
@Component
@Slf4j
class ResizeServerGroupStage extends TargetServerGroupLinearStageSupport {
public static final String TYPE = getType(ResizeServerGroupStage)
public static final String TYPE = StageDefinitionBuilder.getType(ResizeServerGroupStage)

@Override
protected void taskGraphInternal(StageExecution stage, TaskNode.Builder builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import com.netflix.spinnaker.orca.clouddriver.model.ServerGroup
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import retrofit.RetrofitError

import java.time.Duration

Expand Down
Loading