Skip to content

Commit

Permalink
Merge pull request #3662 from telepresenceio/thallgren/release-to-ghr…
Browse files Browse the repository at this point in the history
…c.io

Publish release images to ghrc.io instead of dockerhub
  • Loading branch information
thallgren authored Aug 13, 2024
2 parents d309db9 + 3b76e8e commit dd6a286
Show file tree
Hide file tree
Showing 19 changed files with 152 additions and 182 deletions.
Empty file.
50 changes: 0 additions & 50 deletions .github/actions/test-release/action.yaml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/prepare.yaml

This file was deleted.

162 changes: 108 additions & 54 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,27 @@ on:
- v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-test.[0-9]+

env:
TELEPRESENCE_REGISTRY: ghcr.io/telepresenceio

jobs:
build-release:
strategy:
fail-fast: false
matrix:
runners:
runner:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.runners }}
arch:
- amd64
- arm64
exclude:
- runner: windows-latest
arch: arm64
runs-on: ${{ matrix.runner }}
env:
GOARCH: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -35,69 +46,74 @@ jobs:
name: binaries
path: build-output/release
retention-days: 1
- name: generate binaries darwin-amd64 # macos-latest is arm64, so we need an extra amd64 build
if: runner.os == 'macOS'
env:
GOARCH: amd64
run: make clean release-binary
- name: Upload binaries darwin-amd64
if: runner.os == 'macOS'
uses: actions/upload-artifact@v3
with:
name: binaries
path: build-output/release
retention-days: 1
- name: generate binaries linux-arm64 # ubuntu-latest is amd64, so we need an extra arm64 build
if: runner.os == 'Linux'
env:
GOARCH: arm64
run: make clean release-binary
- name: Upload binaries linux-arm64
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: binaries
path: build-output/release
retention-days: 1

