This is right, but it is confusing. because the implementation is a little too clever. It happens to be that all the allowed file types are of the form .tar.XX where XX is a valid compression.
To make this more readable, ee should simply have a map of allowed file extensions to the compression method they belong with. But that is not your fault, so I won't block merge on that.. 
pkg_tar with extension tgz does not apply gzip compression
### Description of the problem / feature request:

`pkg_tar` with the extension `tgz` does not gzip the tar file. 

Using the extensions `tar.gz` does gzip the tar

The [documentation here](https://docs.bazel.build/versions/master/be/pkg.html) indicate `tgz` extensions should apply gzip compressed

### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

```
pkg_tar(
    name = "content",
    srcs = [
        "testdata/bat/bat",
        "testdata/baz",
    ],
)

pkg_tar(
    name = "gzip_content",
    extension = "tgz",
    deps = [
        ":content",
    ],
)
```

```
$ file gzip_content.tgz
gzip_content.tgz: POSIX tar archive (GNU)
```

```
$ file gzip_content.tar.gz
gzip_content.tar.gz: gzip compressed data, was "gzip_content.tar", max compression
```

### What operating system are you running Bazel on?

macOS High Sierra 10.13.4

### What's the output of `bazel info release`?

release 0.12.0-homebrew

tools/build_defs/pkg/pkg.bzl
tools/build_defs/pkg/pkg.bzl
diff --git a/tools/build_defs/pkg/pkg.bzl b/tools/build_defs/pkg/pkg.bzl
index 93ff5daf3e6e38..62cf4d94aee497 100644
--- a/tools/build_defs/pkg/pkg.bzl
+++ b/tools/build_defs/pkg/pkg.bzl
@@ -92,6 +92,8 @@ def _pkg_tar_impl(ctx):
         if dotPos > 0:
             dotPos += 1
             args += ["--compression=%s" % ctx.attr.extension[dotPos:]]
+        elif ctx.attr.extension == "tgz":
+            args += ["--compression=gz"]
     args += ["--tar=" + f.path for f in ctx.files.deps]
     args += [
         "--link=%s:%s" % (_quote(k, protect = ":"), ctx.attr.symlinks[k])
