搜索

首页  >  问答  >  正文

git lab runner 无法连接到 api.local 端口 80: 连接被拒绝

gitlab-runner 1.29 管道存在问题,在 before_script: apache2 配置 Docker 文件部分的 .gitlab.ci.yml 中看不到设置的虚拟主机。

这是我运行行为测试时出现的问题。我花了 3 天尝试解决这个问题,但现在我不知道,请有人帮助我。

#Pipeline runer

$ eval $(ssh-agent -s)
Agent pid 12
$ ssh-add <(echo "$SSH_PRIVATE_KEY")
Identity added: /dev/fd/63 (root@area51)
$ echo "export APPLICATION_ENV='test'" >> /etc/apache2/envvars
$ export APPLICATION_ENV='test'
$ rm /var/www/globkurier.pl/globkurier.pl -R
$ ln -s /builds/znatury/globkurier.pl/ /var/www/globkurier.pl/globkurier.pl
$ mkdir -p /var/log/apache2/
$ chmod -R 744 /var/log/apache2/
$ echo '127.0.0.1 api.local' >> /etc/hosts
$ echo '127.0.0.1 api.mock' >> /etc/hosts
$ apache2ctl start
$ bash prepare-database.sh all
Uploading database schema...
Uploading database fixtures...
$ bash test.sh behat routingAndAcl
.F-.F-.F--.F-.F-
--- Failed steps:
001 Scenario: An attempt to refer to an uri using a non-existent method # features/valid/routing-and-acl.feature:7
      When I send the request                                           # features/valid/routing-and-acl.feature:9
        [curl] 7: Failed to connect to api.local port 80: Connection refused [url] http://api.local/v1/user/profile (Guzzle\Http\Exception\CurlException)
002 Scenario: An attempt to refer to an uri using a non-logged user # features/valid/routing-and-acl.feature:12
      When I send the request                                       # features/valid/routing-and-acl.feature:14
        [curl] 7: Failed to connect to api.local port 80: Connection refused [url] http://api.local/v1/user/profile (Guzzle\Http\Exception\CurlException)
003 Scenario: Header list from method OPTIONS should return all available methods # features/valid/routing-and-acl.feature:17
      When I send the request                                                     # features/valid/routing-and-acl.feature:19
        [curl] 7: Failed to connect to api.local port 80: Connection refused [url] http://api.local/v1/user/profile (Guzzle\Http\Exception\CurlException)

#Dockerfile

FROM php:5.6-apache

WORKDIR /var/www/

RUN mkdir -p globkurier.pl/globkurier.pl
RUN mkdir library

WORKDIR /var/www/globkurier.pl/globkurier.pl

RUN echo "[PHP]" > /usr/local/etc/php/php.ini
RUN echo "" >> /usr/local/etc/php/php.ini
RUN echo "date.timezone = \"Europe/Warsaw\"" >> /usr/local/etc/php/php.ini
RUN echo "memory_limit = -1" >> /usr/local/etc/php/php.ini

RUN a2enmod rewrite

RUN apt-get upgrade -y

RUN apt-get update --fix-missing

RUN apt-get install -y \
    libcurl4-openssl-dev \
    zlib1g-dev \
    libmcrypt-dev \
    libxml2-dev \
    libc-client-dev \
    libkrb5-dev \
    openssh-client \
    openssl \
    git \
    netcat \
    wget \
    cron \
    nano-tiny \
    netcat \
    wget \
    cron \
    nano-tiny \
    libpng-dev

RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl
RUN docker-php-ext-install \
    mcrypt \
    bcmath \
    pdo \
    pdo_mysql \
    curl \
    mbstring \
    mysql \
    zip \
    imap \
    soap \
    curl \
    json \
    sockets \
    gd

#composer
RUN wget https://getcomposer.org/download/1.10.19/composer.phar
RUN chmod 755 composer.phar
RUN mv composer.phar /usr/local/bin/composer

