github.com/QuangHoangHao/kafka-go@v0.4.36/.circleci/config.yml (about)

     1  version: 2
     2  jobs:
     3    lint:
     4      docker:
     5        - image: golangci/golangci-lint:v1.45-alpine
     6      steps:
     7        - checkout
     8        - run: golangci-lint run
     9  
    10    # The kafka 0.10 tests are maintained as a separate configuration because
    11    # kafka only supported plain text SASL in this version.
    12    kafka-010:
    13      working_directory: &working_directory /go/src/github.com/QuangHoangHao/kafka-go
    14      environment:
    15        KAFKA_VERSION: "0.10.1"
    16      docker:
    17        - image: circleci/golang
    18        - image: wurstmeister/zookeeper
    19          ports:
    20            - 2181:2181
    21        - image: wurstmeister/kafka:0.10.1.1
    22          ports:
    23            - 9092:9092
    24            - 9093:9093
    25          environment:
    26            KAFKA_BROKER_ID: "1"
    27            KAFKA_CREATE_TOPICS: "test-writer-0:3:1,test-writer-1:3:1"
    28            KAFKA_DELETE_TOPIC_ENABLE: "true"
    29            KAFKA_ADVERTISED_HOST_NAME: "localhost"
    30            KAFKA_ADVERTISED_PORT: "9092"
    31            KAFKA_ZOOKEEPER_CONNECT: "localhost:2181"
    32            KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
    33            KAFKA_MESSAGE_MAX_BYTES: "200000000"
    34            KAFKA_LISTENERS: "PLAINTEXT://:9092,SASL_PLAINTEXT://:9093"
    35            KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://localhost:9092,SASL_PLAINTEXT://localhost:9093"
    36            KAFKA_SASL_ENABLED_MECHANISMS: "PLAIN"
    37            KAFKA_OPTS: "-Djava.security.auth.login.config=/opt/kafka/config/kafka_server_jaas.conf"
    38            CUSTOM_INIT_SCRIPT: |-
    39              echo -e 'KafkaServer {\norg.apache.kafka.common.security.plain.PlainLoginModule required\n username="adminplain"\n password="admin-secret"\n user_adminplain="admin-secret";\n  };' > /opt/kafka/config/kafka_server_jaas.conf;
    40      steps: &steps
    41        - checkout
    42        - restore_cache:
    43            key: kafka-go-mod-{{ checksum "go.sum" }}-1
    44        - run:
    45            name: Download dependencies
    46            command: go mod download
    47        - save_cache:
    48            key: kafka-go-mod-{{ checksum "go.sum" }}-1
    49            paths:
    50              - /go/pkg/mod
    51        - run:
    52            name: Test kafka-go
    53            command: go test -race -cover ./...
    54        - run:
    55            name: Test kafka-go/sasl/aws_msk_iam
    56            working_directory: ./sasl/aws_msk_iam
    57            command: go test -race -cover ./...
    58  
    59    # Starting at version 0.11, the kafka features and configuration remained
    60    # mostly stable, so we can use this CI job configuration as template for other
    61    # versions as well.
    62    kafka-011:
    63      working_directory: *working_directory
    64      environment:
    65        KAFKA_VERSION: "0.11.0"
    66      docker:
    67        - image: circleci/golang
    68        - image: wurstmeister/zookeeper
    69          ports:
    70            - 2181:2181
    71        - image: wurstmeister/kafka:2.11-0.11.0.3
    72          ports:
    73            - 9092:9092
    74            - 9093:9093
    75          environment: &environment
    76            KAFKA_BROKER_ID: "1"
    77            KAFKA_CREATE_TOPICS: "test-writer-0:3:1,test-writer-1:3:1"
    78            KAFKA_DELETE_TOPIC_ENABLE: "true"
    79            KAFKA_ADVERTISED_HOST_NAME: "localhost"
    80            KAFKA_ADVERTISED_PORT: "9092"
    81            KAFKA_ZOOKEEPER_CONNECT: "localhost:2181"
    82            KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
    83            KAFKA_MESSAGE_MAX_BYTES: "200000000"
    84            KAFKA_LISTENERS: "PLAINTEXT://:9092,SASL_PLAINTEXT://:9093"
    85            KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://localhost:9092,SASL_PLAINTEXT://localhost:9093"
    86            KAFKA_SASL_ENABLED_MECHANISMS: "PLAIN,SCRAM-SHA-256,SCRAM-SHA-512"
    87            KAFKA_OPTS: "-Djava.security.auth.login.config=/opt/kafka/config/kafka_server_jaas.conf"
    88            CUSTOM_INIT_SCRIPT: |-
    89              apk add libgcc;
    90              echo -e 'KafkaServer {\norg.apache.kafka.common.security.scram.ScramLoginModule required\n username="adminscram"\n password="admin-secret";\n org.apache.kafka.common.security.plain.PlainLoginModule required\n username="adminplain"\n password="admin-secret"\n user_adminplain="admin-secret";\n  };' > /opt/kafka/config/kafka_server_jaas.conf;
    91              /opt/kafka/bin/kafka-configs.sh --zookeeper localhost:2181 --alter --add-config 'SCRAM-SHA-256=[password=admin-secret-256],SCRAM-SHA-512=[password=admin-secret-512]' --entity-type users --entity-name adminscram
    92      steps: *steps
    93  
    94    kafka-101:
    95      working_directory: *working_directory
    96      environment:
    97        KAFKA_VERSION: "1.0.1"
    98      docker:
    99        - image: circleci/golang
   100        - image: wurstmeister/zookeeper
   101          ports:
   102            - 2181:2181
   103        - image: wurstmeister/kafka:2.11-1.0.1
   104          ports:
   105            - 9092:9092
   106            - 9093:9093
   107          environment: *environment
   108      steps: *steps
   109  
   110    kafka-111:
   111      working_directory: *working_directory
   112      environment:
   113        KAFKA_VERSION: "1.1.1"
   114      docker:
   115        - image: circleci/golang
   116        - image: wurstmeister/zookeeper
   117          ports:
   118            - 2181:2181
   119        - image: wurstmeister/kafka:2.11-1.1.1
   120          ports:
   121            - 9092:9092
   122            - 9093:9093
   123          environment: *environment
   124      steps: *steps
   125  
   126    kafka-201:
   127      working_directory: *working_directory
   128      environment:
   129        KAFKA_VERSION: "2.0.1"
   130      docker:
   131        - image: circleci/golang
   132        - image: wurstmeister/zookeeper
   133          ports:
   134            - 2181:2181
   135        - image: wurstmeister/kafka:2.12-2.0.1
   136          ports:
   137            - 9092:9092
   138            - 9093:9093
   139          environment:
   140            <<: *environment
   141            KAFKA_AUTHORIZER_CLASS_NAME: "kafka.security.auth.SimpleAclAuthorizer"
   142            KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
   143      steps: *steps
   144  
   145    kafka-211:
   146      working_directory: *working_directory
   147      environment:
   148        KAFKA_VERSION: "2.1.1"
   149      docker:
   150        - image: circleci/golang
   151        - image: wurstmeister/zookeeper
   152          ports:
   153            - 2181:2181
   154        - image: wurstmeister/kafka:2.12-2.1.1
   155          ports:
   156            - 9092:9092
   157            - 9093:9093
   158          # recently, the base image for some newer versions of kafka switched from
   159          # alpine to debian, which causes the "apk add ..." line to fail. The env
   160          # map should be used for any versions that fail due to being part of this
   161          # migration.
   162          environment: &environmentDebian
   163            <<: *environment
   164            KAFKA_AUTHORIZER_CLASS_NAME: "kafka.security.auth.SimpleAclAuthorizer"
   165            KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
   166            CUSTOM_INIT_SCRIPT: |-
   167              echo -e 'KafkaServer {\norg.apache.kafka.common.security.scram.ScramLoginModule required\n username="adminscram"\n password="admin-secret";\n org.apache.kafka.common.security.plain.PlainLoginModule required\n username="adminplain"\n password="admin-secret"\n user_adminplain="admin-secret";\n  };' > /opt/kafka/config/kafka_server_jaas.conf;
   168              /opt/kafka/bin/kafka-configs.sh --zookeeper localhost:2181 --alter --add-config 'SCRAM-SHA-256=[password=admin-secret-256],SCRAM-SHA-512=[password=admin-secret-512]' --entity-type users --entity-name adminscram
   169      steps: *steps
   170  
   171    kafka-222:
   172      working_directory: *working_directory
   173      environment:
   174        KAFKA_VERSION: "2.2.2"
   175      docker:
   176        - image: circleci/golang
   177        - image: wurstmeister/zookeeper
   178          ports:
   179            - 2181:2181
   180        - image: wurstmeister/kafka:2.12-2.2.2
   181          ports:
   182            - 9092:9092
   183            - 9093:9093
   184          environment:
   185            <<: *environmentDebian
   186      steps: *steps
   187  
   188    kafka-231:
   189      working_directory: *working_directory
   190      environment:
   191        KAFKA_VERSION: "2.3.1"
   192      docker:
   193        - image: circleci/golang
   194        - image: wurstmeister/zookeeper
   195          ports:
   196            - 2181:2181
   197        - image: wurstmeister/kafka:2.12-2.3.1
   198          ports:
   199            - 9092:9092
   200            - 9093:9093
   201          environment:
   202            <<: *environmentDebian
   203      steps: *steps
   204  
   205    kafka-241:
   206      working_directory: *working_directory
   207      environment:
   208        KAFKA_VERSION: "2.4.1"
   209  
   210        # Need to skip nettest to avoid these kinds of errors:
   211        #  --- FAIL: TestConn/nettest (17.56s)
   212        #    --- FAIL: TestConn/nettest/PingPong (7.40s)
   213        #      conntest.go:112: unexpected Read error: [7] Request Timed Out: the request exceeded the user-specified time limit in the request
   214        #      conntest.go:118: mismatching value: got 77, want 78
   215        #      conntest.go:118: mismatching value: got 78, want 79
   216        # ...
   217        #
   218        # TODO: Figure out why these are happening and fix them (they don't appear to be new).
   219        KAFKA_SKIP_NETTEST: "1"
   220      docker:
   221        - image: circleci/golang
   222        - image: wurstmeister/zookeeper
   223          ports:
   224            - 2181:2181
   225        - image: wurstmeister/kafka:2.12-2.4.1
   226          ports:
   227            - 9092:9092
   228            - 9093:9093
   229          environment:
   230            <<: *environmentDebian
   231      steps: *steps
   232  
   233    kafka-260:
   234      working_directory: *working_directory
   235      environment:
   236        KAFKA_VERSION: "2.6.0"
   237  
   238        # Need to skip nettest to avoid these kinds of errors:
   239        #  --- FAIL: TestConn/nettest (17.56s)
   240        #    --- FAIL: TestConn/nettest/PingPong (7.40s)
   241        #      conntest.go:112: unexpected Read error: [7] Request Timed Out: the request exceeded the user-specified time limit in the request
   242        #      conntest.go:118: mismatching value: got 77, want 78
   243        #      conntest.go:118: mismatching value: got 78, want 79
   244        # ...
   245        #
   246        # TODO: Figure out why these are happening and fix them (they don't appear to be new).
   247        KAFKA_SKIP_NETTEST: "1"
   248      docker:
   249        - image: circleci/golang
   250        - image: wurstmeister/zookeeper
   251          ports:
   252            - 2181:2181
   253        - image: wurstmeister/kafka:2.13-2.6.0
   254          ports:
   255            - 9092:9092
   256            - 9093:9093
   257          environment:
   258            <<: *environment
   259            KAFKA_AUTHORIZER_CLASS_NAME: "kafka.security.authorizer.AclAuthorizer"
   260            KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
   261      steps: *steps
   262  
   263    kafka-271:
   264      working_directory: *working_directory
   265      environment:
   266        KAFKA_VERSION: "2.7.1"
   267  
   268        # Need to skip nettest to avoid these kinds of errors:
   269        #  --- FAIL: TestConn/nettest (17.56s)
   270        #    --- FAIL: TestConn/nettest/PingPong (7.40s)
   271        #      conntest.go:112: unexpected Read error: [7] Request Timed Out: the request exceeded the user-specified time limit in the request
   272        #      conntest.go:118: mismatching value: got 77, want 78
   273        #      conntest.go:118: mismatching value: got 78, want 79
   274        # ...
   275        #
   276        # TODO: Figure out why these are happening and fix them (they don't appear to be new).
   277        KAFKA_SKIP_NETTEST: "1"
   278      docker:
   279        - image: circleci/golang
   280        - image: wurstmeister/zookeeper
   281          ports:
   282            - 2181:2181
   283        - image: wurstmeister/kafka:2.13-2.7.1
   284          ports:
   285            - 9092:9092
   286            - 9093:9093
   287          environment:
   288            <<: *environment
   289            KAFKA_AUTHORIZER_CLASS_NAME: "kafka.security.authorizer.AclAuthorizer"
   290            KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
   291      steps: *steps
   292  
   293  workflows:
   294    version: 2
   295    run:
   296      jobs:
   297        - lint
   298        - kafka-010
   299        - kafka-011
   300        - kafka-101
   301        - kafka-111
   302        - kafka-201
   303        - kafka-211
   304        - kafka-222
   305        - kafka-231
   306        - kafka-241
   307        - kafka-260
   308        - kafka-271