my_cobalt_strike/.gitlab-ci.yml
2022-08-05 22:01:57 +08:00

59 lines
2.2 KiB
YAML

variables:
# Package version can only contain numbers (0-9), and dots (.).
# Must be in the format of X.Y.Z, i.e. should match /\A\d+\.\d+\.\d+\z/ regular expresion.
# See https://docs.gitlab.com/ee/user/packages/generic_packages/#publish-a-package-file
PACKAGE_VERSION: "1.3.0"
LINUX_AMD64_BINARY: "console-${PACKAGE_VERSION}"
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/cobalt-strike/${PACKAGE_VERSION}"
CI_COMMIT_TAG: "1.3.0"
POD_VERSION: "1-3-0"
stages:
- build
- deploy
- release
bin_build:
stage: build
script:
- go build -o console-${PACKAGE_VERSION} console.go
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${LINUX_AMD64_BINARY} "${PACKAGE_REGISTRY_URL}/${LINUX_AMD64_BINARY}"
artifacts:
paths:
- console-${PACKAGE_VERSION}
docker_build:
stage: build
image: docker:latest
script:
- docker build -t console:${PACKAGE_VERSION} .
- docker tag console:${PACKAGE_VERSION} reg.sre.victor-core.top/cobalt-strike/console:${PACKAGE_VERSION}
- echo Precinct7460|docker login reg.sre.victor-core.top -u sangge --password-stdin
- docker push reg.sre.victor-core.top/cobalt-strike/console:${PACKAGE_VERSION}
tags:
- cluster
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- |
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"${LINUX_AMD64_BINARY}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_AMD64_BINARY}\"}"
docker_deploy:
stage: deploy
image:
name: bitnami/kubectl
entrypoint: [""]
script:
# - kubectl apply -f deploy.yaml --kubeconfig=.kube/config --certificate-authority=.kube/ca.pem
# - kubectl apply -f traefik-config.yaml --kubeconfig=.kube/config --certificate-authority=.kube/ca.pem
# - kubectl apply -f ingressrouter.yaml --kubeconfig=.kube/config --certificate-authority=.kube/ca.pem
- kubectl create deployment console --image=reg.sre.victor-core.top/cobalt-strike/console:1.3.0 --kubeconfig=.kube/config --certificate-authority=.kube/ca.pem --port=4444
- kubectl expose deployment console --type=NodePort --kubeconfig=.kube/config --certificate-authority=.kube/ca.pem
tags:
- cluster