RUN curl -sL https://deb.nodesource.com/setup_12.x | bash
#node
RUN apt-get install -y nodejs

#ssh
RUN echo "Host gitlab.com\n    StrictHostKeyChecking no" >> /etc/ssh/ssh_config

COPY Docker/apache2/v-hosts/000-default.conf /etc/apache2/sites-available/000-default.conf
COPY Docker/apache2/v-hosts/api.local.conf /etc/apache2/sites-available/api.local.conf
COPY Docker/apache2/v-hosts/api.local.conf /etc/apache2/sites-available/api.mock.conf

COPY Docker/apache2/apache2.conf /etc/apache2/apache2.conf
COPY Docker/apache2/ports.conf /etc/apache2/ports.conf

RUN a2ensite api.local.conf
RUN a2ensite api.mock.conf

#redis
RUN pecl install redis-2.2.8 && docker-php-ext-enable redis

#stop apache2 complains about no server name specified
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf

RUN docker-php-ext-install opcache
COPY opcache.ini /usr/local/etc/php/conf.d/opcache.ini

这是我的 .gitlab.ci.yml

image: registry.gitlab.com/znatury/globkurier.pl:2.3.6

stages:
  - build
  - test & preview

cache:
  paths:
    - vendor/

variables:
  MYSQL_DATABASE: globkurier_test
  MYSQL_ROOT_PASSWORD: DSnUAW6RFkp7F6h4WqbMSwXY946MBFXC

before_script:
  - eval $(ssh-agent -s)
  - ssh-add <(echo "$SSH_PRIVATE_KEY")
  - echo "export APPLICATION_ENV='test'" >> /etc/apache2/envvars
  - export APPLICATION_ENV='test'
  - rm /var/www/globkurier.pl/globkurier.pl -R
  - ln -s /builds/znatury/globkurier.pl/ /var/www/globkurier.pl/globkurier.pl
  - mkdir -p /var/log/apache2/
  - chmod -R 744 /var/log/apache2/
  - echo '127.0.0.1 api.local' >> /etc/hosts
  - echo '127.0.0.1 api.mock' >> /etc/hosts
  - apache2ctl start
  - apache2ctl status

build:
  stage: build
  artifacts:
    expire_in: 1h
    paths:
      - vendor
  script:
    - composer install --no-progress
  tags:
    - area51-1

valid-1:
  stage: test & preview
  services:
    - mysql:5.7
  script:
    - bash prepare-database.sh all
    - bash test.sh behat routingAndAcl
    - bash test.sh behat documentation
    - bash test.sh behat addressBook
    - bash test.sh behat address
    - bash test.sh behat countries
    - bash test.sh behat states
    - bash test.sh behat points
    - bash test.sh behat productSearch
    - bash test.sh behat productPricing
    - bash test.sh behat zoho
  tags:
    - area51-1

valid-2:
  stage: test & preview
  services:
    - mysql:5.7
    - schickling/mailcatcher
  script:
    - bash prepare-database.sh all
    - bash test.sh behat customRequiredFields
    - bash test.sh behat discountCode
    - bash test.sh behat bestPriceOrder
    - bash test.sh behat bankAccountNumbers
    - bash test.sh behat paymentsList
    - bash test.sh behat onlinePayments
    - bash test.sh behat orderPartialValidation
    - bash test.sh behat orderAddons
    - bash test.sh behat orderFuelSurcharge
    - bash test.sh behat orderPayments
    - bash test.sh behat orderPrice
    - bash test.sh behat orderPriceGroup
    - bash test.sh behat orderPurposeAndDeclaredValue
    - bash test.sh behat orderReferenceNumber
    - bash test.sh behat orderWaybill
    - bash test.sh behat orderTax
    - bash test.sh behat orderTracking
    - bash test.sh behat orderUserNotFullyRegistered
    - bash test.sh behat orderWithSalesMargin
    - bash test.sh behat tradeDocument
    - bash test.sh behat invoice
    - bash test.sh behat invoicePayByPrepaid
  tags:
    - area51-1

