Skip to content

Migration: Jenkins -> Semaphore#1204

Merged
Muen Zhang (Muen342) merged 2 commits into
masterfrom
CPKAFKA-9988
May 13, 2024
Merged

Migration: Jenkins -> Semaphore#1204
Muen Zhang (Muen342) merged 2 commits into
masterfrom
CPKAFKA-9988

Conversation

@Muen342

@Muen342 Muen Zhang (Muen342) commented May 2, 2024

Copy link
Copy Markdown

Migrated jenkins to semaphore

  • Added Build, Compile, Validations, Publish, Upgrade step
  • compile-validate runs
./retry_zinc ./gradlew clean publishToMavenLocal build -x test --no-daemon --stacktrace -PxmlSpotBugsReport=true
  • check-scala-compatibility runs
./retry_zinc ./gradlew clean build -x test --no-daemon --stacktrace -PxmlSpotBugsReport=true -PscalaVersion=2.12
  • publishStep was migrated to
 ./gradlewAll -PmavenUrl=$mavenUrl -PkeepAliveMode=session uploadArchives` after setting mavenUrl to the vault secret of ` v1/ci/kv/gradle/artifactory_snapshots_settings` or `v1/ci/kv/gradle/artifactory_preview_release_settings
  • migrated downstream build to
sem-trigger -p $project -b $DOWNSTREAM_BRANCH_NAME -f .semaphore/semaphore.yml

where DOWNSTREAM_BRANCH_NAME is set with set_downstream_branch.sh

  • migrated the unit and integration tests to
'./gradlew 
                unitTest integrationTest --no-daemon --stacktrace --continue 
                -PtestLoggingEvents=started,passed,skipped,failed -PmaxParallelForks=4 
                -PignoreFailures=true -PmaxTestRetries=1 -PmaxTestRetryFailures=5'
  • uploaded results with
shopt -s globstar && test-results publish --name Test-Suite --trim-output-to 1024 --omit-output-for-passed **/build/test-results/**/TEST-*.xml

Service bot already ran with codeartifact in service.yml
https://semaphore.ci.confluent.io/jobs/b6fa3e0e-f2e3-4fae-b569-add5a54078a3#L112

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@cla-assistant

cla-assistant Bot commented May 2, 2024

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Muen342 Muen Zhang (Muen342) changed the title first test Migrated jenkins to semaphore May 10, 2024
@Muen342 Muen Zhang (Muen342) marked this pull request as ready for review May 10, 2024 05:47
@Muen342 Muen Zhang (Muen342) requested review from a team as code owners May 10, 2024 05:47
Comment thread .semaphore/semaphore.yml Outdated
processing: parallel
global_job_config:
env_vars:
- name: NO_OF_TEST_WORKER_NODES

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you all of these env vars? It seems all are copied from ce-kafka. you can only use whichever you want and remove the rest

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove the ones that aren't required

Comment thread .semaphore/semaphore.yml
if [ "$NANO_VERSION" = "true" ] && [ "$RELEASE_JOB" = "false" ] && [ "$ENABLE_PUBLISH_ARTIFACTS" = "true" ]; then
. ci-tools ci-update-version
fi
- make compile-validate

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need these checks. double check again with existing jenkins code.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In jenkins, it does do this, I just changed the command in the makefile to the exact same as was in the jenkinsfile
https://github.com/confluentinc/kafka/pull/1204/files#diff-e6ffa5dc854b843b3ee3c3c28f8eae2f436c2df2b1ca299cca1fa5982e390cf8L80-L81

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread .semaphore/semaphore.yml
- make compile-validate
- make check-scala-compatibility
- |
if [ "$PUBLISH" = "true" ] && [ "$SEMAPHORE_GIT_REF_TYPE" != "pull-request" ] && [ "$ENABLE_PUBLISH_ARTIFACTS" = "true" ]; then \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure these conditions are proper and relevant.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it maps directly to

if (config.publish) {
      stage("Publish to artifactory") {
        if (!config.isReleaseJob && !config.isPrJob) {
            ciTool("ci-push-tag ${env.WORKSPACE} kafka")
        }

        if (config.isDevJob) {
          publishStep('artifactory_snapshots_settings')
        } else if (config.isPreviewJob) {
          publishStep('artifactory_preview_release_settings')
        }
      }
    }

from jenkinsfile

Comment thread .semaphore/semaphore.yml
echo "PUBLISH: $PUBLISH, RELEASE_JOB: $RELEASE_JOB, SEMAPHORE_GIT_REF_TYPE: $SEMAPHORE_GIT_REF_TYPE, ENABLE_DOWNSTREAM_TRIGGER: $ENABLE_DOWNSTREAM_TRIGGER"
if [ "$PUBLISH" = "true" ] && [ "$RELEASE_JOB" = "false" ] && [ "$SEMAPHORE_GIT_REF_TYPE" != "pull-request" ] && [ "$ENABLE_DOWNSTREAM_TRIGGER" = "true" ]; then
for project in $DOWNSTREAM_PROJECTS; do
sem-trigger -p $project -b $DOWNSTREAM_BRANCH_NAME -f .semaphore/semaphore.yml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this required for open source kafka?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Muen342 Muen Zhang (Muen342) changed the title Migrated jenkins to semaphore Migration: Jenkins -> Semaphore May 10, 2024
Comment thread .semaphore/semaphore.yml
echo $(( ($(date +%s%3N) - $SEMAPHORE_JOB_CREATION_TIME * 1000) )) > duration.txt
artifact push workflow duration.txt --destination $SEMAPHORE_JOB_INDEX-test-duration-$SEMAPHORE_WORKFLOW_ID || true

- name: Gradle Build

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest making build as first block then followed by test.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@santhoshct santhoshct left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Muen342 Muen Zhang (Muen342) merged commit aaca303 into master May 13, 2024
@Muen342 Muen Zhang (Muen342) deleted the CPKAFKA-9988 branch May 13, 2024 14:08
Muen Zhang (Muen342) added a commit that referenced this pull request Jun 26, 2024
* migrated jenkins to semaphore

* moved build to be before test in pipeline
Muen Zhang (Muen342) added a commit that referenced this pull request Jun 26, 2024
* migrated jenkins to semaphore

* moved build to be before test in pipeline
Muen Zhang (Muen342) added a commit that referenced this pull request Jun 26, 2024
* migrated jenkins to semaphore

* moved build to be before test in pipeline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants