Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,15 @@
FROM golang:1.11
FROM golang:1.21

ENV PROJ_NAME bitrise

RUN apt-get update

RUN DEBIAN_FRONTEND=noninteractive apt-get -y install curl git mercurial rsync ruby sudo

# From the official Golang Dockerfile
# https://github.com/docker-library/golang/blob/master/1.4/Dockerfile
RUN mkdir -p /go/src /go/bin && chmod -R 777 /go
ENV GOPATH /go
ENV PATH /go/bin:$PATH

# Install required (testing) tools
# Install dependencies
RUN go get -u github.com/tools/godep
# Check for unhandled errors
RUN go get -u github.com/kisielk/errcheck
# Go lint
RUN go get -u github.com/golang/lint/golint

RUN mkdir -p /go/src/github.com/bitrise-io/$PROJ_NAME
COPY . /go/src/github.com/bitrise-io/$PROJ_NAME

WORKDIR /go/src/github.com/bitrise-io/$PROJ_NAME
# install
RUN go install

# setup (downloads envman & stepman)
RUN bitrise setup
RUN $HOME/.bitrise/tools/stepman setup -c https://github.com/bitrise-io/bitrise-steplib.git

CMD bitrise version
27 changes: 16 additions & 11 deletions bitrise/dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ func CheckIsHomebrewInstalled() error {

func checkIsBitriseToolInstalled(toolname, minVersion string, isInstall bool) error {
doInstall := func() error {
officialGithub := "https://github.com/bitrise-io/" + toolname
log.Warnf("No supported %s version found", toolname)
log.Printf("You can find more information about %s on its official GitHub page: %s", toolname, officialGithub)

// Install
var err error
progress.ShowIndicator("Installing", func() {
Expand All @@ -158,30 +154,39 @@ func checkIsBitriseToolInstalled(toolname, minVersion string, isInstall bool) er
}

// check whether installed
progInstallPth, err := utils.CheckProgramInstalledPath(toolname)
progInstallPth, err := exec.LookPath(toolname)
if err != nil {
if !isInstall {
return err
}

officialGithub := "https://github.com/bitrise-io/" + toolname
log.Warnf("%s isn't installed", toolname)
log.Printf("You can find more information about %s on its official GitHub page: %s", toolname, officialGithub)
return doInstall()
}
versionOutput, err := command.RunCommandAndReturnCombinedStdoutAndStderr(toolname, "-version")
if err != nil {
log.Print(versionOutput)
return fmt.Errorf("run %s -version", toolname)
var exitErr *exec.ExitError
if errors.As(err, &exitErr) {
return fmt.Errorf("run '%s -version' failed: %s", toolname, versionOutput)
}
return fmt.Errorf("run '%s -version' failed: %s", toolname, err)
}

// version check
isVersionOk, err := versions.IsVersionGreaterOrEqual(versionOutput, minVersion)
if err != nil {
log.Errorf("Failed to validate installed version")
return err
return fmt.Errorf("failed to check %s version: %w", toolname, err)
}
if !isVersionOk {
if !isInstall {
log.Warnf("Installed %s found, but not a supported version (%s)", toolname, versionOutput)
return errors.New("Failed to install required version")
return fmt.Errorf("incompatible %s version (%s), should be >= %s", toolname, versionOutput, minVersion)
}

officialGithub := "https://github.com/bitrise-io/" + toolname
log.Warnf("Incompatible %s version (%s), minimum version: %s", toolname, versionOutput, minVersion)
log.Printf("You can find more information about %s on its official GitHub page: %s", toolname, officialGithub)
return doInstall()
}

Expand Down
2 changes: 1 addition & 1 deletion bitrise/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const (

const (
minEnvmanVersion = "2.4.3"
minStepmanVersion = "0.16.3"
minStepmanVersion = "0.17.0"
)

type PluginDependency struct {
Expand Down
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
app:
build: .
volumes:
- .:/go/src/github.com/bitrise-io/bitrise
services:
app:
build: .
volumes:
- .:/go/src/github.com/bitrise-io/bitrise