Skip to content

Commit

Permalink
update README and change image name
Browse files Browse the repository at this point in the history
  • Loading branch information
JacieChao committed Jan 4, 2024
1 parent 3fdc8e7 commit c13b91d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 15 deletions.
55 changes: 43 additions & 12 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
kind: pipeline
type: docker
name: amd64
name: default

platform:
os: linux
Expand All @@ -24,20 +24,51 @@ steps:
event:
- push
- pull_request
- tag
volumes:
- name: docker
host:
path: /var/run/docker.sock

trigger:
event:
exclude:
- tag

node:
instance: agent-amd64

---

kind: pipeline
type: docker
name: package

platform:
os: linux
arch: amd64

steps:
- name: build
image: rancher/dapper:v0.6.0
environment:
OAUTH_TOKEN:
from_secret: github_token
privileged: true
commands:
- dapper ci
volumes:
- name: docker
path: /var/run/docker.sock
- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: cnrancher/rancher-upgrade-authtool
repo: cnrancher/authtool
tag: "${DRONE_TAG}"
username:
from_secret: docker_username
when:
event:
- tag
- name: github_binary_release
image: plugins/github-release
settings:
Expand All @@ -46,17 +77,17 @@ steps:
prerelease: true
checksum:
- sha256
checksum_file: checksum-amd64.txt
checksum_flatten: true
files:
- "bin/authtool"
when:
event:
- tag

volumes:
- name: docker
host:
path: /var/run/docker.sock
trigger:
event:
include:
- tag

node:
instance: agent-amd64
instance: agent-amd64
2 changes: 1 addition & 1 deletion Dockerfile.dapper
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN zypper -n install gcc binutils glibc-devel-static ca-certificates git-core w

RUN zypper install -y -f docker

ENV DAPPER_ENV REPO TAG OAUTH_TOKEN
ENV DAPPER_ENV REPO TAG OAUTH_TOKEN DRONE_TAG
ENV DAPPER_SOURCE /go/src/github.com/cnrancher/rancher-upgrade-authtool/
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ authtool --kubeconfig=<kube-config> --auth-type=0 --dry-run=true --log-file=<log
We also support using upgrade tool by docker. If you're running outside the local cluster, please mount kubeconfig file to container.
For example:
```
docker run -v /tmp/kubeconfig.yaml:/tmp/kubeconfig.yaml cnrancher/authtool:v2.8-ent authtool --kubeconfig=/tmp/kubeconfig.yaml --dry-run=true --auth-type=1 upgrade
docker run --entrypoint bash -v $(pwd)/kubeconfig.yaml:/tmp/kubeconfig.yaml -it cnrancher/authtool:v2.8-ent
# then run command inside the container
authtool --kubeconfig=/tmp/kubeconfig.yaml --dry-run=true --auth-type=1 upgrade
```

> Please using `--dry-run=true` before running the command to make sure running result as expect.
Expand Down
7 changes: 6 additions & 1 deletion scripts/version
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
fi

COMMIT=$(git rev-parse --short HEAD)
GIT_TAG=$(git tag -l --contains HEAD | head -n 1)
GIT_TAG=${DRONE_TAG:-$(git tag -l --contains HEAD | head -n 1)}

if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then
VERSION=$GIT_TAG
Expand All @@ -17,5 +17,10 @@ if [ -z "$ARCH" ]; then
ARCH=amd64
fi

if [ -n "$DRONE_TAG" ]; then
TAG=$DRONE_TAG
fi

echo "ARCH: $ARCH"
echo "TAG: $TAG"
echo "VERSION: $VERSION"

0 comments on commit c13b91d

Please sign in to comment.