publish-release:
push-images:
runs-on: ubuntu-latest
needs: build-release
steps:
- name: Setup docker builx
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/install-dependencies
name: install dependencies
- name: set version
shell: bash
run: echo "TELEPRESENCE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Setup docker buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Upload Docker image
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Upload Docker images
run: |
docker login -u="${{ secrets.DOCKERHUB_USERNAME }}" -p="${{ secrets.DOCKERHUB_PASSWORD }}"
make push-images-x
publish-release:
runs-on: ubuntu-latest
needs:
- build-release
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Determine if version is RC, TEST, or GA
id: semver_check
run: |
if [[ "${{ github.ref_name }}" =~ ^v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+$ ]]; then
echo "MAKE_LATEST=false" >> $GITHUB_ENV
echo "DRAFT=false" >> $GITHUB_ENV
echo "PRERELEASE=true" >> $GITHUB_ENV
echo "make_latest=false" >> $GITHUB_OUTPUT
echo "draft=false" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" =~ ^v[0-9]+.[0-9]+.[0-9]+-test.[0-9]+$ ]]; then
echo "MAKE_LATEST=false" >> $GITHUB_ENV
echo "DRAFT=true" >> $GITHUB_ENV
echo "PRERELEASE=false" >> $GITHUB_ENV
echo "make_latest=false" >> $GITHUB_OUTPUT
echo "draft=false" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" =~ ^v[0-9]+.[0-9]+.[0-9]+-draft.[0-9]+$ ]]; then
echo "make_latest=false" >> $GITHUB_OUTPUT
echo "draft=true" >> $GITHUB_OUTPUT
echo "prerelease=false" >> $GITHUB_OUTPUT
else
echo "MAKE_LATEST=true" >> $GITHUB_ENV
echo "DRAFT=false" >> $GITHUB_ENV
echo "PRERELEASE=false" >> $GITHUB_ENV
echo "make_latest=true" >> $GITHUB_OUTPUT
echo "draft=false" >> $GITHUB_OUTPUT
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Create draft release
if: steps.semver_check.outputs.draft == true
uses: ncipollo/release-action@v1
with:
artifacts: "binaries/*"
token: ${{ secrets.GITHUB_TOKEN }}
draft:
tag: ${{ github.ref_name }}
body: |
## Draft Release
For more information, visit our [installation docs](https://www.telepresence.io/docs/latest/quick-start/).
- name: Create release
if: steps.semver_check.outputs.draft != true
uses: ncipollo/release-action@v1
with:
artifacts: "binaries/*"
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{ env.PRERELEASE }}
makeLatest: ${{ env.MAKE_LATEST }}
draft: ${{ env.DRAFT }}
prerelease: ${{ steps.semver_check.outputs.prerelease }}
makeLatest: ${{ steps.semver_check.outputs.make_latest }}
tag: ${{ github.ref_name }}
body: |
## Official Release Artifacts
Expand All @@ -116,20 +132,58 @@ jobs:
![Assets](https://static.scarf.sh/a.png?x-pxid=d842651a-2e4d-465a-98e1-4808722c01ab)
test-release:
needs: publish-release
needs:
- push-images
- publish-release
if: needs.publish-release.semver_check.outputs.draft != true
strategy:
fail-fast: false
matrix:
runners:
runner:
- ubuntu-latest
- ubuntu-arm64
- macos-latest
- macOS-arm64
- windows-2019
runs-on: ${{ matrix.runners }}
- windows-latest
arch:
- amd64
- arm64
exclude:
- runner: windows-latest
arch: arm64
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Test release
uses: ./.github/actions/test-release
with:
release_version: ${{ github.ref_name }}
- name: download binary
env:
DOWNLOAD_URL: "https://app.getambassador.io/download/tel2oss/releases/download/${{ github.ref_name }}"
shell: bash
run: |
if [ "${{ runner.os }}" = "macOS" ]; then
curl -fL ${{ env.DOWNLOAD_URL }}/telepresence-darwin-${{ matrix.arch }} -o ./telepresence || { echo "Curl command failed" ; exit 1; }
elif [ "${{ runner.os }}" = "Windows" ]; then
curl -fL ${{ env.DOWNLOAD_URL }}/telepresence-windows-${{ matrix.arch }}.zip -o ./telepresence.zip || { echo "Curl command failed" ; exit 1; }
unzip ./telepresence.zip || { echo "Unzip command failed" ; exit 1; }
else
curl -fL ${{ env.DOWNLOAD_URL }}/telepresence-linux-${{ matrix.arch }} -o ./telepresence || { echo "Curl command failed" ; exit 1; }
fi
- name: test binary
shell: bash
if: ${{ !(runner.os == 'Linux' && runner.arch == 'X64' && matrix.arch == 'arm64') }}
run: |
chmod +x ./telepresence
output=$(./telepresence version)

if [ $? -eq 0 ]; then
echo "Telepresence command executed successfully"
else
echo "Telepresence command failed"
exit 1
fi

echo "$output" | grep -q "Client\s*:\s*${{ github.ref_name }}"

if [ $? -eq 0 ]; then
echo "Version match!"
else
echo "Version does not match!"
exit 1
fi
6 changes: 6 additions & 0 deletions CHANGELOG.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ items:
The behavior is controlled by `workloads.argoRollouts.enabled` Helm chart value.
It is recommended to set the following annotation <code>telepresence.getambassador.io/inject-traffic-agent: enabled</code>
to avoid creation of unwanted revisions.
- type: change
title: Use ghcr.io/telepresenceio instead of docker.io/datawire for OSS images.
body: >-
All OSS telepresence images are now published at the public registry ghcr.io/telepresenceio
and all references from the client and traffic-manager has been updated to use this registry
instead of the one at docker.io/datawire.
- type: bugfix
title: Detect minikube network when connecting with --docker
body: >-
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

TELEPRESENCE_REGISTRY ?= docker.io/datawire
TELEPRESENCE_REGISTRY ?= ghcr.io/telepresenceio
TELEPRESENCE_VERSION ?= $(shell unset GOOS GOARCH; go run ./build-aux/genversion)
# Ensure that the variable is fully expanded. We don't want to call genversion repeatedly
# as it may produce different results every time.
Expand Down
2 changes: 1 addition & 1 deletion build-aux/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ endif
# is only used for extensions. Therefore, we want to validate that our tests, and
# telepresence, run without requiring any outside dependencies.
set -o pipefail
TELEPRESENCE_MAX_LOGFILES=300 TELEPRESENCE_LOGIN_DOMAIN=127.0.0.1 CGO_ENABLED=$(CGO_ENABLED) go test -failfast -json -timeout=55m ./integration_test/... | $(tools/test-report)
TELEPRESENCE_MAX_LOGFILES=300 TELEPRESENCE_LOGIN_DOMAIN=127.0.0.1 CGO_ENABLED=$(CGO_ENABLED) go test -failfast -json -timeout=80m ./integration_test/... | $(tools/test-report)

.PHONY: _login
_login:
Expand Down
4 changes: 2 additions & 2 deletions charts/telepresence/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The following tables lists the configurable parameters of the Telepresence chart

| Parameter | Description | Default |
|------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|
| image.registry | The repository to download the image from. Set `TELEPRESENCE_REGISTRY=image.registry` locally if changing this value. | `docker.io/datawire` |
| image.registry | The repository to download the image from. Set `TELEPRESENCE_REGISTRY=image.registry` locally if changing this value. | `ghcr.io/telepresenceio` |
| image.name | The name of the image to use for the traffic-manager | `tel2` |
| image.pullPolicy | How the `Pod` will attempt to pull the image. | `IfNotPresent` |
| image.tag | Override the version of the Traffic Manager to be installed. | `""` (Defined in `appVersion` Chart.yaml) |
Expand Down Expand Up @@ -50,7 +50,7 @@ The following tables lists the configurable parameters of the Telepresence chart
| agent.resources | The resources for the injected agent container | |
| agent.initResources | The resources for the injected init container | |
| agent.securityContext | The security context to use for the injected agent container | defaults to the securityContext of the first container of the app |
| agent.image.registry | The registry for the injected agent image | `docker.io/datawire` |
| agent.image.registry | The registry for the injected agent image | `ghcr.io/telepresenceio` |
| agent.image.name | The name of the injected agent image | `""` |
| agent.image.tag | The tag for the injected agent image | `""` (Defined in `appVersion` Chart.yaml) |
| agent.image.pullPolicy | Pull policy in the webhook for the traffic agent image | `IfNotPresent` |
Expand Down
4 changes: 2 additions & 2 deletions charts/telepresence/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ replicaCount: 1
# ensure that the tag is the same as the client version and that the
# TELEPRESENCE_REGISTRY environment variable is equal to image.repository.
#
# The client will default to docker.io/datawire/tel2:{{CLIENT_VERSION}}
# The client will default to ghcr.io/telepresenceio/tel2:{{CLIENT_VERSION}}

image:
registry: docker.io/datawire
registry: ghcr.io/telepresenceio
name: tel2
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
Expand Down
2 changes: 1 addition & 1 deletion cmd/traffic/cmd/agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (

var testConfig = agentconfig.Sidecar{
Create: false,
AgentImage: "docker.io/datawire/tel2:2.5.4",
AgentImage: "ghcr.io/telepresenceio/tel2:2.5.4",
AgentName: "test-echo",
LogLevel: "debug",
Namespace: namespace,
Expand Down
2 changes: 1 addition & 1 deletion cmd/traffic/cmd/manager/managerutil/agentimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func GetAgentImageRetriever(ctx context.Context) ImageRetriever {
return nil
}

// GetAgentImage returns the fully qualified name of the traffic-agent image, i.e. "docker.io/tel2:2.7.4",
// GetAgentImage returns the fully qualified name of the traffic-agent image, i.e. "ghcr.io/telepresenceio/tel2:2.20.0",
// or an empty string if no agent image has been configured.
func GetAgentImage(ctx context.Context) string {
if ir, ok := ctx.Value(irKey{}).(ImageRetriever); ok {
Expand Down
Loading

0 comments on commit dd6a286

Please sign in to comment.