valid-3:
  stage: test & preview
  services:
    - mysql:5.7
    - schickling/mailcatcher
  script:
    - bash prepare-database.sh all
    - bash test.sh behat userAuth
    - bash test.sh behat userEdit
    - bash test.sh behat userRegistration
    - bash test.sh behat userPaymentList
    - bash test.sh behat userInvoices
    - bash test.sh behat userOrderCancel
    - bash test.sh behat partnerProgram
    - bash test.sh behat pickupListProtocols
    - bash test.sh behat ordersList
    - bash test.sh behat ordersStatistic
    - bash test.sh behat ordersCashOnDelivery
    - bash test.sh behat customsDocument
    - bash test.sh behat productTemplate
    - bash test.sh behat orderDraft
  tags:
    - area51-1

valid-4:
  stage: test & preview
  services:
    - mysql:5.7
  script:
    - bash prepare-database.sh all
    - bash test.sh behat adminCarrierConfigs
    - bash test.sh behat adminCountryZone
    - bash test.sh behat adminFuelSurcharges
    - bash test.sh behat adminOnlineProviders
    - bash test.sh behat adminOrderCancel
    - bash test.sh behat adminPdfFile
    - bash test.sh behat adminProductAddon
    - bash test.sh behat adminProductAddonSort
    - bash test.sh behat adminProductLabel
    - bash test.sh behat adminProductParameters
    - bash test.sh behat adminProductPrices
    - bash test.sh behat adminProductPriceHash
    - bash test.sh behat adminReportUserSettlements
    - bash test.sh behat adminUserDelete
    - bash test.sh behat adminUserPutAccountManager
    - bash test.sh behat adminUserRegistrationLink
    - bash test.sh behat adminUserInvoices
    - bash test.sh behat adminCustomDocument
  tags:
    - area51-1

valid-5:
  stage: test & preview
  services:
    - mysql:5.7
  script:
    - apt-get update
    - apt-get upgrade -y
    - bash prepare-database.sh all
    - bash test.sh behat integrationPlatform
    - bash test.sh behat tradePlatform
  tags:
    - area51-1

deprecated-problematic:
  stage: test & preview
  services:
    - mysql:5.7
    - schickling/mailcatcher
  script:
    - bash prepare-database.sh all
    - bash test.sh behat problematicScenarios
  tags:
    - area51-1

deprecated-other:
  stage: test & preview
  services:
    - mysql:5.7
    - schickling/mailcatcher
  script:
    - bash prepare-database.sh all
    - bash test.sh behat allegro
    - bash test.sh behat order
    - bash test.sh behat other
    - bash test.sh behat product
    - bash test.sh behat registration
  tags:
    - area51-1

deprecated-user:
  stage: test & preview
  services:
    - mysql:5.7
    - schickling/mailcatcher
  script:
    - bash prepare-database.sh all
    - bash test.sh behat user
  tags:
    - area51-1
$PREVIEW_CONTAINER_WEB bash -c 'find -delete'"
$PREVIEW_HOST:$PREVIEW_DIR
$PREVIEW_SLUG $PREVIEW_DIR $DB_CONFIGURATION"
spec:
  stage: test & preview
  services:
    - mysql:5.7
  script:
    - bash prepare-database.sh all
    - bash test.sh spec
  tags:
    - area51-1

P粉771233336P粉771233336240 天前361

全部回复(1)我来回复

  • P粉199248808

    P粉1992488082024-03-27 18:21:59

    我与 Zoho IT 部门交谈,他们说它不再起作用,我们需要使用另一个代码。

    他们向我提供的此链接:https://www.zoho.com/crm/developer/docs/csharp-sdk/v2/record-samples.html?src=create_records

    回复
    0
  • 取消回复