From 3c0dc9a7161dbd10cadf62578ce520a5ac8b5c2c Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Mon, 5 Aug 2024 12:07:24 +0000 Subject: [PATCH] Update garm-provider-common and add build scripts This change adds build scripts common to all providers maintained by us. Signed-off-by: Gabriel Adrian Samfira --- .github/workflows/go-tests.yml | 2 +- .gitignore | 4 +- Dockerfile | 15 +++++ Makefile | 58 +++++++++++++++++- go.mod | 10 +-- go.sum | 12 ++-- main.go | 15 +++++ scripts/build-static.sh | 48 +++++++++++++++ scripts/make-release.sh | 56 +++++++++++++++++ .../cloudconfig/templates.go | 61 ++++++++++++++++++- .../garm-provider-common/params/github.go | 14 +++++ vendor/golang.org/x/crypto/bcrypt/bcrypt.go | 2 +- vendor/golang.org/x/crypto/blowfish/cipher.go | 2 +- .../chacha20poly1305/chacha20poly1305.go | 2 +- vendor/golang.org/x/crypto/hkdf/hkdf.go | 2 +- vendor/golang.org/x/sys/unix/mremap.go | 5 ++ .../golang.org/x/sys/unix/syscall_darwin.go | 12 ++++ vendor/golang.org/x/sys/unix/syscall_unix.go | 9 +++ .../x/sys/unix/zsyscall_darwin_amd64.go | 33 ++++++++++ .../x/sys/unix/zsyscall_darwin_amd64.s | 10 +++ .../x/sys/unix/zsyscall_darwin_arm64.go | 33 ++++++++++ .../x/sys/unix/zsyscall_darwin_arm64.s | 10 +++ vendor/modules.txt | 10 +-- 23 files changed, 400 insertions(+), 25 deletions(-) create mode 100644 Dockerfile create mode 100755 scripts/build-static.sh create mode 100755 scripts/make-release.sh diff --git a/.github/workflows/go-tests.yml b/.github/workflows/go-tests.yml index 534d96a..1ed634b 100644 --- a/.github/workflows/go-tests.yml +++ b/.github/workflows/go-tests.yml @@ -24,4 +24,4 @@ jobs: - run: go version - name: Run GARM Go Tests - run: make go-test \ No newline at end of file + run: make test diff --git a/.gitignore b/.gitignore index 7447f89..b53f297 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -/bin \ No newline at end of file +bin/ +release/ +build/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ae023b7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM docker.io/golang:alpine + +WORKDIR /root +USER root + +RUN apk add musl-dev gcc libtool m4 autoconf g++ make libblkid util-linux-dev git linux-headers mingw-w64-gcc + +RUN wget http://musl.cc/aarch64-linux-musl-cross.tgz -O /tmp/aarch64-linux-musl-cross.tgz && \ + tar --strip-components=1 -C /usr/local -xzf /tmp/aarch64-linux-musl-cross.tgz && \ + rm /tmp/aarch64-linux-musl-cross.tgz + +ADD ./scripts/build-static.sh /build-static.sh +RUN chmod +x /build-static.sh + +CMD ["/bin/sh"] diff --git a/Makefile b/Makefile index 4f159ab..fae8caf 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,60 @@ SHELL := bash -.PHONY: go-test +ROOTDIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +GOPATH ?= $(shell go env GOPATH) +GO ?= go + +IMAGE_TAG = garm-provider-build + +USER_ID=$(shell ((docker --version | grep -q podman) && echo "0" || id -u)) +USER_GROUP=$(shell ((docker --version | grep -q podman) && echo "0" || id -g)) +GARM_PROVIDER_NAME := garm-provider-aws + +default: build + +.PHONY : build build-static test install-lint-deps lint go-test fmt fmtcheck verify-vendor verify create-release-files release + +build: + @$(GO) build . + +clean: ## Clean up build artifacts + @rm -rf ./bin ./build ./release + +build-static: + @echo Building + docker build --tag $(IMAGE_TAG) . + mkdir -p build + docker run --rm -e USER_ID=$(USER_ID) -e USER_GROUP=$(USER_GROUP) -v $(PWD)/build:/build/output:z -v $(PWD):/build/$(GARM_PROVIDER_NAME):z $(IMAGE_TAG) /build-static.sh + @echo Binaries are available in $(PWD)/build + +test: verify go-test + +install-lint-deps: + @$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + +lint: + @golangci-lint run --timeout=8m --build-tags testing go-test: - go test -v ./... $(TEST_ARGS) -timeout=15m -parallel=4 \ No newline at end of file + @$(GO) test -race -mod=vendor -tags testing -v $(TEST_ARGS) -timeout=15m -parallel=4 -count=1 ./... + +fmt: + @$(GO) fmt $$(go list ./...) + +fmtcheck: + @gofmt -l -s $$(go list ./... | sed -n 's/github.com\/cloudbase\/'$(GARM_PROVIDER_NAME)'\/\(.*\)/\1/p') | grep ".*\.go"; if [ "$$?" -eq 0 ]; then echo "gofmt check failed; please tun gofmt -w -s"; exit 1;fi + +verify-vendor: ## verify if all the go.mod/go.sum files are up-to-date + $(eval TMPDIR := $(shell mktemp -d)) + @cp -R ${ROOTDIR} ${TMPDIR} + @(cd ${TMPDIR}/$(GARM_PROVIDER_NAME) && ${GO} mod tidy) + @diff -r -u -q ${ROOTDIR} ${TMPDIR}/$(GARM_PROVIDER_NAME) >/dev/null 2>&1; if [ "$$?" -ne 0 ];then echo "please run: go mod tidy && go mod vendor"; exit 1; fi + @rm -rf ${TMPDIR} + +verify: verify-vendor lint fmtcheck + +##@ Release +create-release-files: + ./scripts/make-release.sh + +release: build-static create-release-files ## Create a release diff --git a/go.mod b/go.mod index e507d37..37fbff9 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/cloudbase/garm-provider-aws -go 1.21.3 +go 1.22 + +toolchain go1.22.3 require ( github.com/BurntSushi/toml v1.4.0 @@ -9,7 +11,7 @@ require ( github.com/aws/aws-sdk-go-v2/credentials v1.17.20 github.com/aws/aws-sdk-go-v2/service/ec2 v1.165.0 github.com/aws/smithy-go v1.20.2 - github.com/cloudbase/garm-provider-common v0.1.2 + github.com/cloudbase/garm-provider-common v0.1.3 github.com/stretchr/testify v1.9.0 github.com/xeipuuv/gojsonschema v1.2.0 ) @@ -37,8 +39,8 @@ require ( github.com/teris-io/shortid v0.0.0-20220617161101-71ec9f2aa569 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect - golang.org/x/crypto v0.24.0 // indirect - golang.org/x/sys v0.21.0 // indirect + golang.org/x/crypto v0.25.0 // indirect + golang.org/x/sys v0.22.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 16d578b..aece7a6 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.29.0 h1:dqW4XRwPE/poWSqVntpeXLHzpPK6 github.com/aws/aws-sdk-go-v2/service/sts v1.29.0/go.mod h1:j8+hrxlmLR8ZQo6ytTAls/JFrt5bVisuS6PD8gw2VBw= github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= -github.com/cloudbase/garm-provider-common v0.1.2 h1:EqSpUjw9rzo4PiUmteHkFtZNWCnRi0QXHRKZ+VA1IPo= -github.com/cloudbase/garm-provider-common v0.1.2/go.mod h1:igxJRT3OlykERYc6ssdRQXcb+BCaeSfnucg6I0OSoDc= +github.com/cloudbase/garm-provider-common v0.1.3 h1:8pHSRs2ljwLHgtDrge68dZ7ILUW97VF5h2ZA2fQubGQ= +github.com/cloudbase/garm-provider-common v0.1.3/go.mod h1:VIJzbcg5iwyD4ac99tnnwcActfwibn/VOt2MYOFjf2c= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -66,11 +66,11 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= diff --git a/main.go b/main.go index 9f058fa..21178b4 100644 --- a/main.go +++ b/main.go @@ -30,7 +30,22 @@ var signals = []os.Signal{ syscall.SIGTERM, } +var ( + // Version is the version of the application + Version = "v0.0.0-unknown" +) + func main() { + // This is an unofficial command. It will be added into future versions of the + // external provider interface. For now we manually hardcode it here. This is not + // used by GARM itself. It is informative for the user to be able to check the version + // of the provider. + garmCommand := os.Getenv("GARM_COMMAND") + if garmCommand == "GetVersion" { + fmt.Println(Version) + os.Exit(0) + } + ctx, stop := signal.NotifyContext(context.Background(), signals...) defer stop() diff --git a/scripts/build-static.sh b/scripts/build-static.sh new file mode 100755 index 0000000..420e4c5 --- /dev/null +++ b/scripts/build-static.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +GARM_PROVIDER_NAME=${GARM_PROVIDER_NAME:-garm-provider-aws} +GARM_SOURCE="/build/$GARM_PROVIDER_NAME" +git config --global --add safe.directory /build/$GARM_PROVIDER_NAME +cd $GARM_SOURCE + +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) +if [ ! -z "$GARM_REF" ] && [ "$GARM_REF" != "$CURRENT_BRANCH" ];then + git checkout $GARM_REF +fi + +cd $GARM_SOURCE + +OUTPUT_DIR="/build/output" +VERSION=$(git describe --tags --match='v[0-9]*' --dirty --always) +BUILD_DIR="$OUTPUT_DIR/$VERSION" + + +[ ! -d "$BUILD_DIR/linux" ] && mkdir -p "$BUILD_DIR/linux" +[ ! -d "$BUILD_DIR/windows" ] && mkdir -p "$BUILD_DIR/windows" + +export CGO_ENABLED=1 +USER_ID=${USER_ID:-$UID} +USER_GROUP=${USER_GROUP:-$(id -g)} + +# Garm +cd $GARM_SOURCE + +# Linux +GOOS=linux GOARCH=amd64 go build -mod vendor \ + -o $BUILD_DIR/linux/amd64/$GARM_PROVIDER_NAME \ + -tags osusergo,netgo,sqlite_omit_load_extension \ + -ldflags "-extldflags '-static' -s -w -X main.Version=$VERSION" . +GOOS=linux GOARCH=arm64 CC=aarch64-linux-musl-gcc go build \ + -mod vendor \ + -o $BUILD_DIR/linux/arm64/$GARM_PROVIDER_NAME \ + -tags osusergo,netgo,sqlite_omit_load_extension \ + -ldflags "-extldflags '-static' -s -w -X main.Version=$VERSION" . + +# Windows +GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-cc go build -mod vendor \ + -o $BUILD_DIR/windows/amd64/$GARM_PROVIDER_NAME.exe \ + -tags osusergo,netgo,sqlite_omit_load_extension \ + -ldflags "-s -w -X main.Version=$VERSION" . + +git checkout $CURRENT_BRANCH || true +chown $USER_ID:$USER_GROUP -R "$OUTPUT_DIR" diff --git a/scripts/make-release.sh b/scripts/make-release.sh new file mode 100755 index 0000000..299c504 --- /dev/null +++ b/scripts/make-release.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +echo $GARM_REF +GARM_PROVIDER_NAME=${GARM_PROVIDER_NAME:-garm-provider-aws} + +VERSION=$(git describe --tags --match='v[0-9]*' --dirty --always) +RELEASE="$PWD/release" + +[ ! -d "$RELEASE" ] && mkdir -p "$RELEASE" + +if [ ! -z "$GARM_REF" ]; then + VERSION=$(git describe --tags --match='v[0-9]*' --always $GARM_REF) +fi + +echo $VERSION + +if [ ! -d "build/$VERSION" ]; then + echo "missing build/$VERSION" + exit 1 +fi + +# Windows + +if [ ! -d "build/$VERSION/windows/amd64" ];then + echo "missing build/$VERSION/windows/amd64" + exit 1 +fi + +if [ ! -f "build/$VERSION/windows/amd64/$GARM_PROVIDER_NAME.exe" ];then + echo "missing build/$VERSION/windows/amd64/$GARM_PROVIDER_NAME.exe" + exit 1 +fi + +pushd build/$VERSION/windows/amd64 +zip $GARM_PROVIDER_NAME-windows-amd64.zip $GARM_PROVIDER_NAME.exe +sha256sum $GARM_PROVIDER_NAME-windows-amd64.zip > $GARM_PROVIDER_NAME-windows-amd64.zip.sha256 +mv $GARM_PROVIDER_NAME-windows-amd64.zip $RELEASE +mv $GARM_PROVIDER_NAME-windows-amd64.zip.sha256 $RELEASE +popd + +# Linux +OS_ARCHES=("amd64" "arm64") + +for arch in ${OS_ARCHES[@]};do + if [ ! -f "build/$VERSION/linux/$arch/$GARM_PROVIDER_NAME" ];then + echo "missing build/$VERSION/linux/$arch/$GARM_PROVIDER_NAME" + exit 1 + fi + + pushd build/$VERSION/linux/$arch + tar czf $GARM_PROVIDER_NAME-linux-$arch.tgz $GARM_PROVIDER_NAME + sha256sum $GARM_PROVIDER_NAME-linux-$arch.tgz > $GARM_PROVIDER_NAME-linux-$arch.tgz.sha256 + mv $GARM_PROVIDER_NAME-linux-$arch.tgz $RELEASE + mv $GARM_PROVIDER_NAME-linux-$arch.tgz.sha256 $RELEASE + popd +done diff --git a/vendor/github.com/cloudbase/garm-provider-common/cloudconfig/templates.go b/vendor/github.com/cloudbase/garm-provider-common/cloudconfig/templates.go index ab51d8e..f7af557 100644 --- a/vendor/github.com/cloudbase/garm-provider-common/cloudconfig/templates.go +++ b/vendor/github.com/cloudbase/garm-provider-common/cloudconfig/templates.go @@ -35,6 +35,10 @@ set -x CALLBACK_URL="{{ .CallbackURL }}" METADATA_URL="{{ .MetadataURL }}" BEARER_TOKEN="{{ .CallbackToken }}" +{{- if .ExtraContext.OFS_DIR }} +OFS_DIR_E="{{ .ExtraContext.OFS_DIR }}" +{{- end }} +OFS_DIR=${OFS_DIR_E:-"/opt/work"} if [ -z "$METADATA_URL" ];then echo "no token is available and METADATA_URL is not set" @@ -126,8 +130,16 @@ if [ -z "$CACHED_RUNNER" ];then sudo ./bin/installdependencies.sh || fail "failed to install dependencies" else sendStatus "using cached runner found in $CACHED_RUNNER" - sudo cp -a "$CACHED_RUNNER" "/home/{{ .RunnerUsername }}/actions-runner" - sudo chown {{ .RunnerUsername }}:{{ .RunnerGroup }} -R "/home/{{ .RunnerUsername }}/actions-runner" || fail "failed to change owner" + OFS_AVAIL=1 + RUN_HOME="/home/{{ .RunnerUsername }}/actions-runner" + sudo mkdir -p $OFS_DIR/upper-layer $OFS_DIR/work-layer $RUN_HOME + sudo chown {{ .RunnerUsername }}:{{ .RunnerGroup }} -R $OFS_DIR/upper-layer $OFS_DIR/work-layer $CACHED_RUNNER $RUN_HOME + sudo mount -t overlay overlay -o lowerdir=$CACHED_RUNNER,upperdir=$OFS_DIR/upper-layer,workdir=$OFS_DIR/work-layer $RUN_HOME || OFS_AVAIL=0 + if [ $OFS_AVAIL -eq 0 ];then + sendStatus "falling back to non-overlayfs mode" + sudo cp -a "$CACHED_RUNNER/." $RUN_HOME || fail "failed to copy cached runner" + sudo chown {{ .RunnerUsername }}:{{ .RunnerGroup }} -R "$RUN_HOME" || fail "failed to change owner" + fi cd /home/{{ .RunnerUsername }}/actions-runner fi @@ -393,6 +405,49 @@ function Invoke-GarmFailure() { } } +function Set-SystemInfo { + [CmdletBinding()] + param ( + [parameter(Mandatory=$true)] + [string]$CallbackURL, + [parameter(Mandatory=$true)] + [string]$RunnerDir, + [parameter(Mandatory=$true)] + [string]$BearerToken + ) + + # Construct the path to the .runner file + $agentInfoFile = Join-Path $RunnerDir ".runner" + + # Read and parse the JSON content from the .runner file + $agentInfo = ConvertFrom-Json (Get-Content -Raw -Path $agentInfoFile) + $AgentId = $agentInfo.agent_id + + # Retrieve OS information + $osInfo = Get-WmiObject -Class Win32_OperatingSystem + $osName = $osInfo.Caption + $osVersion = $osInfo.Version + + # Strip status from the callback URL + if ($CallbackUrl -match '^(.*)/status(/)?$') { + $CallbackUrl = $matches[1] + } + + $SysInfoUrl = "$CallbackUrl/system-info/" + $Payload = @{ + os_name = $OSName + os_version = $OSVersion + agent_id = $AgentId + } | ConvertTo-Json + + # Send the POST request + try { + Invoke-RestMethod -Uri $SysInfoUrl -Method Post -Body $Payload -ContentType 'application/json' -Headers @{ 'Authorization' = "Bearer $BearerToken" } -ErrorAction Stop + } catch { + Write-Output "Failed to send the system information." + } +} + $GHRunnerGroup = "{{.GitHubRunnerGroup}}" function Install-Runner() { @@ -458,6 +513,7 @@ function Install-Runner() { $SVC_NAME=(gc -raw $serviceNameFile) New-Service -Name "$SVC_NAME" -BinaryPathName "C:\runner\bin\RunnerService.exe" -DisplayName "$SVC_NAME" -Description "GitHub Actions Runner ($SVC_NAME)" -StartupType Automatic Start-Service "$SVC_NAME" + Set-SystemInfo -CallbackURL $CallbackURL -RunnerDir $runnerDir -BearerToken $Token Update-GarmStatus -Message "runner successfully installed" -CallbackURL $CallbackURL -Status "idle" | Out-Null {{- else }} @@ -470,6 +526,7 @@ function Install-Runner() { $agentInfoFile = Join-Path $runnerDir ".runner" $agentInfo = ConvertFrom-Json (gc -raw $agentInfoFile) + Set-SystemInfo -CallbackURL $CallbackURL -RunnerDir $runnerDir -BearerToken $Token Invoke-GarmSuccess -CallbackURL $CallbackURL -Message "runner successfully installed" -AgentID $agentInfo.agentId {{- end }} } catch { diff --git a/vendor/github.com/cloudbase/garm-provider-common/params/github.go b/vendor/github.com/cloudbase/garm-provider-common/params/github.go index 9f64de9..c3e9a0a 100644 --- a/vendor/github.com/cloudbase/garm-provider-common/params/github.go +++ b/vendor/github.com/cloudbase/garm-provider-common/params/github.go @@ -1,3 +1,17 @@ +// Copyright 2023 Cloudbase Solutions SRL +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + package params // RunnerApplicationDownload represents a binary for the self-hosted runner application that can be downloaded. diff --git a/vendor/golang.org/x/crypto/bcrypt/bcrypt.go b/vendor/golang.org/x/crypto/bcrypt/bcrypt.go index 5577c0f..dc93118 100644 --- a/vendor/golang.org/x/crypto/bcrypt/bcrypt.go +++ b/vendor/golang.org/x/crypto/bcrypt/bcrypt.go @@ -4,7 +4,7 @@ // Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing // algorithm. See http://www.usenix.org/event/usenix99/provos/provos.pdf -package bcrypt // import "golang.org/x/crypto/bcrypt" +package bcrypt // The code is a port of Provos and Mazières's C implementation. import ( diff --git a/vendor/golang.org/x/crypto/blowfish/cipher.go b/vendor/golang.org/x/crypto/blowfish/cipher.go index 213bf20..0898956 100644 --- a/vendor/golang.org/x/crypto/blowfish/cipher.go +++ b/vendor/golang.org/x/crypto/blowfish/cipher.go @@ -11,7 +11,7 @@ // Deprecated: any new system should use AES (from crypto/aes, if necessary in // an AEAD mode like crypto/cipher.NewGCM) or XChaCha20-Poly1305 (from // golang.org/x/crypto/chacha20poly1305). -package blowfish // import "golang.org/x/crypto/blowfish" +package blowfish // The code is a port of Bruce Schneier's C implementation. // See https://www.schneier.com/blowfish.html. diff --git a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305.go b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305.go index 93da732..8cf5d81 100644 --- a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305.go +++ b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305.go @@ -5,7 +5,7 @@ // Package chacha20poly1305 implements the ChaCha20-Poly1305 AEAD and its // extended nonce variant XChaCha20-Poly1305, as specified in RFC 8439 and // draft-irtf-cfrg-xchacha-01. -package chacha20poly1305 // import "golang.org/x/crypto/chacha20poly1305" +package chacha20poly1305 import ( "crypto/cipher" diff --git a/vendor/golang.org/x/crypto/hkdf/hkdf.go b/vendor/golang.org/x/crypto/hkdf/hkdf.go index f4ded5f..3bee662 100644 --- a/vendor/golang.org/x/crypto/hkdf/hkdf.go +++ b/vendor/golang.org/x/crypto/hkdf/hkdf.go @@ -8,7 +8,7 @@ // HKDF is a cryptographic key derivation function (KDF) with the goal of // expanding limited input keying material into one or more cryptographically // strong secret keys. -package hkdf // import "golang.org/x/crypto/hkdf" +package hkdf import ( "crypto/hmac" diff --git a/vendor/golang.org/x/sys/unix/mremap.go b/vendor/golang.org/x/sys/unix/mremap.go index fd45fe5..3a5e776 100644 --- a/vendor/golang.org/x/sys/unix/mremap.go +++ b/vendor/golang.org/x/sys/unix/mremap.go @@ -50,3 +50,8 @@ func (m *mremapMmapper) Mremap(oldData []byte, newLength int, flags int) (data [ func Mremap(oldData []byte, newLength int, flags int) (data []byte, err error) { return mapper.Mremap(oldData, newLength, flags) } + +func MremapPtr(oldAddr unsafe.Pointer, oldSize uintptr, newAddr unsafe.Pointer, newSize uintptr, flags int) (ret unsafe.Pointer, err error) { + xaddr, err := mapper.mremap(uintptr(oldAddr), oldSize, newSize, flags, uintptr(newAddr)) + return unsafe.Pointer(xaddr), err +} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 59542a8..4cc7b00 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -542,6 +542,18 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { } } +//sys pthread_chdir_np(path string) (err error) + +func PthreadChdir(path string) (err error) { + return pthread_chdir_np(path) +} + +//sys pthread_fchdir_np(fd int) (err error) + +func PthreadFchdir(fd int) (err error) { + return pthread_fchdir_np(fd) +} + //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) //sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 77081de..4e92e5a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -154,6 +154,15 @@ func Munmap(b []byte) (err error) { return mapper.Munmap(b) } +func MmapPtr(fd int, offset int64, addr unsafe.Pointer, length uintptr, prot int, flags int) (ret unsafe.Pointer, err error) { + xaddr, err := mapper.mmap(uintptr(addr), length, prot, flags, fd, offset) + return unsafe.Pointer(xaddr), err +} + +func MunmapPtr(addr unsafe.Pointer, length uintptr) (err error) { + return mapper.munmap(uintptr(addr), length) +} + func Read(fd int, p []byte) (n int, err error) { n, err = read(fd, p) if raceenabled { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index ccb02f2..07642c3 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -760,6 +760,39 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pthread_chdir_np(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_pthread_chdir_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pthread_chdir_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pthread_chdir_np pthread_chdir_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pthread_fchdir_np(fd int) (err error) { + _, _, e1 := syscall_syscall(libc_pthread_fchdir_np_trampoline_addr, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pthread_fchdir_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pthread_fchdir_np pthread_fchdir_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index 8b8bb28..923e08c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -228,6 +228,16 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_pthread_chdir_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pthread_chdir_np(SB) +GLOBL ·libc_pthread_chdir_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pthread_chdir_np_trampoline_addr(SB)/8, $libc_pthread_chdir_np_trampoline<>(SB) + +TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pthread_fchdir_np(SB) +GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB) + TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 1b40b99..7d73dda 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -760,6 +760,39 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pthread_chdir_np(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_pthread_chdir_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pthread_chdir_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pthread_chdir_np pthread_chdir_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pthread_fchdir_np(fd int) (err error) { + _, _, e1 := syscall_syscall(libc_pthread_fchdir_np_trampoline_addr, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pthread_fchdir_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pthread_fchdir_np pthread_fchdir_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index 08362c1..0577001 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -228,6 +228,16 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_pthread_chdir_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pthread_chdir_np(SB) +GLOBL ·libc_pthread_chdir_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pthread_chdir_np_trampoline_addr(SB)/8, $libc_pthread_chdir_np_trampoline<>(SB) + +TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pthread_fchdir_np(SB) +GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB) + TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/modules.txt b/vendor/modules.txt index b6450a0..fbb060b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -104,8 +104,8 @@ github.com/aws/smithy-go/time github.com/aws/smithy-go/transport/http github.com/aws/smithy-go/transport/http/internal/io github.com/aws/smithy-go/waiter -# github.com/cloudbase/garm-provider-common v0.1.2 -## explicit; go 1.20 +# github.com/cloudbase/garm-provider-common v0.1.3 +## explicit; go 1.22 github.com/cloudbase/garm-provider-common/cloudconfig github.com/cloudbase/garm-provider-common/defaults github.com/cloudbase/garm-provider-common/errors @@ -159,8 +159,8 @@ github.com/xeipuuv/gojsonreference # github.com/xeipuuv/gojsonschema v1.2.0 ## explicit github.com/xeipuuv/gojsonschema -# golang.org/x/crypto v0.24.0 -## explicit; go 1.18 +# golang.org/x/crypto v0.25.0 +## explicit; go 1.20 golang.org/x/crypto/bcrypt golang.org/x/crypto/blowfish golang.org/x/crypto/chacha20 @@ -168,7 +168,7 @@ golang.org/x/crypto/chacha20poly1305 golang.org/x/crypto/hkdf golang.org/x/crypto/internal/alias golang.org/x/crypto/internal/poly1305 -# golang.org/x/sys v0.21.0 +# golang.org/x/sys v0.22.0 ## explicit; go 1.18 golang.org/x/sys/cpu golang.org/x/sys/unix