我使用Gitlab CI / CD。我在管道上运行了不同的stage
。
对于deploy-staging
,当我的管道要在我的服务上运行图片时,我遇到了问题->
$ ssh deployer@$DEPLOYMENT_SERVER_IP "docker stop ${IMAGE_TAG}" || true
"docker stop" requires at least 1 argument.
See 'docker stop --help'.
Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]
Stop one or more running containers
$ ssh deployer@$DEPLOYMENT_SERVER_IP "docker rm ${IMAGE_TAG}" || true
"docker rm" requires at least 1 argument.
See 'docker rm --help'.
Usage: docker rm [OPTIONS] CONTAINER [CONTAINER...]
Remove one or more containers
$ ssh deployer@$DEPLOYMENT_SERVER_IP "docker rmi -f ${IMAGE_NAME}" || true
"docker rmi" requires at least 1 argument.
See 'docker rmi --help'.
Usage: docker rmi [OPTIONS] IMAGE [IMAGE...]
Remove one or more images
$ ssh deployer@$DEPLOYMENT_SERVER_IP "docker run --publish=8888:8888 -d ${IMAGE_NAME}"
"docker run" requires at least 1 argument.
See 'docker run --help'.
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new container
ln: failed to create symbolic link '/sys/fs/cgroup/systemd/name=systemd': Operation not permitted
ERROR: Job failed: exit code 1
yaml文件:
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- .maven/
image: maven:3-jdk-8
stages:
- build
- test
- analyze
- package
- release
- deploy
before_script:
- chmod +x mvnw
- export MAVEN_USER_HOME=`pwd`/.maven
- chmod +x mvnw
- ./mvnw com.github.eirslett:frontend-maven-plugin:install-node-and-npm -DnodeVersion=v10.13.0 -DnpmVersion=6.4.1 -Dmaven.repo.local=$MAVEN_USER_HOME
- ./mvnw com.github.eirslett:frontend-maven-plugin:npm -Dmaven.repo.local=$MAVEN_USER_HOME
maven-compile:
stage: build
script:
- ./mvnw clean compile -Dmaven.test.failure.ignore=true -Dmaven.test.skip=true -Dmaven.repo.local=$MAVEN_USER_HOME
artifacts:
paths:
- target/classes/
- target/generated-sources/
expire_in: 1 day
#maven-test:
# stage: test
# script:
# - ./mvnw test -Dmaven.repo.local=$MAVEN_USER_HOME
# artifacts:
# reports:
# junit: target/surefire-reports/TEST-*.xml
# paths:
# - target/test-results
# expire_in: 1 day
#frontend-test:
# stage: test
# script:
# - ./mvnw com.github.eirslett:frontend-maven-plugin:npm -Dfrontend.npm.arguments='test -- -u' -Dmaven.repo.local=$MAVEN_USER_HOME
# artifacts:
# reports:
# junit: target/test-results/jest/TESTS-*.xml
# paths:
# - target/test-results
# expire_in: 1 day
maven-package:
stage: package
script:
- ./mvnw verify -Pprod -Dmaven.test.failure.ignore=true -Dmaven.test.skip=true -Dmaven.repo.local=$MAVEN_USER_HOME
artifacts:
paths:
- target/*.war
expire_in: 1 day
docker-push:
image: docker:latest
services:
- docker:dind
variables:
REGISTRY_URL: registry.gitlab.com
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
IMAGE_TAG: ${CI_COMMIT_REF_SLUG}
stage: release
dependencies:
- maven-package
before_script:
- docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $REGISTRY_URL
script:
- docker build -f Dockerfile --tag=$IMAGE_TAG -t $IMAGE_NAME .
- docker push $IMAGE_NAME
deploy-staging:
stage: deploy
image: gitlab/dind:latest
cache: {}
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
before_script:
# add the server as a known host
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa
- ssh-keyscan -H $DEPLOYMENT_SERVER_IP >> ~/.ssh/known_hosts
script:
- ssh deployer@$DEPLOYMENT_SERVER_IP "docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}"
# stop container, remove image.
- ssh deployer@$DEPLOYMENT_SERVER_IP "docker stop ${IMAGE_TAG}" || true
- ssh deployer@$DEPLOYMENT_SERVER_IP "docker rm ${IMAGE_TAG}" || true
- ssh deployer@$DEPLOYMENT_SERVER_IP "docker rmi -f ${IMAGE_NAME}" || true
# start new container
- ssh deployer@$DEPLOYMENT_SERVER_IP "docker run --publish=8888:8888 -d ${IMAGE_NAME}"
only:
- develop
答案 0 :(得分:2)
看起来变量 UIView.animate(withDuration: 0.3, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 1, options: .curveEaseIn, animations: {
animationView.alpha = 1
}) { (true) in
UIView.animate(withDuration: 0.3, delay: 0, usingSpringWithDamping: 0.7, initialSpringVelocity: 1, options: .curveEaseIn, animations: {
infoImage.center.x = animationView.center.x
}) { (true) in
UIView.animate(withDuration: 1, delay: 0.5, usingSpringWithDamping: 0.7, initialSpringVelocity: 1, options: .curveEaseIn, animations: {
animationView.frame = CGRect(x: animationView.center.x, y: cellFrame.minY, width: cellFrame.width - 16, height: cellFrame.height + 200)
}) { (true) in
print("completed")
}
}
}
和$IMAGE_TAG
是空的。
您应该尝试在部署步骤中添加变量,诸如此类
$IMAGE_NAME