diff --git a/.github/workflows/build-publish-from-fork.yaml b/.github/workflows/build-publish-from-fork.yaml deleted file mode 100644 index 7a2ff2b9f..000000000 --- a/.github/workflows/build-publish-from-fork.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: build-publish-from-fork -on: - workflow_dispatch: {} - push: {} - pull_request: {} - -jobs: - build: - runs-on: ubuntu-latest - if: github.repository != 'getporter/porter' - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Login to DockerHub - if: github.event_name != 'pull_request' - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ github.token }} - - uses: actions/setup-go@v3 - with: - go-version-file: go.mod - cache: true - cache-dependency-path: go.sum - - name: Set up Mage - run: go run mage.go EnsureMage - - name: Publish - if: ${{ github.event_name != 'pull_request' }} - env: - PORTER_REGISTRY: ghcr.io/${{ github.repository }} - run: | - mage -v XBuildAll - mage -v PublishServerMultiArchImages diff --git a/.github/workflows/build_pipelinesrelease_template.yml b/.github/workflows/build_pipelinesrelease_template.yml index c4cc138da..7261baf28 100644 --- a/.github/workflows/build_pipelinesrelease_template.yml +++ b/.github/workflows/build_pipelinesrelease_template.yml @@ -91,34 +91,12 @@ jobs: run: mage TestUnit shell: bash Validate-integration_test: - env: - GHCR_IOGETPORTER_DOCKER_REGISTRY: https://ghcr.io - GHCR_IOGETPORTER_DOCKER_USERNAME: getporterbot name: Integration Test needs: - Validate-build - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v4.1.0 - - uses: actions/setup-go@v4 - with: - go-version: "${{ inputs.GOVERSION }}" - - name: Download Bin - uses: actions/download-artifact@v4.1.0 - with: - name: build-bin - path: bin - - name: Docker Login - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Configure Agent - run: go run mage.go ConfigureAgent SetBinExecutable - - name: Integration Test - run: mage -v TestIntegration + uses: "./.github/workflows/porter-integration-release.yml" + with: + registry: ${{inputs.registry}} Validate-smoke_test: name: Run smoke tests on needs: @@ -140,7 +118,7 @@ jobs: run: go run mage.go ConfigureAgent UseXBuildBinaries - name: Run Smoke Tests run: mage -v TestSmoke - Publish-publish_binaries: + publish_binaries: name: Publish Binaries needs: - Validate-build @@ -150,6 +128,7 @@ jobs: - Validate-integration_test - Validate-smoke_test runs-on: ubuntu-latest + permissions: write-all if: success() && inputs.shouldPublish steps: - name: checkout @@ -167,11 +146,13 @@ jobs: - name: Publish Porter Binaries env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + VERSION: ${{github.ref_name}} run: mage PublishPorter PublishMixins - Publish-publish_docker: + publish-ghcr: env: - DOCKER_REGISTRY: - DOCKER_USERNAME: + DOCKER_REGISTRY: ${{inputs.registry}} + DOCKER_USERNAME: getporterbot + VERSION: ${{github.ref_name}} name: Publish Docker Images needs: - Validate-build @@ -181,6 +162,7 @@ jobs: - Validate-integration_test - Validate-smoke_test runs-on: ubuntu-latest + permissions: write-all if: success() && inputs.shouldPublish steps: - name: checkout @@ -195,12 +177,11 @@ jobs: path: bin - name: Setup Bin run: go run mage.go ConfigureAgent UseXBuildBinaries - # Unable to determine registry '${{parameters.registry}}' type. The service connection was not found or the authentication type not supported. - - name: Docker Login + - name: Login to Container Registry uses: docker/login-action@v3.0.0 with: - registry: "${{ env.DOCKER_REGISTRY }}" - username: "${{ env.DOCKER_USERNAME }}" - password: "${{ secrets.DOCKER_PASSWORD }}" + registry: "${{inputs.registry}}" + username: "${{ github.actor }}" + password: "${{ secrets.GITHUB_TOKEN }}" - name: Publish Docker Images to ${{inputs.registry}} run: PORTER_REGISTRY=${{inputs.registry}} mage PublishImages diff --git a/.github/workflows/check-licenses.yaml b/.github/workflows/check-licenses.yaml index 99576c64f..9d306c380 100644 --- a/.github/workflows/check-licenses.yaml +++ b/.github/workflows/check-licenses.yaml @@ -14,7 +14,7 @@ jobs: with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version-file: go.mod cache: true diff --git a/.github/workflows/close-issues.yaml b/.github/workflows/close-issues.yaml index 3487ea91b..702fc94a7 100644 --- a/.github/workflows/close-issues.yaml +++ b/.github/workflows/close-issues.yaml @@ -10,10 +10,10 @@ on: - release/* jobs: - closeIssue: + closeIssueOnPrMergeTrigger: runs-on: ubuntu-latest steps: - name: Closes issues related to a merged pull request. - uses: ldez/gha-mjolnir@v1.1.0 + uses: ldez/gha-mjolnir@v1.0.3 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 6b4fea43c..51c579f2b 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -21,7 +21,7 @@ jobs: with: fetch-depth: 0 # Get all git history - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version-file: go.mod cache: true diff --git a/.github/workflows/integ-reuseable-workflow.yml b/.github/workflows/integ-reuseable-workflow.yml new file mode 100644 index 000000000..699e82e65 --- /dev/null +++ b/.github/workflows/integ-reuseable-workflow.yml @@ -0,0 +1,45 @@ +name: integ reusable workflow + +on: + workflow_call: + inputs: + test_name: + type: string + required: true + registry: + type: string + required: true + default: ghcr.io +env: + GOVERSION: 1.20.7 + PORTER_INTEG_FILE: ${{inputs.test_name}}.go + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - uses: actions/setup-go@v4 + with: + go-version: "${{ env.GOVERSION }}" + cache: true + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + - name: Docker Login + uses: docker/login-action@v3.0.0 + with: + registry: ${{inputs.registry}} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Configure Agent + run: go run mage.go build + shell: bash + - name: Integration Test + run: go run mage.go -v TestIntegration + shell: bash diff --git a/.github/workflows/porter-integration-pr.yml b/.github/workflows/porter-integration-pr.yml new file mode 100644 index 000000000..4dfe1972b --- /dev/null +++ b/.github/workflows/porter-integration-pr.yml @@ -0,0 +1,123 @@ +name: porter/porter-integration +on: + pull_request: + branches: + - main + paths-ignore: + - 'docs/**' + +env: + GOVERSION: 1.20.7 + +jobs: + archive_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: archive_test + build_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: build_test + cli_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: cli_test + connection_nix_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: connection_nix_test + copy_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: copy_test + dependenciesv1_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: dependenciesv1_test + dependenciesv2_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: dependenciesv2_test + driver_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: driver_test + install_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: install_test + invoke_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: invoke_test + lint_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: lint_test + migration_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: migration_test + outputs_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: outputs_test + publish_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: publish_test + pull_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: pull_test + registry_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: registry_integration_test + schema_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: schema_test + sensitive_data_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: sensitive_data_test + suppress_output_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: suppress_output_test + telemetry_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: telemetry_test + # Reusable workflows only supports 20 jobs + uninstall_test_integ: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - uses: actions/setup-go@v4 + with: + go-version: "${{ env.GOVERSION }}" + cache: true + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + - name: Docker Login + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Configure Agent + run: go run mage.go build + shell: bash + - name: Integration Test + env: + PORTER_INTEG_FILE: uninstall_test.go + run: go run mage.go -v TestIntegration + shell: bash diff --git a/.github/workflows/porter-integration-release.yml b/.github/workflows/porter-integration-release.yml new file mode 100644 index 000000000..e6876b39c --- /dev/null +++ b/.github/workflows/porter-integration-release.yml @@ -0,0 +1,144 @@ +name: porter/porter-integration +on: + workflow_call: + inputs: + registry: + type: string + required: false + default: ghcr.io + +env: + GOVERSION: 1.20.7 + +jobs: + archive_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: archive_test + registry: ${{inputs.registry}} + build_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: build_test + registry: ${{inputs.registry}} + cli_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: cli_test + registry: ${{inputs.registry}} + connection_nix_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: connection_nix_test + registry: ${{inputs.registry}} + copy_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: copy_test + registry: ${{inputs.registry}} + dependenciesv1_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: dependenciesv1_test + registry: ${{inputs.registry}} + dependenciesv2_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: dependenciesv2_test + registry: ${{inputs.registry}} + driver_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: driver_test + registry: ${{inputs.registry}} + install_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: install_test + registry: ${{inputs.registry}} + invoke_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: invoke_test + registry: ${{inputs.registry}} + lint_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: lint_test + registry: ${{inputs.registry}} + migration_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: migration_test + registry: ${{inputs.registry}} + outputs_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: outputs_test + registry: ${{inputs.registry}} + publish_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: publish_test + registry: ${{inputs.registry}} + pull_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: pull_test + registry: ${{inputs.registry}} + registry_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: registry_integration_test + registry: ${{inputs.registry}} + schema_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: schema_test + registry: ${{inputs.registry}} + sensitive_data_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: sensitive_data_test + registry: ${{inputs.registry}} + suppress_output_integration_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: suppress_output_test + registry: ${{inputs.registry}} + telemetry_test: + uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main + with: + test_name: telemetry_test + registry: ${{inputs.registry}} + # Reusable workflows only supports 20 jobs + uninstall_test_integ: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - uses: actions/setup-go@v4 + with: + go-version: "${{ env.GOVERSION }}" + cache: true + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + - name: Docker Login + uses: docker/login-action@v3.0.0 + with: + registry: ${{inputs.registry}} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Configure Agent + run: go run mage.go build + shell: bash + - name: Integration Test + env: + PORTER_INTEG_FILE: uninstall_test.go + run: go run mage.go -v TestIntegration + shell: bash diff --git a/.github/workflows/porter-integration.yml b/.github/workflows/porter-integration.yml deleted file mode 100644 index 7a177e2f3..000000000 --- a/.github/workflows/porter-integration.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: porter/porter-integration -# this will only run when this is on main branch apparently so use pr for now (temporary) -#on: -# issue_comment: -# types: [created, edited] -on: - pull_request: - branches: - - main - paths-ignore: - - 'docs/**' - -env: - GOVERSION: 1.20.7 - -jobs: - Integration_test: - name: Integration Test - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v4.1.0 - - uses: actions/setup-go@v4 - with: - go-version: "${{ env.GOVERSION }}" - - name: Docker Login - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Native Build - run: go run mage.go Build - shell: bash - - name: Integration Test - run: go run mage.go -v TestIntegration - shell: bash diff --git a/.github/workflows/porter.yml b/.github/workflows/porter.yml index 348c73d3f..14472eefc 100644 --- a/.github/workflows/porter.yml +++ b/.github/workflows/porter.yml @@ -18,6 +18,7 @@ jobs: - uses: actions/setup-go@v4 with: go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use. + cache: true - run: go version - name: Native Build run: go run mage.go build @@ -37,6 +38,7 @@ jobs: - uses: actions/setup-go@v4 with: go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use. + cache: true - run: go version - name: Cross Compile run: go run mage.go -v XBuildAll @@ -56,6 +58,7 @@ jobs: - uses: actions/setup-go@v4 with: go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use. + cache: true - run: go version - name: Unit Test run: go run mage.go -v TestUnit @@ -70,6 +73,7 @@ jobs: - uses: actions/setup-go@v4 with: go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use. + cache: true - run: go version - name: Vet run: go run mage.go Vet @@ -90,6 +94,7 @@ jobs: - uses: actions/setup-go@v4 with: go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use. + cache: true - run: go version - name: Download Cross-Compiled Porter Binaries uses: actions/download-artifact@v3.0.1 @@ -117,6 +122,7 @@ jobs: - uses: actions/setup-go@v4 with: go-version: "${{ env.GOVERSION }}" # The Go version to download (if necessary) and use. + cache: true - run: go version - name: Setup Bin run: go run mage.go UseXBuildBinaries diff --git a/.github/workflows/trivy.yaml b/.github/workflows/trivy.yaml index 05ac36e4a..d6c0fa8fb 100644 --- a/.github/workflows/trivy.yaml +++ b/.github/workflows/trivy.yaml @@ -21,7 +21,7 @@ jobs: with: fetch-depth: 0 # Get all git history - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: go-version-file: go.mod cache: true diff --git a/build/testdata/bundles/wordpress/.gitignore b/build/testdata/bundles/wordpress/.gitignore index ea5d8c03a..e69de29bb 100644 --- a/build/testdata/bundles/wordpress/.gitignore +++ b/build/testdata/bundles/wordpress/.gitignore @@ -1,2 +0,0 @@ -Dockerfile -.cnab diff --git a/build/testdata/bundles/wordpressv2/.gitignore b/build/testdata/bundles/wordpressv2/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/cmd/porter/installations.go b/cmd/porter/installations.go index 2d9daedc2..94105b77b 100644 --- a/cmd/porter/installations.go +++ b/cmd/porter/installations.go @@ -418,6 +418,7 @@ func addBundleActionFlags(f *pflag.FlagSet, actionOpts porter.BundleAction) { addBundlePullFlags(f, &opts.BundlePullOptions) f.BoolVar(&opts.AllowDockerHostAccess, "allow-docker-host-access", false, "Controls if the bundle should have access to the host's Docker daemon with elevated privileges. See https://getporter.org/configuration/#allow-docker-host-access for the full implications of this flag.") + f.StringArrayVar(&opts.HostVolumeMounts, "mount-host-volume", nil, "Mount a host volume into the bundle. Format is :[: