gpt4 book ai didi

oracle - 如何在Gitlab-ci中执行SQL文件

转载 作者:行者123 更新时间:2023-12-02 19:52:53 29 4
gpt4 key购买 nike

我发现了gitlab-ci,我想创建一个在每次提交后执行sql脚本的管道。
为此,我使用了dockerhub sqlplus镜像sflyr / sqlplus。

我的.gitlab-ci.yml:

    stages:
- build



code_quality:
stage: build
image: registry.pic.services.prod/valentine/ci/docker-dind:0.0.3
services:
- name: registry.pic.services.prod/valentine/ci/docker-dind:0.0.3
allow_failure: true
script:
- setup_docker
- docker pull sflyr/sqlplus
- docker run -e URL=*/*@//*/* -i sflyr/sqlplus < file.sql

.function: &function |
function setup_docker() {
if ! docker info &>/dev/null; then
if [ -z "$DOCKER_HOST" -a "$KUBERNETES_PORT" ]; then
export DOCKER_HOST='tcp://localhost:2375'
fi
fi
}


before_script:
- *function

我有错误:
SQL*Plus: Release 11.2.0.3.0 Production on Mon Dec 30 15:58:59 2019

Copyright (c) 1982, 2011, Oracle. All rights reserved.

ERROR:
ORA-12170: TNS:Connect timeout occurred


Enter user-name: SP2-0306: Invalid option.

最佳答案

我在docker中做docker,答案比那更简单:

    stages:
- build

code_quality:
stage: build
tags:
- [Runner]
image:
name: sflyr/sqlplus
entrypoint: ["/bin/sh"]
allow_failure: true
script:
- /instantclient_11_2/sqlplus */*@*/* @file.sql

关于oracle - 如何在Gitlab-ci中执行SQL文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59426786/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com