kind: pipeline
type: ssh # 使用SSH
name: baidu


server:
  host:
    from_secret: ssh_host
  user:
    from_secret: ssh_user
  password:
    from_secret: ssh_password

clone:
  disable: true

steps:
  - name: test
    commands:
      - echo test start
      - date
      - export PATH=$PATH:/usr/local/go/bin
      - cd /root
      - rm -rf IPRegion
      - git clone https://git.sre.ink/go/IPRegion.git
      - cd IPRegion
      - make test-linux-arm64
      - date
      - echo test end
  - name: build
    commands:
      - echo test start
      - date
      - export PATH=$PATH:/usr/local/go/bin
      - cd /root
      - rm -rf IPRegion
      - git clone https://git.sre.ink/go/IPRegion.git
      - cd IPRegion
      - make build-linux-arm64
      - date
      - echo build end
  - name: package
    commands:
      - echo package start
      - date
      - cd /root/IPRegion
      - docker build -t sre/ipregion:arm64 .
      - date
      - echo package end
  - name: deploy
    commands:
      - echo deploy start
      - date
      - export KUBECONFIG=/etc/kubernetes/admin.conf
      - kubectl rollout restart deployment -n sre ipregion
      - date
      - echo deploy end
  - name: alert
    commands:
      - echo alert start
      - date
      - echo deploy ok
      - date
      - echo alert end