Remove unused field and sync azure provider
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
d3fe741cfe
commit
2085ad6945
4 changed files with 18 additions and 39 deletions
|
|
@ -75,7 +75,6 @@ function downloadURL() {
|
|||
}
|
||||
|
||||
function tempDownloadToken() {
|
||||
# temp_download_token
|
||||
[ -z "$1" -o -z "$2" ] && return 1
|
||||
GH_ARCH="${GARM_TO_GH_ARCH_MAP[$2]}"
|
||||
TOKEN=$(echo "$INPUT" | jq -c -r --arg OS "$1" --arg ARCH "$GH_ARCH" '(.tools[] | select( .os == $OS and .architecture == $ARCH)).temp_download_token')
|
||||
|
|
@ -127,7 +126,7 @@ function repoURL() {
|
|||
echo "${REPO}"
|
||||
}
|
||||
|
||||
function getRegistrationTokenFromAPI() {
|
||||
function ghAccessToken() {
|
||||
TOKEN_URL=$(runnerTokenURL)
|
||||
BEARER_TOKEN=$(callbackToken)
|
||||
TOKEN=$(curl --fail -s -X GET -H 'Accept: application/json' -H "Authorization: Bearer ${BEARER_TOKEN}" "${TOKEN_URL}")
|
||||
|
|
@ -135,15 +134,6 @@ function getRegistrationTokenFromAPI() {
|
|||
echo "${TOKEN}"
|
||||
}
|
||||
|
||||
function ghAccessToken() {
|
||||
TOKEN=$(echo "$INPUT" | jq -c -r '.github_runner_access_token')
|
||||
if [ -z "$TOKEN" ];then
|
||||
TOKEN=$(getRegistrationTokenFromAPI)
|
||||
fi
|
||||
checkValNotNull "${TOKEN}" "github_runner_access_token" || return $?
|
||||
echo "${TOKEN}"
|
||||
}
|
||||
|
||||
function callbackURL() {
|
||||
CB_URL=$(echo "$INPUT" | jq -c -r '."callback-url"')
|
||||
checkValNotNull "${CB_URL}" "callback-url" || return $?
|
||||
|
|
|
|||
|
|
@ -146,7 +146,6 @@ function downloadURL() {
|
|||
}
|
||||
|
||||
function tempDownloadToken() {
|
||||
# temp_download_token
|
||||
[ -z "$1" -o -z "$2" ] && return 1
|
||||
GH_ARCH="${GARM_TO_GH_ARCH_MAP[$2]}"
|
||||
TOKEN=$(echo "$INPUT" | jq -c -r --arg OS "$1" --arg ARCH "$GH_ARCH" '(.tools[] | select( .os == $OS and .architecture == $ARCH)).temp_download_token')
|
||||
|
|
|
|||
|
|
@ -107,15 +107,14 @@ type UpdatePoolParams struct {
|
|||
}
|
||||
|
||||
type CreateInstanceParams struct {
|
||||
Name string
|
||||
OSType config.OSType
|
||||
OSArch config.OSArch
|
||||
Status common.InstanceStatus
|
||||
RunnerStatus common.RunnerStatus
|
||||
CallbackURL string
|
||||
MetadataURL string
|
||||
CreateAttempt int `json:"-"`
|
||||
GithubRegistrationToken []byte `json:"-"`
|
||||
Name string
|
||||
OSType config.OSType
|
||||
OSArch config.OSArch
|
||||
Status common.InstanceStatus
|
||||
RunnerStatus common.RunnerStatus
|
||||
CallbackURL string
|
||||
MetadataURL string
|
||||
CreateAttempt int `json:"-"`
|
||||
}
|
||||
|
||||
type CreatePoolParams struct {
|
||||
|
|
|
|||
|
|
@ -345,25 +345,16 @@ func (r *basePoolManager) AddRunner(ctx context.Context, poolID string) error {
|
|||
}
|
||||
|
||||
name := fmt.Sprintf("garm-%s", uuid.New())
|
||||
tk, err := r.helper.GetGithubRegistrationToken()
|
||||
if err != nil {
|
||||
if errors.Is(err, runnerErrors.ErrUnauthorized) {
|
||||
failureReason := fmt.Sprintf("failed to fetch registration token: %q", err)
|
||||
r.setPoolRunningState(false, failureReason)
|
||||
log.Print(failureReason)
|
||||
}
|
||||
return errors.Wrap(err, "fetching registration token")
|
||||
}
|
||||
|
||||
createParams := params.CreateInstanceParams{
|
||||
Name: name,
|
||||
Status: providerCommon.InstancePendingCreate,
|
||||
RunnerStatus: providerCommon.RunnerPending,
|
||||
OSArch: pool.OSArch,
|
||||
OSType: pool.OSType,
|
||||
GithubRegistrationToken: []byte(tk),
|
||||
CallbackURL: r.helper.GetCallbackURL(),
|
||||
MetadataURL: r.helper.GetMetadataURL(),
|
||||
CreateAttempt: 1,
|
||||
Name: name,
|
||||
Status: providerCommon.InstancePendingCreate,
|
||||
RunnerStatus: providerCommon.RunnerPending,
|
||||
OSArch: pool.OSArch,
|
||||
OSType: pool.OSType,
|
||||
CallbackURL: r.helper.GetCallbackURL(),
|
||||
MetadataURL: r.helper.GetMetadataURL(),
|
||||
CreateAttempt: 1,
|
||||
}
|
||||
|
||||
_, err = r.store.CreateInstance(r.ctx, poolID, createParams)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue