From a6e60e010804b3cd3643a777bac70f2208f7e4eb Mon Sep 17 00:00:00 2001 From: rfast_expedia Date: Wed, 12 Nov 2025 15:43:53 -0600 Subject: [PATCH] Fix vulnerabilities and update Travis (lol) to github actions --- .github/workflows/ci.yml | 211 ++++++++++++++++++ agent-dispatchers/kinesis/pom.xml | 2 +- .../agent/dispatcher/KinesisDispatcher.java | 3 +- agent-providers/span/pom.xml | 10 + api/pom.xml | 11 +- bundlers/haystack-agent/pom.xml | 12 + pom.xml | 90 +++----- 7 files changed, 271 insertions(+), 68 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..106ed3c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,211 @@ +name: CI + +on: + push: + branches: + - master + tags: + - '*' + pull_request: + branches: + - master + +jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '8' + cache: 'maven' + + - name: Build with Maven + run: mvn clean install -Dgpg.skip -Dmaven.javadoc.skip=true -B -V + + - name: Upload build artifacts + if: success() + uses: actions/upload-artifact@v4 + with: + name: haystack-agent-jar + path: bundlers/haystack-agent/target/haystack-agent-*.jar + retention-days: 7 + + deploy: + name: Deploy to Maven Central and Docker Hub + runs-on: ubuntu-latest + needs: build + # Only deploy on master branch (non-PR) or on tags + if: | + (github.ref == 'refs/heads/master' && github.event_name == 'push') || + startsWith(github.ref, 'refs/tags/') + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '8' + cache: 'maven' + + - name: Import GPG key + if: env.GPG_SECRET_KEYS != '' + env: + GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }} + GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: | + if [ ! -z "$GPG_SECRET_KEYS" ]; then + echo "$GPG_SECRET_KEYS" | base64 --decode | gpg --batch --import + fi + if [ ! -z "$GPG_OWNERTRUST" ]; then + echo "$GPG_OWNERTRUST" | base64 --decode | gpg --batch --import-ownertrust + fi + + - name: Create Maven settings.xml + run: | + mkdir -p ~/.m2 + cat > ~/.m2/settings.xml << 'EOF' + + + + ossrh + ${env.SONATYPE_USERNAME} + ${env.SONATYPE_PASSWORD} + + + + + ossrh + + true + + + gpg + ${env.GPG_PASSPHRASE} + + + + + EOF + + - name: Determine version and GPG settings + id: version + run: | + if [ ! -z "${{ github.ref_name }}" ] && [[ "${{ github.ref }}" == refs/tags/* ]]; then + # This is a tag release + VERSION=${{ github.ref_name }} + echo "AGENT_JAR_VERSION=$VERSION" >> $GITHUB_ENV + echo "SKIP_GPG_SIGN=false" >> $GITHUB_ENV + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Travis tag is set -> updating pom.xml attribute to $VERSION" + mvn org.codehaus.mojo:versions-maven-plugin:2.1:set -DnewVersion=$VERSION -q + else + # This is a snapshot build + VERSION=$(cat pom.xml | sed -n -e 's/.*\(.*\)<\/version>.*/\1/p' | head -1) + echo "AGENT_JAR_VERSION=$VERSION" >> $GITHUB_ENV + echo "SKIP_GPG_SIGN=true" >> $GITHUB_ENV + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "No tag set, hence keeping the snapshot version in pom.xml: $VERSION" + fi + + - name: Deploy to Maven Central + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: | + if [ -z "$SONATYPE_USERNAME" ]; then + echo "ERROR! Please set SONATYPE_USERNAME secret" + exit 1 + fi + if [ -z "$SONATYPE_PASSWORD" ]; then + echo "ERROR! Please set SONATYPE_PASSWORD secret" + exit 1 + fi + + mvn clean deploy -Dgpg.skip=$SKIP_GPG_SIGN -DskipTests=true -B -U + echo "Successfully deployed the jars to Nexus" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Prepare Docker build + run: | + cp bundlers/haystack-agent/target/haystack-agent-${AGENT_JAR_VERSION}.jar bundlers/haystack-agent/target/haystack-agent.jar + + - name: Extract Docker metadata + id: meta + run: | + DOCKER_ORG=expediadotcom + DOCKER_IMAGE_NAME=haystack-agent + VERSION=${{ env.AGENT_JAR_VERSION }} + + echo "DOCKER_ORG=$DOCKER_ORG" >> $GITHUB_ENV + echo "DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME" >> $GITHUB_ENV + echo "QUALIFIED_IMAGE=$DOCKER_ORG/$DOCKER_IMAGE_NAME" >> $GITHUB_ENV + + # Determine tags based on version + TAGS="" + if [[ $VERSION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then + # Release version - create multiple tags + MAJOR="${BASH_REMATCH[1]}" + MINOR="${BASH_REMATCH[2]}" + PATCH="${BASH_REMATCH[3]}" + + TAGS="$DOCKER_ORG/$DOCKER_IMAGE_NAME:$MAJOR" + TAGS="$TAGS,$DOCKER_ORG/$DOCKER_IMAGE_NAME:$MAJOR.$MINOR" + TAGS="$TAGS,$DOCKER_ORG/$DOCKER_IMAGE_NAME:$MAJOR.$MINOR.$PATCH" + TAGS="$TAGS,$DOCKER_ORG/$DOCKER_IMAGE_NAME:latest" + echo "Pushing released version to Docker Hub with tags: $TAGS" + else + # Snapshot version + TAGS="$DOCKER_ORG/$DOCKER_IMAGE_NAME:$VERSION" + echo "Pushing snapshot version to Docker Hub with tag: $TAGS" + fi + + echo "tags=$TAGS" >> $GITHUB_OUTPUT + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + cache-from: type=gha + cache-to: type=gha,mode=max + + notify: + name: Send notifications + runs-on: ubuntu-latest + needs: [build, deploy] + if: failure() && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) + + steps: + - name: Notify on failure + run: | + echo "Build or deployment failed. In Travis CI, this would send email to haystack-notifications@expedia.com" + echo "Consider setting up GitHub Actions email notifications or Slack webhooks." diff --git a/agent-dispatchers/kinesis/pom.xml b/agent-dispatchers/kinesis/pom.xml index 8506eb6..e523f11 100644 --- a/agent-dispatchers/kinesis/pom.xml +++ b/agent-dispatchers/kinesis/pom.xml @@ -13,7 +13,7 @@ haystack-agent-kinesis-dispatcher - 0.14.0 + 0.15.12 diff --git a/agent-dispatchers/kinesis/src/main/java/com/expedia/www/haystack/agent/dispatcher/KinesisDispatcher.java b/agent-dispatchers/kinesis/src/main/java/com/expedia/www/haystack/agent/dispatcher/KinesisDispatcher.java index 40f084f..86a7db7 100644 --- a/agent-dispatchers/kinesis/src/main/java/com/expedia/www/haystack/agent/dispatcher/KinesisDispatcher.java +++ b/agent-dispatchers/kinesis/src/main/java/com/expedia/www/haystack/agent/dispatcher/KinesisDispatcher.java @@ -34,6 +34,7 @@ import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.MoreExecutors; import com.typesafe.config.Config; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; @@ -194,7 +195,7 @@ public void onFailure(final Throwable throwable) { formatAttempts(result.getAttempts()), e); } } - }); + }, MoreExecutors.directExecutor()); } private String formatAttempts(final List attempts) { diff --git a/agent-providers/span/pom.xml b/agent-providers/span/pom.xml index 727efd6..953b3b2 100644 --- a/agent-providers/span/pom.xml +++ b/agent-providers/span/pom.xml @@ -11,6 +11,10 @@ ../../pom.xml + + 2.7.5 + + com.expedia.www @@ -33,6 +37,12 @@ commons-io commons-io + + com.squareup.okhttp + okhttp + ${okhttp.version} + test + diff --git a/api/pom.xml b/api/pom.xml index 2d4022f..867a88e 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -26,6 +26,13 @@ io.grpc grpc-services + + + + javax.annotation + javax.annotation-api + 1.3.2 + @@ -60,7 +67,7 @@ run - com.google.protobuf:protoc:3.0.0 + com.google.protobuf:protoc:${protobuf.version} ${project.basedir}/../haystack-idl/proto ${project.basedir}/../haystack-idl/proto/api @@ -75,7 +82,7 @@ grpc-java - io.grpc:protoc-gen-grpc-java:1.0.1 + io.grpc:protoc-gen-grpc-java:1.68.2 diff --git a/bundlers/haystack-agent/pom.xml b/bundlers/haystack-agent/pom.xml index d487f69..18acfe9 100644 --- a/bundlers/haystack-agent/pom.xml +++ b/bundlers/haystack-agent/pom.xml @@ -51,11 +51,23 @@ com.expedia.www blobs-agent-dispatchers ${blobs.version} + + + com.expedia.www + haystack-agent-api + + com.expedia.www blobs-agent-server ${blobs.version} + + + com.expedia.www + haystack-agent-api + + diff --git a/pom.xml b/pom.xml index 578d25d..3041585 100644 --- a/pom.xml +++ b/pom.xml @@ -68,34 +68,33 @@ UTF-8 1.8 - 3.4.0 - 1.2.3 - 1.7.25 - 2.9.10.4 - 2.9.10 - 3.4 - 1.9.0 + 3.25.5 + 1.2.13 + 1.7.36 + 2.13.5 + 3.17.0 + 1.68.2 3.2.5 2.3.0 1.1.1 1.0.3 - 9.4.18.v20190429 - 2.15.0 + 9.4.56.v20240826 + 2.27.1 2 12 - 6 + 19 ${scala.major.version}.${scala.minor.version} ${scala.major.version}.${scala.minor.version}.${scala.tiny.version} 6.8 1.6.0 - 3.0.5 - 3.6 + 3.0.9 + 5.4.0 4.12 - 1.11.128 + 1.12.779 1.3.1 - 2.6 + 2.18.0 3.0.1 5.1.3 @@ -180,14 +179,11 @@ - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - ${jackson-dataformat.version} - - - com.fasterxml.jackson.core - jackson-databind + com.fasterxml.jackson + jackson-bom ${jackson.version} + import + pom com.amazonaws @@ -202,14 +198,22 @@ org.eclipse.jetty - jetty-servlet + jetty-bom ${jetty.version} + import + pom io.zipkin.zipkin2 zipkin ${zipkin2.version} + + org.scala-lang.modules + scala-xml_2.12 + 1.1.1 + test + @@ -507,48 +511,6 @@ true - - org.jacoco - jacoco-maven-plugin - ${jacoco.version} - - - default-prepare-agent - - prepare-agent - - - - default-report - - report - - - - default-check - - check - - - - **/com/expedia/open/tracing/**/* - - - - BUNDLE - - - INSTRUCTION - COVEREDRATIO - 0.4 - - - - - - - -